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

Issue 140653005: Adds tls_edit utility which patches irt_core.nexe's TLS usage. (Closed)

Created:
6 years, 11 months ago by David Yen
Modified:
6 years, 10 months ago
CC:
native-client-reviews_googlegroups.com
Visibility:
Public.

Description

Adds tls_edit utility which patches irt_core.nexe's TLS usage. Currently we compile in different instructions to manage the 2 TLS usages between an untrusted nacl app and the IRT. This adds a new utility (tls_edit) which goes through nexe's and edits the instructions which use the TLS to point to the correct location. This way we don't have to do anything special when compiling the IRT. The ComponentProgram function has also been separated so creating of the ComponentProgram is done separately from aliasing programs to the "COMPONENT_PROGRAM_GROUPS" aliases. This way we can add in extra steps between the building of the Component Program and adding the program to the correct component program aliases. This is now necessary because the IRT core is now built and uses tls_edit as an intermediate step before the nexe is complete. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3127 TEST= trybots R=bradnelson@google.com, mcgrathr@chromium.org, mseaborn@chromium.org Committed: https://src.chromium.org/viewvc/native_client?view=rev&revision=12698

Patch Set 1 #

Patch Set 2 : Added DEPS rule for required headers needed for tls_edit #

Patch Set 3 : Added newline to the end of tls_edit.c #

Patch Set 4 : Added tls_edit patching to irt_compatibility_test and also removed unnecessary header in tls_edit w… #

Patch Set 5 : Refactored tls_edit so it can work in windows #

Patch Set 6 : Moved tls_edit so it is staged in its own environment rather than the IRT environment #

Patch Set 7 : Fixed problem where building debug will fail #

Patch Set 8 : Fixed an issue where tls_edit was not working correctly on windows #

Patch Set 9 : Make sure we are appending the build environment even when they are only building nacl #

Patch Set 10 : Fixed a syntax error in SConstruct #

Patch Set 11 : Fixed a warning in tls_edit that only happened on windows #

Patch Set 12 : Made irt_core use the staged version of tls_edit like everything else instead of the built version … #

Patch Set 13 : Added program suffix to TLSEdit environment accessor function #

Patch Set 14 : Rebased branch onto master #

Patch Set 15 : tls_edit now retains file permissions #

Patch Set 16 : Reverted tls_edit so it no longer copies file attributes, spec2k test checks if nexe's exist instea… #

Patch Set 17 : gyp builds with host toolsets should not inherit target flags for arm and mips #

Total comments: 12

Patch Set 18 : Fixed style issues from code review #

Patch Set 19 : Merged tls_edit 32/64 bit code that could be merged #

Patch Set 20 : Restored aeabi_read_tp.S so chromium branch will not break #

Patch Set 21 : This patch compiles in the tls offsets again instead of relying on tls_edit #

Total comments: 15

Patch Set 22 : Fixed suggested style issues #

Patch Set 23 : Fixed wrong variable usage in tls_edit #

Total comments: 2

Patch Set 24 : Fixed spacing issues in build/common.gypi #

Total comments: 10

Patch Set 25 : irt_core intermediate files are now built inside of intermediate directories #

Patch Set 26 : Removed unused files and defines from tls_edit #

Patch Set 27 : Fixed arm gyp compile for irt_core #

Patch Set 28 : Applied suggestions from Mark #

Total comments: 1

Patch Set 29 : Moved tls_edit from untrusted/irt to tools/tls_edit #

Total comments: 10

Patch Set 30 : Fixed MIP->MIPS typo in tls_edit #

Patch Set 31 : Fixed some typos and style issues #

Patch Set 32 : Rebased to master #

Unified diffs Side-by-side diffs Delta from patch set Stats (+624 lines, -79 lines) Patch
M SConstruct View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 6 chunks +44 lines, -10 lines 0 comments Download
M build/common.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +67 lines, -59 lines 0 comments Download
M site_scons/site_tools/component_builders.py View 3 chunks +6 lines, -2 lines 0 comments Download
M src/shared/gio/gio.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -0 lines 0 comments Download
M src/shared/platform/platform.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -0 lines 0 comments Download
A + src/tools/tls_edit/DEPS View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 0 chunks +-1 lines, --1 lines 0 comments Download
A src/tools/tls_edit/build.scons View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +15 lines, -0 lines 0 comments Download
A src/tools/tls_edit/tls_edit.c View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +374 lines, -0 lines 0 comments Download
A src/tools/tls_edit/tls_edit.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +23 lines, -0 lines 0 comments Download
M src/trusted/validator_ragel/rdfa_validator.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -0 lines 0 comments Download
M src/untrusted/irt/irt.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 chunks +65 lines, -2 lines 0 comments Download
M src/untrusted/irt/nacl.scons View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 chunk +11 lines, -2 lines 0 comments Download
M tests/irt_compatibility/nacl.scons View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +6 lines, -2 lines 0 comments Download
M tests/irt_private_pthread/nacl.scons View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +7 lines, -2 lines 0 comments Download
M tests/spec2k/run_all.sh View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 17 (0 generated)
David Yen
Finally got tls_edit compiling and working on all platforms in both scons and gyp.
6 years, 11 months ago (2014-01-20 20:31:01 UTC) #1
Roland McGrath
https://codereview.chromium.org/140653005/diff/2570001/SConstruct File SConstruct (right): https://codereview.chromium.org/140653005/diff/2570001/SConstruct#newcode3612 SConstruct:3612: # KEEP THIS SORTED PLEASE This should have a ...
6 years, 11 months ago (2014-01-24 18:50:48 UTC) #2
David Yen
On 2014/01/24 18:50:48, Roland McGrath wrote: > https://codereview.chromium.org/140653005/diff/2570001/SConstruct#newcode3612 > SConstruct:3612: # KEEP THIS SORTED PLEASE ...
6 years, 11 months ago (2014-01-24 23:22:34 UTC) #3
Roland McGrath
Just a few nits left. https://codereview.chromium.org/140653005/diff/3340001/src/shared/gio/gio.gyp File src/shared/gio/gio.gyp (right): https://codereview.chromium.org/140653005/diff/3340001/src/shared/gio/gio.gyp#newcode25 src/shared/gio/gio.gyp:25: 'toolsets': ['host', 'target'], Add ...
6 years, 10 months ago (2014-01-31 21:02:01 UTC) #4
bradn
One mistake otherwise LGTM https://codereview.chromium.org/140653005/diff/3870001/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/140653005/diff/3870001/build/common.gypi#newcode304 build/common.gypi:304: [ 'target_arch=="arm"', { The extra ...
6 years, 10 months ago (2014-02-03 20:49:35 UTC) #5
David Yen
I fixed up the whitespace issues Brad pointed out, I also added Mark to the ...
6 years, 10 months ago (2014-02-03 21:14:38 UTC) #6
Roland McGrath
lgtm https://codereview.chromium.org/140653005/diff/200011/src/untrusted/irt/tls_edit.c File src/untrusted/irt/tls_edit.c (right): https://codereview.chromium.org/140653005/diff/200011/src/untrusted/irt/tls_edit.c#newcode26 src/untrusted/irt/tls_edit.c:26: # define O_BINARY 0 This is unused since ...
6 years, 10 months ago (2014-02-03 21:25:13 UTC) #7
Mark Seaborn
https://codereview.chromium.org/140653005/diff/200011/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/140653005/diff/200011/build/common.gypi#newcode359 build/common.gypi:359: 'conditions': [ The indentation here doesn't match that of ...
6 years, 10 months ago (2014-02-03 22:31:47 UTC) #8
David Yen
All of Mark's suggestions make sense to me, I applied them in the last patch. ...
6 years, 10 months ago (2014-02-03 23:07:10 UTC) #9
Roland McGrath
On 2014/02/03 23:07:10, David Yen wrote: > All of Mark's suggestions make sense to me, ...
6 years, 10 months ago (2014-02-03 23:11:07 UTC) #10
David Yen
I moved tls_edit from src/untrusted/irt to src/tools/tls_edit (And removed irt/DEPS in the process). I figured ...
6 years, 10 months ago (2014-02-03 23:52:10 UTC) #11
Roland McGrath
https://codereview.chromium.org/140653005/diff/4490004/src/untrusted/irt/tls_edit.c File src/untrusted/irt/tls_edit.c (right): https://codereview.chromium.org/140653005/diff/4490004/src/untrusted/irt/tls_edit.c#newcode187 src/untrusted/irt/tls_edit.c:187: printf("%s: MIP ELF detected, no instructions changed\n", typo: MIPS
6 years, 10 months ago (2014-02-04 17:49:31 UTC) #12
Mark Seaborn
LGTM https://codereview.chromium.org/140653005/diff/4860001/SConstruct File SConstruct (right): https://codereview.chromium.org/140653005/diff/4860001/SConstruct#newcode3728 SConstruct:3728: # When building nacl, any intermediate build tool ...
6 years, 10 months ago (2014-02-04 18:09:10 UTC) #13
David Yen
On 2014/02/04 18:09:10, Mark Seaborn wrote: I've fixed all the issues except for the one ...
6 years, 10 months ago (2014-02-04 18:28:07 UTC) #14
David Yen
Committed patchset #32 manually as r12698 (presubmit successful).
6 years, 10 months ago (2014-02-04 19:29:47 UTC) #15
Mark Seaborn
After this change, I get the following when running the scons build on Windows: link ...
6 years, 10 months ago (2014-02-05 19:22:27 UTC) #16
David Yen
6 years, 10 months ago (2014-02-05 23:50:26 UTC) #17
Message was sent while issue was closed.
On 2014/02/05 19:22:27, Mark Seaborn wrote:
> After this change, I get the following when running the scons build on
Windows:
> 
> link /nologo /safeseh /DEBUG -manifest
> /OUT:scons-out\nacl_irt-x86-64\obj\src\tools\tls_edit\tls_edit.exe
> /LIBPATH:scons-out\dbg-win-x86-32\lib rdfa_validator.lib platform.lib gio.lib
> ws2_32.lib advapi32.lib
> /PDB:scons-out\nacl_irt-x86-64\obj\src\tools\tls_edit\tls_edit.pdb /DEBUG
> scons-out\nacl_irt-x86-64\obj\src\tools\tls_edit\tls_edit.obj
> LINK : fatal error LNK1246: '/SAFESEH' not compatible with 'x64' target
machine;
> link without '/SAFESEH'
> 
> In my setup, I run scons with PATH set to point to the 64-bit version of 'cl'
> (from /cygdrive/c/Program Files (x86)/Microsoft Visual Studio
> 10.0/VC/Bin/amd64).  I expect that is the cause.

I looked into this a bit with Brad, it looks like it has something to do with
not figuring out the right target platform for your build environment. Is this
on your windows machine at work? Lets take a look on your machine when you're
back.

Powered by Google App Engine
This is Rietveld 408576698