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

Side by Side Diff: tools/ld_bfd/ld

Issue 7841008: Update chrome/nacl.gypi to fix chromeos build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gyp portability issues, chromeos build 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
« chrome/nacl.gypi ('K') | « chrome/nacl/nacl_fork_delegate_linux.cc ('k') | 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, removing 8 A simple script to invoke the bfd loader instead of gold, removing
9 threading command line options that the bfd loader doesn't support. 9 threading command line options that the bfd loader doesn't support.
10 Because this script is invoked from gcc via the -B flag, it needs 10 Because this script is invoked from gcc via the -B flag, it needs
11 to be in a file named "ld". 11 to be in a file named "ld".
12 """ 12 """
13 13
14 import os 14 import os
15 import subprocess 15 import subprocess
16 import sys 16 import sys
17 17
18 # TODO(bradchen): Delete this script when Gold supports -Ttext properly. 18 # TODO(bradchen): Delete this script when Gold supports linker scripts properly.
19 # It should be fixed by this patch: 19
20 # http://sourceware.org/ml/binutils/2011-07/msg00206.html 20 def PathTo(fname):
21 if fname[0] == os.pathsep:
22 return fname
23 for p in os.environ["PATH"].split(os.pathsep):
24 fpath = os.path.join(p, fname)
25 if os.path.exists(fpath):
26 return fpath
27 return fname
28
29 def FindLDBFD():
30 cxx = os.getenv("CXX")
31 if not cxx:
32 cxx = "gcc"
33 popen = subprocess.Popen(cxx + " -print-prog-name=ld",
34 shell=True,
35 stdout=subprocess.PIPE,
36 stdin=subprocess.PIPE)
37 (ld, error) = popen.communicate()
38 if popen.wait() != 0:
39 print "Could not find ld:" + error
40 return "ld"
41 ld = ld.strip()
42 ld_bfd = PathTo(ld + ".bfd")
43 if os.path.exists(ld_bfd) and os.access(ld_bfd, os.X_OK):
44 return ld_bfd
45 return ld
46
21 def main(): 47 def main():
22 LD_BFD = "/usr/bin/ld.bfd" 48 args = [FindLDBFD()] + sys.argv[1:]
23 if not (os.path.exists(LD_BFD) and os.access(LD_BFD, os.X_OK)): 49 print("tools/ld_bfd/ld: exec ", args)
24 # Can't find the BFD loader, so invoke the unmodified argv
25 args = sys.argv
26 args[0] = "ld"
27 print "ld_bfd/ld: using ld"
28 sys.exit(subprocess.call(args))
29 # found the BFD loader, so use it
30 args = list()
31 args.append("/usr/bin/ld.bfd")
32 for arg in sys.argv[1:]:
33 if arg == "-Wl,--threads" or arg == "--threads":
34 continue
35 if arg == "-Wl,--thread-count=4" or arg == "--thread-count=4":
36 continue
37 if arg == "--icf=none":
38 continue
39 args.append(arg)
40 print("ld_bfd/ld: exec ", args)
41 sys.exit(subprocess.call(args)) 50 sys.exit(subprocess.call(args))
42 51
43 if __name__ == "__main__": 52 if __name__ == "__main__":
44 main() 53 main()
OLDNEW
« chrome/nacl.gypi ('K') | « chrome/nacl/nacl_fork_delegate_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698