diff options
| author | bors <bors@rust-lang.org> | 2019-03-20 14:42:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-03-20 14:42:47 +0000 |
| commit | 9c499ccfcded4f5be76d70f441a5c7c9d1260226 (patch) | |
| tree | 9063904dc28814baf22ebf3280b30c00539414ee /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 0c8700b9d50a1e3d31f7b6c0956df555279ac441 (diff) | |
| parent | 32d99efa403a5c3ba93d3389110cd9f4226591d2 (diff) | |
| download | rust-9c499ccfcded4f5be76d70f441a5c7c9d1260226.tar.gz rust-9c499ccfcded4f5be76d70f441a5c7c9d1260226.zip | |
Auto merge of #57018 - dcreager:redundant-linker, r=alexcrichton
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
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
