rust/src/test/run-make/issue-12446/Makefile
Alex Crichton cdc5729ea2 rustc: Move local native libs back in link-args
With linkers on unix systems, libraries on the right of the command line are
used to resolve symbols in those on the left of the command line. This means
that arguments must have a right-to-left dependency chain (things on the left
depend on things on the right).

This is currently done by ordering the linker arguments as

  1. Local object
  2. Local native libraries
  3. Upstream rust libraries
  4. Upstream native libraries

This commit swaps the order of 2 and 3 so upstream rust libraries have access to
local native libraries. It has been seen that some upstream crates don't specify
the library that they link to because the name varies per platform (e.g.
lua/glfw/etc).

This commit enables building these libraries by allowing the upstream rust crate
to have access to local native libraries. I believe that the failure mode for
this scheme is when an upstream rust crate depends on a symbol in an upstream
library which is then redefined in a local library. This failure mode is
incredibly uncommon, and the failure mode also varies per platform (OSX behaves
differently), so I believe that a change like this is fine to make.

Closes #12446
2014-02-27 19:59:02 -08:00

7 lines
100 B
Makefile

-include ../tools.mk
all: $(call STATICLIB,foo)
$(RUSTC) foo.rs
$(RUSTC) bar.rs
$(call RUN,bar)