rust/src/librustc_metadata
Douglas Creager d445e1ccaa Keep last redundant linker flag, not first
When a library (L1) is passed to the linker multiple times, this is
sometimes purposeful: there might be several other libraries in the
linker command (L2 and L3) that all depend on L1.  You'd end up with a
(simplified) linker command that looks like:

    -l2 -l1 -l3 -l1

With the previous behavior, when rustc encountered a redundant library,
it would keep the first instance, and remove the later ones, resulting
in:

    -l2 -l1 -l3

This can cause a linker error, because on some platforms (e.g. Linux),
the linker will only include symbols from L1 that are needed *at the
point it's referenced in the command line*.  So if L3 depends on
additional symbols from L1, which aren't needed by L2, the linker won't
know to include them, and you'll end up with "undefined symbols" errors.

A better behavior is to keep the *last* instance of the library:

    -l2 -l3 -l1

This ensures that all "downstream" libraries have been included in the
linker command before the "upstream" library is referenced.

Fixes rust-lang#47989
2018-12-20 16:01:32 -05:00
..
build.rs
Cargo.toml proc_macro: move to a dependency of libtest. 2018-11-30 06:15:20 +02:00
creader.rs proc_macro: introduce a "bridge" between clients (proc macros) and servers (compiler front-ends). 2018-11-30 06:15:19 +02:00
cstore_impl.rs Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
cstore.rs Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
decoder.rs Use type safe VariantIdx instead of usize everywhere 2018-11-12 14:24:45 +01:00
diagnostics.rs
dynamic_lib.rs
encoder.rs Auto merge of #56616 - estebank:issue-56539, r=davidtwco 2018-12-08 19:34:43 +00:00
foreign_modules.rs Use a function to access the Hir map to be able to turn it into a query later 2018-12-06 17:24:36 +01:00
index_builder.rs Use a function to access the Hir map to be able to turn it into a query later 2018-12-06 17:24:36 +01:00
index.rs
isolated_encoder.rs
lib.rs Keep last redundant linker flag, not first 2018-12-20 16:01:32 -05:00
link_args.rs Use a function to access the Hir map to be able to turn it into a query later 2018-12-06 17:24:36 +01:00
locator.rs Remove Session::sysroot(). 2018-12-12 10:36:15 +11:00
native_libs.rs Keep last redundant linker flag, not first 2018-12-20 16:01:32 -05:00
schema.rs Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00