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

Issue 1387963002: Make sure that all globals are internal, except for "start" functions. (Closed)

Created:
5 years, 2 months ago by Karl
Modified:
5 years, 2 months ago
Reviewers:
Jim Stichnoth, John
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Make sure that all globals are internal, except for "start" functions. The existing code, when run on a fuzzed example, generates a runtime assertion. The reason for this is that the input defines "memmove" as an external global. However, the code generator can generate calls to "memmove" which assumes it is internal (see PNaCl ABI). As a result, the assertion that checks that global names are unique (for memmove) fails. This code fixes the problem by checking that global names are internal, unless they are one of the "start" functions, or the function is an intrinsic. To allow for non-PNaCl ABI input, a flag was added to allow functions to be external. However, in such cases the external can't be one of Subzero's runtime helper functions. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4330 R=jpp@chromium.org, stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=57d31ac73a35263d42357259329fa7d3e565731b

Patch Set 1 #

Patch Set 2 : Make intrinsics external and update tests. #

Patch Set 3 : Ready for review. #

Total comments: 3

Patch Set 4 : Fix nit. #

Total comments: 2

Patch Set 5 : Merge in new tests from master #

Total comments: 4

Patch Set 6 : Fix IceConverter to check linkage. #

Patch Set 7 : Revert formatting on IceParseInstsTest.cpp #

Patch Set 8 : Fix new tests. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1577 lines, -1299 lines) Patch
M src/IceClFlags.h View 1 2 3 2 chunks +8 lines, -0 lines 0 comments Download
M src/IceClFlags.cpp View 1 2 3 4 5 3 chunks +9 lines, -0 lines 0 comments Download
M src/IceConverter.cpp View 1 2 3 4 5 2 chunks +14 lines, -0 lines 0 comments Download
M src/IceELFSection.cpp View 1 chunk +6 lines, -1 line 0 comments Download
M src/IceGlobalInits.h View 1 2 3 4 5 4 chunks +43 lines, -0 lines 0 comments Download
M src/PNaClTranslator.cpp View 1 2 3 4 5 2 chunks +17 lines, -0 lines 0 comments Download
M tests_lit/assembler/x86/immediate_encodings.ll View 1 2 3 4 9 chunks +9 lines, -9 lines 0 comments Download
M tests_lit/assembler/x86/jump_encodings.ll View 1 2 6 chunks +7 lines, -6 lines 0 comments Download
M tests_lit/assembler/x86/opcode_register_encodings.ll View 1 2 3 4 5 6 7 14 chunks +28 lines, -14 lines 0 comments Download
M tests_lit/assembler/x86/sandboxing.ll View 1 13 chunks +13 lines, -12 lines 0 comments Download
M tests_lit/llvm2ice_tests/64bit.pnacl.ll View 1 2 chunks +4 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/8bit.pnacl.ll View 1 1 chunk +4 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/addr-opt-multi-def-var.ll View 1 1 chunk +2 lines, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/address-mode-opt.ll View 1 12 chunks +14 lines, -14 lines 0 comments Download
M tests_lit/llvm2ice_tests/align-spill-locations.ll View 1 6 chunks +9 lines, -7 lines 0 comments Download
M tests_lit/llvm2ice_tests/alloc.ll View 1 12 chunks +15 lines, -13 lines 0 comments Download
M tests_lit/llvm2ice_tests/arith.ll View 1 16 chunks +16 lines, -16 lines 0 comments Download
M tests_lit/llvm2ice_tests/arith-opt.ll View 1 11 chunks +23 lines, -22 lines 0 comments Download
M tests_lit/llvm2ice_tests/asm-verbose.ll View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/bool-folding.ll View 1 2 11 chunks +15 lines, -12 lines 0 comments Download
M tests_lit/llvm2ice_tests/bool-opt.ll View 1 1 chunk +3 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/branch-opt.ll View 1 6 chunks +8 lines, -6 lines 0 comments Download
M tests_lit/llvm2ice_tests/branch-simple.ll View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/cmp-opt.ll View 1 1 chunk +3 lines, -3 lines 0 comments Download
M tests_lit/llvm2ice_tests/commutativity.ll View 1 2 3 4 5 6 7 8 chunks +8 lines, -8 lines 0 comments Download
M tests_lit/llvm2ice_tests/cond-br-same-target.ll View 2 chunks +2 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/contract.ll View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/convert.ll View 1 8 chunks +8 lines, -8 lines 0 comments Download
M tests_lit/llvm2ice_tests/div_legalization.ll View 1 6 chunks +6 lines, -6 lines 0 comments Download
M tests_lit/llvm2ice_tests/ebp_args.ll View 1 1 chunk +3 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/elf_container.ll View 1 2 chunks +3 lines, -0 lines 0 comments Download
M tests_lit/llvm2ice_tests/fp.arm.call.ll View 1 4 chunks +5 lines, -3 lines 0 comments Download
M tests_lit/llvm2ice_tests/fp.call_ret.ll View 1 1 chunk +2 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/fp.cmp.ll View 1 1 chunk +6 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/fp_const_pool.ll View 1 2 chunks +4 lines, -4 lines 0 comments Download
M tests_lit/llvm2ice_tests/fpcall.ll View 1 1 chunk +4 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/fpconst.pnacl.ll View 1 1 chunk +6 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/function_aligned.ll View 1 2 chunks +2 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/globalinit.pnacl.ll View 1 2 chunks +8 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/globalrelocs.ll View 1 chunk +2 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/ias-multi-reloc.ll View 1 1 chunk +1 line, -0 lines 0 comments Download
M tests_lit/llvm2ice_tests/int-arg.ll View 1 20 chunks +20 lines, -19 lines 0 comments Download
M tests_lit/llvm2ice_tests/invalid.test View 1 1 chunk +1 line, -0 lines 0 comments Download
M tests_lit/llvm2ice_tests/large_stack_offs.ll View 1 1 chunk +1 line, -0 lines 0 comments Download
M tests_lit/llvm2ice_tests/load.ll View 1 4 chunks +4 lines, -4 lines 0 comments Download
M tests_lit/llvm2ice_tests/loop-nest-depth.ll View 1 2 8 chunks +9 lines, -8 lines 0 comments Download
M tests_lit/llvm2ice_tests/nacl-atomic-cmpxchg-optimization.ll View 1 2 6 chunks +11 lines, -7 lines 0 comments Download
M tests_lit/llvm2ice_tests/nacl-atomic-errors.ll View 1 2 21 chunks +27 lines, -22 lines 0 comments Download
M tests_lit/llvm2ice_tests/nacl-atomic-fence-all.ll View 1 5 chunks +5 lines, -5 lines 0 comments Download
M tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll View 1 2 3 4 68 chunks +82 lines, -70 lines 0 comments Download
M tests_lit/llvm2ice_tests/nacl-mem-intrinsics.ll View 1 2 27 chunks +38 lines, -27 lines 0 comments Download
M tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll View 1 34 chunks +36 lines, -31 lines 0 comments Download
M tests_lit/llvm2ice_tests/nop-insertion.ll View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/phi_invalid.test View 1 1 chunk +1 line, -0 lines 0 comments Download
M tests_lit/llvm2ice_tests/prune_unreachable.ll View 1 1 chunk +5 lines, -3 lines 0 comments Download
M tests_lit/llvm2ice_tests/randomize-pool-immediate-basic.ll View 1 4 chunks +4 lines, -4 lines 0 comments Download
M tests_lit/llvm2ice_tests/randomize-regalloc.ll View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/regalloc_evict_non_overlap.ll View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/reorder-basic-blocks.ll View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/reorder-functions.ll View 1 1 chunk +6 lines, -6 lines 0 comments Download
M tests_lit/llvm2ice_tests/reorder-pooled-constants.ll View 1 1 chunk +2 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/return_immediates.ll View 1 25 chunks +26 lines, -25 lines 0 comments Download
M tests_lit/llvm2ice_tests/returns_twice_no_coalesce.ll View 1 3 chunks +4 lines, -3 lines 0 comments Download
M tests_lit/llvm2ice_tests/rng.ll View 1 6 chunks +6 lines, -6 lines 0 comments Download
M tests_lit/llvm2ice_tests/sdiv.ll View 1 6 chunks +6 lines, -6 lines 0 comments Download
M tests_lit/llvm2ice_tests/select-opt.ll View 1 3 chunks +7 lines, -5 lines 0 comments Download
M tests_lit/llvm2ice_tests/shift.ll View 1 20 chunks +20 lines, -20 lines 0 comments Download
M tests_lit/llvm2ice_tests/simple-loop.ll View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/square.ll View 1 2 3 4 9 chunks +9 lines, -9 lines 0 comments Download
M tests_lit/llvm2ice_tests/store.ll View 1 4 chunks +4 lines, -4 lines 0 comments Download
M tests_lit/llvm2ice_tests/switch-opt.ll View 1 4 chunks +4 lines, -4 lines 0 comments Download
M tests_lit/llvm2ice_tests/undef.ll View 1 2 27 chunks +45 lines, -36 lines 0 comments Download
M tests_lit/llvm2ice_tests/vector-align.ll View 1 7 chunks +7 lines, -7 lines 0 comments Download
M tests_lit/llvm2ice_tests/vector-arg.ll View 1 2 13 chunks +62 lines, -19 lines 0 comments Download
M tests_lit/llvm2ice_tests/vector-arith.ll View 1 44 chunks +44 lines, -44 lines 0 comments Download
M tests_lit/llvm2ice_tests/vector-bitcast.ll View 1 20 chunks +20 lines, -20 lines 0 comments Download
M tests_lit/llvm2ice_tests/vector-cast.ll View 1 13 chunks +13 lines, -13 lines 0 comments Download
M tests_lit/llvm2ice_tests/vector-fcmp.ll View 1 17 chunks +17 lines, -17 lines 0 comments Download
M tests_lit/llvm2ice_tests/vector-icmp.ll View 1 54 chunks +55 lines, -55 lines 0 comments Download
M tests_lit/llvm2ice_tests/vector-ops.ll View 1 2 17 chunks +19 lines, -17 lines 0 comments Download
M tests_lit/llvm2ice_tests/vector-select.ll View 1 2 7 chunks +14 lines, -7 lines 0 comments Download
M tests_lit/parse_errs/bad-bb-size.test View 1 1 chunk +2 lines, -1 line 0 comments Download
M tests_lit/parse_errs/bad-intrinsic-arg.test View 1 1 chunk +2 lines, -1 line 0 comments Download
M tests_lit/parse_errs/bad-switch-case.test View 1 1 chunk +2 lines, -1 line 0 comments Download
M tests_lit/parse_errs/bad-var-fwdref.test View 1 1 chunk +2 lines, -1 line 0 comments Download
M tests_lit/parse_errs/call-fcn-bad-param-type.ll View 1 1 chunk +2 lines, -1 line 0 comments Download
M tests_lit/parse_errs/call-fcn-bad-return-type.ll View 1 1 chunk +2 lines, -1 line 0 comments Download
M tests_lit/parse_errs/call-indirect-i8.ll View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/parse_errs/fcn-value-index-isnt-defined.test View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/parse_errs/indirect-call-on-float.test View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/parse_errs/insertelt-wrong-type.test View 1 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/parse_errs/symtab-after-fcn.test View 1 1 chunk +2 lines, -1 line 0 comments Download
M tests_lit/reader_tests/alloca.ll View 1 14 chunks +14 lines, -14 lines 0 comments Download
M tests_lit/reader_tests/binops.ll View 13 chunks +156 lines, -156 lines 0 comments Download
M tests_lit/reader_tests/branch.ll View 4 chunks +4 lines, -4 lines 0 comments Download
M tests_lit/reader_tests/call.ll View 1 7 chunks +11 lines, -9 lines 0 comments Download
M tests_lit/reader_tests/casts.ll View 32 chunks +72 lines, -72 lines 0 comments Download
M tests_lit/reader_tests/compare.ll View 28 chunks +28 lines, -28 lines 0 comments Download
M tests_lit/reader_tests/constants.ll View 1 2 chunks +2 lines, -2 lines 0 comments Download
M tests_lit/reader_tests/extern_globals.ll View 1 2 3 4 5 1 chunk +3 lines, -1 line 0 comments Download
M tests_lit/reader_tests/forwardref.ll View 4 chunks +4 lines, -4 lines 0 comments Download
M tests_lit/reader_tests/globalinit.pnacl.ll View 1 1 chunk +7 lines, -3 lines 0 comments Download
M tests_lit/reader_tests/globalrelocs.ll View 1 chunk +2 lines, -2 lines 0 comments Download
M tests_lit/reader_tests/insertextract.ll View 28 chunks +28 lines, -28 lines 0 comments Download
M tests_lit/reader_tests/load.ll View 1 12 chunks +12 lines, -12 lines 0 comments Download
M tests_lit/reader_tests/nacl-atomic-intrinsics.ll View 45 chunks +80 lines, -80 lines 0 comments Download
M tests_lit/reader_tests/nacl-other-intrinsics.ll View 1 2 23 chunks +47 lines, -45 lines 0 comments Download
M tests_lit/reader_tests/select.ll View 7 chunks +42 lines, -42 lines 0 comments Download
M tests_lit/reader_tests/store.ll View 1 12 chunks +12 lines, -12 lines 0 comments Download
M tests_lit/reader_tests/switch.ll View 38 chunks +38 lines, -38 lines 0 comments Download
M tests_lit/reader_tests/unnamed.ll View 1 chunk +8 lines, -8 lines 0 comments Download
M unittest/IceParseInstsTest.cpp View 1 6 5 chunks +6 lines, -6 lines 0 comments Download

Messages

Total messages: 9 (1 generated)
Karl
5 years, 2 months ago (2015-10-06 19:20:21 UTC) #2
John
lgtm https://chromiumcodereview.appspot.com/1387963002/diff/40001/src/IceClFlags.h File src/IceClFlags.h (right): https://chromiumcodereview.appspot.com/1387963002/diff/40001/src/IceClFlags.h#newcode248 src/IceClFlags.h:248: bool AllowExternDefinedSymbols = false; I have mixed feelings ...
5 years, 2 months ago (2015-10-06 19:30:15 UTC) #3
Jim Stichnoth
Not lgtm quite yet please. I've only looked at one of the tests so far, ...
5 years, 2 months ago (2015-10-06 19:45:37 UTC) #4
Karl
On 2015/10/06 19:45:37, stichnot wrote: > Not lgtm quite yet please. > > I've only ...
5 years, 2 months ago (2015-10-06 19:50:13 UTC) #5
Jim Stichnoth
I think I agree that fixing IceConverter in the same way, would be the best ...
5 years, 2 months ago (2015-10-06 20:16:21 UTC) #6
Karl
https://chromiumcodereview.appspot.com/1387963002/diff/40001/src/IceClFlags.h File src/IceClFlags.h (right): https://chromiumcodereview.appspot.com/1387963002/diff/40001/src/IceClFlags.h#newcode248 src/IceClFlags.h:248: bool AllowExternDefinedSymbols = false; On 2015/10/06 19:30:15, John wrote: ...
5 years, 2 months ago (2015-10-06 21:47:18 UTC) #7
Jim Stichnoth
LGTM, but you probably want to revert those formatting changes in IceParseInstsTest.cpp .
5 years, 2 months ago (2015-10-06 22:42:49 UTC) #8
Karl
5 years, 2 months ago (2015-10-07 16:53:17 UTC) #9
Message was sent while issue was closed.
Committed patchset #8 (id:140001) manually as
57d31ac73a35263d42357259329fa7d3e565731b (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698