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

Issue 874353006: Write out global initializers and data rel directly to ELF file. (Closed)

Created:
5 years, 10 months ago by jvoung (off chromium)
Modified:
5 years, 10 months ago
Reviewers:
Karl, Jim Stichnoth, JF
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

Write out global initializers and data rel directly to ELF file. The local symbol relocations are a bit different from llvm-mc, which are section-relative. E.g., instead "bytes", it will be ".data + offsetof(bytes, .data)". So the contents of the text/data/rodata sections can also differ since the offsets written in place are different. Still need to fill the symbol table with undefined symbols (e.g., memset, and szrt lib functions) before trying to link. BUG=none R=kschimpf@google.com, stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=72984d881d7afb8d890380348061a3177b609e89

Patch Set 1 #

Patch Set 2 : fix local/global binding check #

Patch Set 3 : clang-format #

Patch Set 4 : pull statics out #

Total comments: 4

Patch Set 5 : misc stuff #

Total comments: 25

Patch Set 6 : rebase #

Patch Set 7 : review #1 #

Total comments: 14

Patch Set 8 : review #2 #

Patch Set 9 : typo #

Patch Set 10 : rename GlobalLowering to DataLowering #

Patch Set 11 : tweak comment #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+653 lines, -160 lines) Patch
M src/IceConverter.cpp View 1 2 3 4 5 3 chunks +4 lines, -6 lines 0 comments Download
M src/IceDefs.h View 1 2 3 4 5 6 7 8 9 2 chunks +3 lines, -1 line 0 comments Download
M src/IceELFObjectWriter.h View 1 2 3 4 5 6 7 8 9 5 chunks +47 lines, -16 lines 0 comments Download
M src/IceELFObjectWriter.cpp View 1 2 3 4 5 6 7 8 9 9 chunks +191 lines, -43 lines 1 comment Download
M src/IceELFSection.h View 1 2 3 4 5 3 chunks +20 lines, -3 lines 0 comments Download
M src/IceELFSection.cpp View 1 2 3 4 5 6 3 chunks +29 lines, -1 line 0 comments Download
M src/IceGlobalInits.h View 1 2 3 4 5 2 chunks +3 lines, -3 lines 0 comments Download
M src/IceTargetLowering.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +12 lines, -11 lines 0 comments Download
M src/IceTargetLowering.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +6 lines, -6 lines 0 comments Download
M src/IceTargetLoweringX8632.h View 1 2 3 4 5 6 7 8 9 1 chunk +11 lines, -10 lines 0 comments Download
M src/IceTargetLoweringX8632.cpp View 1 2 3 4 5 6 7 8 9 4 chunks +14 lines, -14 lines 0 comments Download
M src/IceTimerTree.def View 1 chunk +1 line, -0 lines 0 comments Download
M src/IceTranslator.h View 1 2 3 4 5 6 7 8 9 3 chunks +3 lines, -4 lines 0 comments Download
M src/IceTranslator.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +27 lines, -14 lines 0 comments Download
M src/IceUtils.h View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -0 lines 0 comments Download
M src/PNaClTranslator.cpp View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M src/assembler_ia32.cpp View 1 2 3 4 5 6 1 chunk +1 line, -7 lines 0 comments Download
M tests_lit/llvm2ice_tests/elf_container.ll View 1 12 chunks +271 lines, -19 lines 0 comments Download

Messages

Total messages: 14 (3 generated)
jvoung (off chromium)
https://codereview.chromium.org/874353006/diff/60001/src/IceELFSection.cpp File src/IceELFSection.cpp (right): https://codereview.chromium.org/874353006/diff/60001/src/IceELFSection.cpp#newcode106 src/IceELFSection.cpp:106: if (Binding == STB_LOCAL) oops https://codereview.chromium.org/874353006/diff/60001/src/IceGlobalInits.h File src/IceGlobalInits.h (right): ...
5 years, 10 months ago (2015-01-27 01:46:28 UTC) #2
Jim Stichnoth
https://codereview.chromium.org/874353006/diff/60001/src/IceELFSection.cpp File src/IceELFSection.cpp (right): https://codereview.chromium.org/874353006/diff/60001/src/IceELFSection.cpp#newcode106 src/IceELFSection.cpp:106: if (Binding == STB_LOCAL) On 2015/01/27 01:46:28, jvoung wrote: ...
5 years, 10 months ago (2015-01-27 16:44:56 UTC) #3
jvoung (off chromium)
Thanks! https://codereview.chromium.org/874353006/diff/60001/src/IceELFSection.cpp File src/IceELFSection.cpp (right): https://codereview.chromium.org/874353006/diff/60001/src/IceELFSection.cpp#newcode106 src/IceELFSection.cpp:106: if (Binding == STB_LOCAL) On 2015/01/27 16:44:55, stichnot ...
5 years, 10 months ago (2015-01-28 17:46:23 UTC) #4
Jim Stichnoth
https://codereview.chromium.org/874353006/diff/80001/src/IceTargetLowering.h File src/IceTargetLowering.h (right): https://codereview.chromium.org/874353006/diff/80001/src/IceTargetLowering.h#newcode260 src/IceTargetLowering.h:260: virtual void lowerGlobalsELF(const VariableDeclarationList &Vars) = 0; On 2015/01/28 ...
5 years, 10 months ago (2015-01-28 20:35:08 UTC) #5
Karl
I didn't see any other issues besides the existing comments by Jim.
5 years, 10 months ago (2015-01-28 21:18:46 UTC) #7
jvoung (off chromium)
https://codereview.chromium.org/874353006/diff/80001/src/IceTargetLowering.h File src/IceTargetLowering.h (right): https://codereview.chromium.org/874353006/diff/80001/src/IceTargetLowering.h#newcode260 src/IceTargetLowering.h:260: virtual void lowerGlobalsELF(const VariableDeclarationList &Vars) = 0; On 2015/01/28 ...
5 years, 10 months ago (2015-01-28 23:37:53 UTC) #8
Jim Stichnoth
lgtm https://codereview.chromium.org/874353006/diff/80001/src/IceTargetLowering.h File src/IceTargetLowering.h (right): https://codereview.chromium.org/874353006/diff/80001/src/IceTargetLowering.h#newcode260 src/IceTargetLowering.h:260: virtual void lowerGlobalsELF(const VariableDeclarationList &Vars) = 0; On ...
5 years, 10 months ago (2015-01-29 00:38:14 UTC) #9
jvoung (off chromium)
https://codereview.chromium.org/874353006/diff/80001/src/IceTargetLowering.h File src/IceTargetLowering.h (right): https://codereview.chromium.org/874353006/diff/80001/src/IceTargetLowering.h#newcode260 src/IceTargetLowering.h:260: virtual void lowerGlobalsELF(const VariableDeclarationList &Vars) = 0; On 2015/01/29 ...
5 years, 10 months ago (2015-01-29 19:33:04 UTC) #10
Karl
lgtm
5 years, 10 months ago (2015-01-29 21:35:27 UTC) #11
jvoung (off chromium)
Committed patchset #11 (id:200001) manually as 72984d881d7afb8d890380348061a3177b609e89 (presubmit successful).
5 years, 10 months ago (2015-01-29 22:42:44 UTC) #12
JF
5 years, 10 months ago (2015-01-31 17:49:54 UTC) #14
Message was sent while issue was closed.
https://codereview.chromium.org/874353006/diff/200001/src/IceELFObjectWriter.cpp
File src/IceELFObjectWriter.cpp (right):

https://codereview.chromium.org/874353006/diff/200001/src/IceELFObjectWriter....
src/IceELFObjectWriter.cpp:308: void
ELFObjectWriter::writeDataOfType(SectionType SectionType,
This made the Windows build sad:

c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:
In member function 'void
Ice::ELFObjectWriter::writeDataOfType(Ice::ELFObjectWriter::SectionType, const
VariableDeclarationList&, Ice::FixupKind, bool)':
c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:323:8:
error: 'SectionType' is not a class, namespace, or enumeration
   case SectionType::ROData: {
        ^
c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:336:8:
error: 'SectionType' is not a class, namespace, or enumeration
   case SectionType::Data: {
        ^
c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:348:8:
error: 'SectionType' is not a class, namespace, or enumeration
   case SectionType::BSS: {
        ^
c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:358:8:
error: 'SectionType' is not a class, namespace, or enumeration
   case SectionType::NumSectionTypes:
        ^
c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:322:10:
warning: enumeration value 'ROData' not handled in switch [-Wswitch]
   switch (SectionType) {
          ^
c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:322:10:
warning: enumeration value 'Data' not handled in switch [-Wswitch]
c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:322:10:
warning: enumeration value 'BSS' not handled in switch [-Wswitch]
c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:322:10:
warning: enumeration value 'NumSectionTypes' not handled in switch [-Wswitch]
c:/b/build/slave/nacl-toolchain/build/native_client/toolchain_build/src/subzero/src/IceELFObjectWriter.cpp:377:26:
error: 'SectionType' is not a class, namespace, or enumeration
       if (SectionType == SectionType::ROData)
                          ^


Fixing in:
  https://codereview.chromium.org/891953002/

Powered by Google App Engine
This is Rietveld 408576698