When declaring extern fns from external crates, use the correct abi

Beforehand it was assumed that the standard cdecl abi was used for all extern
fns of extern crates, but this reads the abi of the extern fn type and declares
the function in the local crate with the appropriate type.
auto merge of #9196 : alexcrichton/rust/attempting-9055, r=cmr

Beforehand it was assumed that the standard cdecl abi was used for all extern
fns of extern crates, but this reads the abi of the extern fn type and declares
the function in the local crate with the appropriate type.

I was trying to think of how to write a test for this, but I was just drawing up blanks :(. Are there standard functions in libc which are not of the cdecl abi? If so we could try linking to them and make sure that the cal completes successfully.

Otherwise, I manually verified that the function was declared correctly by looking at the llvm assembly.

cc #9055 (I'm not sure if this will fix that issue)