Support weak/common/private/etc. symbol linkage.

This commit adds a feature-gated #[linkage = "foo"] attribute that can
be applied to extern functions and instructs the linker on how to
resolve the symbol.

"extern_weak" linkage is the most immediately useful one because it
lets us link to library symbols that may or may not exist at run-time.

Note that non-default linkage types require toolchain and (sometimes)
dynamic linker support.  For example, "extern_weak" is accepted but
not actually supported by OS X's dyld.

I decided not to warn for known bad platform/linkage combinations
because clang and gcc don't do so either and because you don't rightly
know whether the user is actually using the problematic toolchain or
dynamic linker.  For all we know, they're implementing their own ELF
loader.
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.
auto merge of #11978 : bnoordhuis/rust/weak-symbol-support, r=alexcrichton

The first commit adds a #[weak] attribute, the second commit makes src/libstd/rt/thread.rs link weakly against __pthread_get_minstack().  Avoids the dlopen/dlsym/dlclose cycle for new threads that was introduced in commit 431edac.

I imagine it's possible that you first need to build rustc using the first commit before you can build the second commit.  I can split this into two pull requests if that is the case.