Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Unified Diff: tools/ld_bfd/ld

Issue 8803030: Restore tools/ld_bfd/ld that drover didn't bring back (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ld_bfd/ld
diff --git a/tools/ld_bfd/ld b/tools/ld_bfd/ld
new file mode 100755
index 0000000000000000000000000000000000000000..f8ed124c788800294b8e7fc63f583a18b5f7b246
--- /dev/null
+++ b/tools/ld_bfd/ld
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Wrapper for invoking the BFD loader
+
+A simple script to invoke the bfd loader instead of gold.
+This script is in a filename "ld" so it can be invoked from gcc
+via the -B flag.
+"""
+# TODO(bradchen): Delete this script when Gold supports linker scripts properly.
+import os
+import subprocess
+import sys
+
+def PathTo(fname):
+ if fname[0] == os.pathsep:
+ return fname
+ for p in os.environ["PATH"].split(os.pathsep):
+ fpath = os.path.join(p, fname)
+ if os.path.exists(fpath):
+ return fpath
+ return fname
+
+def FindLDBFD():
+ cxx = os.getenv("CXX")
+ if not cxx:
+ cxx = "g++"
+ popen = subprocess.Popen(cxx + " -print-prog-name=ld",
+ shell=True,
+ stdout=subprocess.PIPE,
+ stdin=subprocess.PIPE)
+ (ld, error) = popen.communicate()
+ if popen.wait() != 0:
+ print "Could not find ld:" + error
+ return "ld"
+ ld = ld.strip()
+ ld_bfd = PathTo(ld + ".bfd")
+ if os.access(ld_bfd, os.X_OK):
+ return ld_bfd
+ return ld
+
+def main():
+ args = [FindLDBFD()] + sys.argv[1:]
+ print("tools/ld_bfd/ld: exec " + ' '.join(args))
+ sys.exit(subprocess.call(args))
+
+if __name__ == "__main__":
+ main()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698