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

Side by Side Diff: tools/ld_bfd/ld

Issue 7845021: Fixing a nit: "gcc" => "g++" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Wrapper for invoking the BFD loader 6 """Wrapper for invoking the BFD loader
7 7
8 A simple script to invoke the bfd loader instead of gold. 8 A simple script to invoke the bfd loader instead of gold.
9 This script is in a filename "ld" so it can be invoked from gcc 9 This script is in a filename "ld" so it can be invoked from gcc
10 via the -B flag. 10 via the -B flag.
11 """ 11 """
12 # TODO(bradchen): Delete this script when Gold supports linker scripts properly. 12 # TODO(bradchen): Delete this script when Gold supports linker scripts properly.
13 import os 13 import os
14 import subprocess 14 import subprocess
15 import sys 15 import sys
16 16
17 def PathTo(fname): 17 def PathTo(fname):
18 if fname[0] == os.pathsep: 18 if fname[0] == os.pathsep:
19 return fname 19 return fname
20 for p in os.environ["PATH"].split(os.pathsep): 20 for p in os.environ["PATH"].split(os.pathsep):
21 fpath = os.path.join(p, fname) 21 fpath = os.path.join(p, fname)
22 if os.path.exists(fpath): 22 if os.path.exists(fpath):
23 return fpath 23 return fpath
24 return fname 24 return fname
25 25
26 def FindLDBFD(): 26 def FindLDBFD():
27 cxx = os.getenv("CXX") 27 cxx = os.getenv("CXX")
28 if not cxx: 28 if not cxx:
29 cxx = "gcc" 29 cxx = "g++"
30 popen = subprocess.Popen(cxx + " -print-prog-name=ld", 30 popen = subprocess.Popen(cxx + " -print-prog-name=ld",
31 shell=True, 31 shell=True,
32 stdout=subprocess.PIPE, 32 stdout=subprocess.PIPE,
33 stdin=subprocess.PIPE) 33 stdin=subprocess.PIPE)
34 (ld, error) = popen.communicate() 34 (ld, error) = popen.communicate()
35 if popen.wait() != 0: 35 if popen.wait() != 0:
36 print "Could not find ld:" + error 36 print "Could not find ld:" + error
37 return "ld" 37 return "ld"
38 ld = ld.strip() 38 ld = ld.strip()
39 ld_bfd = PathTo(ld + ".bfd") 39 ld_bfd = PathTo(ld + ".bfd")
40 if os.access(ld_bfd, os.X_OK): 40 if os.access(ld_bfd, os.X_OK):
41 return ld_bfd 41 return ld_bfd
42 return ld 42 return ld
43 43
44 def main(): 44 def main():
45 args = [FindLDBFD()] + sys.argv[1:] 45 args = [FindLDBFD()] + sys.argv[1:]
46 print("tools/ld_bfd/ld: exec " + ' '.join(args)) 46 print("tools/ld_bfd/ld: exec " + ' '.join(args))
47 sys.exit(subprocess.call(args)) 47 sys.exit(subprocess.call(args))
48 48
49 if __name__ == "__main__": 49 if __name__ == "__main__":
50 main() 50 main()
OLDNEW
« 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