summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authormcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-06 01:03:16 +0000
committermcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-06 01:03:16 +0000
commit9f9fd17603984ec0321ff84ba507e9d2cb028263 (patch)
treea8b9f2d383d934a40fc6b9d058ba859b5c14782c /tools
parent6055f97523e7e3843ae338f812a090ff91de64b6 (diff)
downloadchromium_src-9f9fd17603984ec0321ff84ba507e9d2cb028263.zip
chromium_src-9f9fd17603984ec0321ff84ba507e9d2cb028263.tar.gz
chromium_src-9f9fd17603984ec0321ff84ba507e9d2cb028263.tar.bz2
Restore tools/ld_bfd/ld that drover didn't bring back
r113078 was done with "drover --revert 113074". It failed to restore one of the removed files. TBR=mpcomplete@chromium.org BUG= none TEST= none Review URL: http://codereview.chromium.org/8803030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ld_bfd/ld50
1 files changed, 50 insertions, 0 deletions
diff --git a/tools/ld_bfd/ld b/tools/ld_bfd/ld
new file mode 100755
index 0000000..f8ed124
--- /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()