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

Unified Diff: SConstruct

Issue 19288005: Factor linker flag which sets text segment into a function in SConstruct (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: comment on -Wn Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/untrusted/irt/nacl.scons » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: SConstruct
diff --git a/SConstruct b/SConstruct
index a2958239a73ce89667becc8dd59c85fd64662f68..9e8205249dc7e811c2db00e7474ed9299d85e764 100755
--- a/SConstruct
+++ b/SConstruct
@@ -2728,13 +2728,34 @@ than via the compiler driver."""
# test so don't use build id and move .rodata to the desired position.
args = ['--section-start', '.rodata=' + value]
if via_compiler:
- args = ','.join(['-Wl'] + args)
+ if env.Bit('bitcode'):
+ # The -Wn flag passes arguments to PNaCl's native linker (as opposed
+ # to the bitcode linker, which gets the -Wl arguments)
+ args = ','.join(['-Wn'] + args)
+ else:
+ args = ','.join(['-Wl'] + args)
else:
args = ' '.join(args)
return args
nacl_env.AddMethod(RodataSwitch)
+def TextSwitch(env, value):
+ """ Return a string of arguments to place the text segment at |value|.
+Assume the string is going to the compiler driver, rather than directly
+to the linker. """
+ # The gold linker does not support -Ttext-segment, but -Ttext does the
+ # same thing that -Ttext-segment does in the bfd linker. However,
+ # -Ttext seems to be broken in gold currently (see bug
+ # https://code.google.com/p/nativeclient/issues/detail?id=3573 )
+ # Using --section-start .text= as a workaround works because PNaCl only uses
+ # one text section (no .init etc)
+ if env.Bit('bitcode'):
+ return '-Wn,--section-start,.text=' + value
+ else:
+ return '-Wl,-Ttext-segment=' + value
+
+nacl_env.AddMethod(TextSwitch)
def AllowNonStableBitcode(env):
""" This modifies the environment to allow features that aren't part
« no previous file with comments | « no previous file | src/untrusted/irt/nacl.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698