Commit 1ece70e8 by Sean Klein

Eliminate all uses of 'le32-nacl-objcopy'.

Additionally, refactor "GetObjdumpCmd" and "GetObjcopyCmd". BUG=https://bugs.chromium.org/p/nativeclient/issues/detail?id=4361 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1777103002 .
parent 843142fe
...@@ -6,8 +6,7 @@ import shutil ...@@ -6,8 +6,7 @@ import shutil
import tempfile import tempfile
import targets import targets
from utils import shellcmd from utils import FindBaseNaCl, GetObjcopyCmd, shellcmd
from utils import FindBaseNaCl
def Translate(ll_files, extra_args, obj, verbose): def Translate(ll_files, extra_args, obj, verbose):
...@@ -26,7 +25,7 @@ def Translate(ll_files, extra_args, obj, verbose): ...@@ -26,7 +25,7 @@ def Translate(ll_files, extra_args, obj, verbose):
'-arm-enable-dwarf-eh=1', '-arm-enable-dwarf-eh=1',
'-o', obj '-o', obj
] + extra_args, echo=verbose) ] + extra_args, echo=verbose)
shellcmd(['le32-nacl-objcopy', shellcmd([GetObjcopyCmd(),
'--strip-symbol=nacl_tp_tdb_offset', '--strip-symbol=nacl_tp_tdb_offset',
'--strip-symbol=nacl_tp_tls_offset', '--strip-symbol=nacl_tp_tls_offset',
obj obj
...@@ -82,7 +81,7 @@ def MakeRuntimesForTarget(target_info, ll_files, ...@@ -82,7 +81,7 @@ def MakeRuntimesForTarget(target_info, ll_files,
['-m {ld_emu}'.format(ld_emu=target_info.ld_emu)], ['-m {ld_emu}'.format(ld_emu=target_info.ld_emu)],
OutFile('{rtdir}/szrt_native_{target}.o'), OutFile('{rtdir}/szrt_native_{target}.o'),
verbose) verbose)
shellcmd(['le32-nacl-objcopy', shellcmd([GetObjcopyCmd(),
'--strip-symbol=NATIVE', '--strip-symbol=NATIVE',
OutFile('{rtdir}/szrt_native_{target}.o')]) OutFile('{rtdir}/szrt_native_{target}.o')])
...@@ -111,7 +110,7 @@ def MakeRuntimesForTarget(target_info, ll_files, ...@@ -111,7 +110,7 @@ def MakeRuntimesForTarget(target_info, ll_files,
['-m {ld_emu}'.format(ld_emu=target_info.sb_emu)], ['-m {ld_emu}'.format(ld_emu=target_info.sb_emu)],
OutFile('{rtdir}/szrt_sb_{target}.o'), OutFile('{rtdir}/szrt_sb_{target}.o'),
verbose) verbose)
shellcmd(['le32-nacl-objcopy', shellcmd([GetObjcopyCmd(),
'--strip-symbol=NACL', '--strip-symbol=NACL',
OutFile('{rtdir}/szrt_sb_{target}.o')]) OutFile('{rtdir}/szrt_sb_{target}.o')])
...@@ -139,7 +138,7 @@ def MakeRuntimesForTarget(target_info, ll_files, ...@@ -139,7 +138,7 @@ def MakeRuntimesForTarget(target_info, ll_files,
['-m {ld_emu}'.format(ld_emu=target_info.ld_emu)], ['-m {ld_emu}'.format(ld_emu=target_info.ld_emu)],
OutFile('{rtdir}/szrt_nonsfi_{target}.o'), OutFile('{rtdir}/szrt_nonsfi_{target}.o'),
verbose) verbose)
shellcmd(['le32-nacl-objcopy', shellcmd([GetObjcopyCmd(),
'--strip-symbol=NONSFI', '--strip-symbol=NONSFI',
OutFile('{rtdir}/szrt_nonsfi_{target}.o')]) OutFile('{rtdir}/szrt_nonsfi_{target}.o')])
......
...@@ -8,7 +8,7 @@ import tempfile ...@@ -8,7 +8,7 @@ import tempfile
import targets import targets
from szbuild import LinkNonsfi from szbuild import LinkNonsfi
from utils import shellcmd, FindBaseNaCl, get_sfi_string from utils import FindBaseNaCl, GetObjcopyCmd, get_sfi_string, shellcmd
def main(): def main():
"""Builds a cross-test binary for comparing Subzero and llc translation. """Builds a cross-test binary for comparing Subzero and llc translation.
...@@ -166,7 +166,7 @@ def main(): ...@@ -166,7 +166,7 @@ def main():
# currently the only situation where multiple translated files are # currently the only situation where multiple translated files are
# linked into the executable, but when PNaCl supports shared nexe # linked into the executable, but when PNaCl supports shared nexe
# libraries, this would need to change. # libraries, this would need to change.
shellcmd(['{bin}/le32-nacl-objcopy'.format(bin=bindir), shellcmd(['{bin}/{objcopy}'.format(bin=bindir, objcopy=GetObjcopyCmd()),
'--weaken-symbol=__Sz_block_profile_info', '--weaken-symbol=__Sz_block_profile_info',
'--strip-symbol=nacl_tp_tdb_offset', '--strip-symbol=nacl_tp_tdb_offset',
'--strip-symbol=nacl_tp_tls_offset', '--strip-symbol=nacl_tp_tls_offset',
...@@ -180,7 +180,7 @@ def main(): ...@@ -180,7 +180,7 @@ def main():
'-bitcode-format=llvm', '-bitcode-format=llvm',
'-o=' + obj_llc, '-o=' + obj_llc,
bitcode] + llc_flags) bitcode] + llc_flags)
shellcmd(['{bin}/le32-nacl-objcopy'.format(bin=bindir), shellcmd(['{bin}/{objcopy}'.format(bin=bindir, objcopy=GetObjcopyCmd()),
'--weaken-symbol=__Sz_block_profile_info', '--weaken-symbol=__Sz_block_profile_info',
'--strip-symbol=nacl_tp_tdb_offset', '--strip-symbol=nacl_tp_tdb_offset',
'--strip-symbol=nacl_tp_tls_offset', '--strip-symbol=nacl_tp_tls_offset',
...@@ -252,7 +252,7 @@ def main(): ...@@ -252,7 +252,7 @@ def main():
'-o', obj_llc, '-o', obj_llc,
bitcode] + llc_flags) bitcode] + llc_flags)
if not args.sandbox and not args.nonsfi: if not args.sandbox and not args.nonsfi:
shellcmd(['{bin}/le32-nacl-objcopy'.format(bin=bindir), shellcmd(['{bin}/{objcopy}'.format(bin=bindir, objcopy=GetObjcopyCmd()),
'--redefine-sym', '_start=_user_start', '--redefine-sym', '_start=_user_start',
obj_llc obj_llc
]) ])
......
...@@ -8,7 +8,7 @@ import subprocess ...@@ -8,7 +8,7 @@ import subprocess
import sys import sys
import tempfile import tempfile
from utils import FindBaseNaCl, shellcmd from utils import FindBaseNaCl, GetObjdumpCmd, shellcmd
def TargetAssemblerFlags(target, sandboxed): def TargetAssemblerFlags(target, sandboxed):
...@@ -31,10 +31,6 @@ def TargetDisassemblerFlags(target): ...@@ -31,10 +31,6 @@ def TargetDisassemblerFlags(target):
'mips32':[] } 'mips32':[] }
return flags[target] return flags[target]
def GetObjdumpCmd():
"""Return a suitable objdump command."""
return 'arm-nacl-objdump'
def main(): def main():
"""Run the pnacl-sz compiler on an llvm file. """Run the pnacl-sz compiler on an llvm file.
......
...@@ -6,7 +6,7 @@ import pipes ...@@ -6,7 +6,7 @@ import pipes
import re import re
import sys import sys
from utils import shellcmd, FindBaseNaCl, get_sfi_string from utils import FindBaseNaCl, GetObjcopyCmd, get_sfi_string, shellcmd
def NewerThanOrNotThere(old_path, new_path): def NewerThanOrNotThere(old_path, new_path):
"""Returns whether old_path is newer than new_path. """Returns whether old_path is newer than new_path.
...@@ -293,7 +293,8 @@ def ProcessPexe(args, pexe, exe): ...@@ -293,7 +293,8 @@ def ProcessPexe(args, pexe, exe):
).format(root=nacl_root) ).format(root=nacl_root)
llcbin = '{base}/pnacl-llc'.format(base=path_addition) llcbin = '{base}/pnacl-llc'.format(base=path_addition)
gold = '{base}/le32-nacl-ld.gold'.format(base=path_addition) gold = '{base}/le32-nacl-ld.gold'.format(base=path_addition)
objcopy = '{base}/le32-nacl-objcopy'.format(base=path_addition) objcopy = '{base}/{objcopy}'.format(base=path_addition,
objcopy=GetObjcopyCmd())
opt_level = args.optlevel opt_level = args.optlevel
opt_level_map = { 'm1':'0', '-1':'0', '0':'0', '1':'1', '2':'2' } opt_level_map = { 'm1':'0', '-1':'0', '0':'0', '1':'1', '2':'2' }
hybrid = args.include or args.exclude hybrid = args.include or args.exclude
......
...@@ -2,6 +2,14 @@ import os ...@@ -2,6 +2,14 @@ import os
import subprocess import subprocess
import sys import sys
def GetObjcopyCmd():
"""Return a suitable objcopy command."""
return 'arm-nacl-objcopy'
def GetObjdumpCmd():
"""Return a suitable objdump command."""
return 'arm-nacl-objdump'
def shellcmd(command, echo=True): def shellcmd(command, echo=True):
if not isinstance(command, str): if not isinstance(command, str):
command = ' '.join(command) command = ' '.join(command)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment