diff options
| author | Luca Bruno <lucab@debian.org> | 2014-03-02 17:29:54 +0100 |
|---|---|---|
| committer | Luca Bruno <lucab@debian.org> | 2014-03-02 17:29:54 +0100 |
| commit | 1e2f572fb63a37df2c1438de68b1e8cc11c75275 (patch) | |
| tree | a45279f3c4d75640eb28d99e726388c535e5da6f /src/etc | |
| parent | baf79083aedb8ae64efddbcf28b358841cfd1157 (diff) | |
| download | rust-1e2f572fb63a37df2c1438de68b1e8cc11c75275.tar.gz rust-1e2f572fb63a37df2c1438de68b1e8cc11c75275.zip | |
librustc: add LLVM LDFLAGS to deps
This commit let librustc automatically pickup LDFLAGS dependencies inherited from LLVM, which may otherwise result in undefined references to external symbols under certain linking environment. A symptom of this issue is eg. a failure when trying to link against librustc (due to unresolved ffi_*i symbols), while using a system-wide LLVM. Signed-off-by: Luca Bruno <lucab@debian.org>
Diffstat (limited to 'src/etc')
| -rw-r--r-- | src/etc/mklldeps.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/etc/mklldeps.py b/src/etc/mklldeps.py index 0fdeb23d2e3..189d0269cd8 100644 --- a/src/etc/mklldeps.py +++ b/src/etc/mklldeps.py @@ -55,6 +55,7 @@ for llconfig in sys.argv[3:]: f.write("#[cfg(" + ', '.join(cfg) + ")]\n") + # LLVM libs args = [llconfig, '--libs'] args.extend(components) proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -67,6 +68,21 @@ for llconfig in sys.argv[3:]: for lib in out.strip().split(' '): lib = lib[2:] # chop of the leading '-l' f.write("#[link(name = \"" + lib + "\", kind = \"static\")]\n") + + # LLVM ldflags + args = [llconfig, '--ldflags'] + proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = proc.communicate() + + if err: + print("failed to run llconfig: args = `{}`".format(args)) + sys.exit(1) + + for lib in out.strip().split(' '): + if lib[:2] == "-l": + f.write("#[link(name = \"" + lib[2:] + "\")]\n") + + #extra f.write("#[link(name = \"stdc++\")]\n") if os == 'win32': f.write("#[link(name = \"imagehlp\")]\n") |
