Optimize u64_to_{le,be}_bytes

LLVM fails to properly optimize the shifts used to convert the source
value to the right endianess. The resulting assembly copies the value
to the stack one byte at a time even when there's no conversion required
(e.g. u64_to_le_bytes on a little endian machine).

Instead of doing the conversion ourselves using shifts, we can use the
existing intrinsics to perform the endianess conversion and then
transmute the value to get a fixed vector of its bytes.

Before:

test be_i8  ... bench:     21442 ns/iter (+/- 70)
test be_i16 ... bench:     21447 ns/iter (+/- 45)
test be_i32 ... bench:     23832 ns/iter (+/- 63)
test be_i64 ... bench:     26887 ns/iter (+/- 267)

test le_i8  ... bench:     21442 ns/iter (+/- 56)
test le_i16 ... bench:     21448 ns/iter (+/- 36)
test le_i32 ... bench:     23825 ns/iter (+/- 153)
test le_i64 ... bench:     26271 ns/iter (+/- 138)

After:

test be_i8  ... bench:     21438 ns/iter (+/- 10)
test be_i16 ... bench:     21441 ns/iter (+/- 15)
test be_i32 ... bench:     19057 ns/iter (+/- 6)
test be_i64 ... bench:     21439 ns/iter (+/- 34)

test le_i8  ... bench:     21438 ns/iter (+/- 19)
test le_i16 ... bench:     21439 ns/iter (+/- 8)
test le_i32 ... bench:     21439 ns/iter (+/- 19)
test le_i64 ... bench:     21438 ns/iter (+/- 22)
auto merge of #11973 : dotdash/rust/u64_to_bytes, r=huonw

LLVM fails to properly optimize the shifts used to convert the source
value to the right endianess. The resulting assembly copies the value
to the stack one byte at a time even when there's no conversion required
(e.g. u64_to_le_bytes on a little endian machine).

Instead of doing the conversion ourselves using shifts, we can use the
existing intrinsics to perform the endianess conversion and then
transmute the value to get a fixed vector of its bytes.

Before:
````
test be_i8  ... bench:     21442 ns/iter (+/- 70)
test be_i16 ... bench:     21447 ns/iter (+/- 45)
test be_i32 ... bench:     23832 ns/iter (+/- 63)
test be_i64 ... bench:     26887 ns/iter (+/- 267)

test le_i8  ... bench:     21442 ns/iter (+/- 56)
test le_i16 ... bench:     21448 ns/iter (+/- 36)
test le_i32 ... bench:     23825 ns/iter (+/- 153)
test le_i64 ... bench:     26271 ns/iter (+/- 138)
````
After:
````
test be_i8  ... bench:     21438 ns/iter (+/- 10)
test be_i16 ... bench:     21441 ns/iter (+/- 15)
test be_i32 ... bench:     19057 ns/iter (+/- 6)
test be_i64 ... bench:     21439 ns/iter (+/- 34)

test le_i8  ... bench:     21438 ns/iter (+/- 19)
test le_i16 ... bench:     21439 ns/iter (+/- 8)
test le_i32 ... bench:     21439 ns/iter (+/- 19)
test le_i64 ... bench:     21438 ns/iter (+/- 22)
````
Add weak external symbol support.

This commit adds a #[weak] attribute that can be applied to extern
functions.

A weak external symbol is a symbol that may or may not have a definition
at run-time.  If the symbol exists, the dynamic linker links it into
the program's address space in the usual way but if it does not exist,
references to the symbol are set to NULL.  It is the responsibility of
the user to check that the symbol is non-NULL before using it.

Note: extern_weak linkage is not supported on OS X.
Link weakly to __pthread_get_minstack().

Use the weak symbol support that was added in the previous commit to
link weakly against __pthread_get_minstack().  Significantly reduces
the thread creation overhead because Thread::imp::create() no longer
goes through a dlopen/dlsym/dlcose cycle for each new thread.