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

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: use --section-start .text= instead of -Ttext= 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..59489a40fa3166a9338f50098eb0c11a77c3733b 100755
--- a/SConstruct
+++ b/SConstruct
@@ -2728,13 +2728,32 @@ 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'):
+ args = ','.join(['-Wn'] + args)
Roland McGrath 2013/07/16 18:22:37 Comment about what -Wn means, since it's not a sta
+ 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