New issue
Advanced search Search tips
Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017

Blocking:
issue 6



Sign in to add a comment
link

Issue 9: Load and relocate Subzero ELF code

Reported by nicolasc...@google.com, Sep 13 2016 Project Member

Issue description

Subzero currently outputs to an ELF object file. We should output to memory instead, apply relocations, and retrieve the entry point.
 

Comment 1 by nicolasc...@google.com, Sep 14 2016

Project Member
Found out that PNaCl uses the "x32" ABI for x86-64 code, which uses 32-bit pointers (i.e. ILP32). So it uses ELF32 regardless of the ISA bitness. This may not suffice for SwiftShader's needs.

It also currently only supports the System V calling convention for AMD64. We'll need to add support for Microsoft's x86-64 calling convention.

Comment 2 by bugdroid1@chromium.org, Sep 16 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/native_client/pnacl-subzero/+/3e376471fcd706be0e224a4f69fc31b7b7e4ee58

commit 3e376471fcd706be0e224a4f69fc31b7b7e4ee58
Author: Nicolas Capens <capn@google.com>
Date: Tue Sep 13 15:35:57 2016

Abstract the ELFStreamer class.

This enables other implementations, such as streaming to memory
instead of a file.

BUG= swiftshader:9 

Change-Id: I2a780ee67e9bccd157c120b7a0895d9764117464
Reviewed-on: https://chromium-review.googlesource.com/384911
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>

[modify] https://crrev.com/3e376471fcd706be0e224a4f69fc31b7b7e4ee58/src/IceDefs.h
[modify] https://crrev.com/3e376471fcd706be0e224a4f69fc31b7b7e4ee58/src/IceCompileServer.cpp
[modify] https://crrev.com/3e376471fcd706be0e224a4f69fc31b7b7e4ee58/src/IceBrowserCompileServer.cpp
[modify] https://crrev.com/3e376471fcd706be0e224a4f69fc31b7b7e4ee58/src/IceELFStreamer.h

Comment 3 by bugdroid1@chromium.org, Sep 19 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/native_client/pnacl-subzero/+/41ce47ce144ee5f66cd957c3e6f213c96a137219

commit 41ce47ce144ee5f66cd957c3e6f213c96a137219
Author: Nicolas Capens <capn@google.com>
Date: Fri Sep 16 21:00:12 2016

Allow 64-bit code to be stored as ELF64.

Previously all unsandboxed 64-bit code was assumed to use ILP32 and
be stored in ELF32 format using the x32 ABI.

BUG= swiftshader:9 

Change-Id: I2476a09d1f0af60b1ac6f8807ee9ed37d54a99d4
Reviewed-on: https://chromium-review.googlesource.com/385277
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>

[modify] https://crrev.com/41ce47ce144ee5f66cd957c3e6f213c96a137219/src/IceClFlags.def
[modify] https://crrev.com/41ce47ce144ee5f66cd957c3e6f213c96a137219/src/IceELFObjectWriter.cpp
[modify] https://crrev.com/41ce47ce144ee5f66cd957c3e6f213c96a137219/src/IceDefs.h

Comment 4 by bugdroid1@chromium.org, Sep 19 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/native_client/pnacl-subzero/+/464df5b9f7f3518a263c3f7f7050cc07dc6ce458

commit 464df5b9f7f3518a263c3f7f7050cc07dc6ce458
Author: Nicolas Capens <capn@google.com>
Date: Sat Sep 17 04:19:38 2016

Implement Microsoft x86-64 calling convention support.

BUG= swiftshader:9 

Change-Id: Ie58412c13991143c1ee39f3a122475bf93ead242
Reviewed-on: https://chromium-review.googlesource.com/385117
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>

[modify] https://crrev.com/464df5b9f7f3518a263c3f7f7050cc07dc6ce458/src/IceTargetLoweringX8664Traits.h

Comment 5 by nicolasc...@google.com, Sep 20 2016

Project Member
Blocking: 6

Comment 6 by bugdroid1@chromium.org, Sep 29 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/native_client/pnacl-subzero/+/f53580b063d9a206e72a2b4166aff2c62e71555d

commit f53580b063d9a206e72a2b4166aff2c62e71555d
Author: Nicolas Capens <capn@google.com>
Date: Wed Sep 28 11:20:30 2016

Don't emit address size prefixes for native x86-64 ABI.

Address size prefixes are used in 64-bit x86 for PNaCl's use of the
x32 ABI with ILP32 data model. Don't emit them for any other ABI.

BUG= swiftshader:9 

Change-Id: I1351db086d44ce4b144b3428866a54e84637b9a4
Reviewed-on: https://chromium-review.googlesource.com/390409
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>

[modify] https://crrev.com/f53580b063d9a206e72a2b4166aff2c62e71555d/src/IceTargetLoweringX8664.h

Comment 7 by bugdroid1@chromium.org, Oct 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/native_client/src/native_client.git/+/a123a8b25857b7402198308a6b42a5172dac30c1

commit a123a8b25857b7402198308a6b42a5172dac30c1
Author: Jim Stichnoth <stichnot@chromium.org>
Date: Wed Oct 12 22:00:03 2016

PNaCl: Update subzero revision in pnacl/COMPONENT_REVISIONS

This pulls in the following Subzero changes:

8fbddc6: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Randomly insert NOP
3e37647: (capn@google.com) Abstract the ELFStreamer class.
40fc819: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: nacl-other-intrinsics-mips merged to original file
132ea7a: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Floating point support in ELF output
41ce47c: (capn@google.com) Allow 64-bit code to be stored as ELF64.
464df5b: (capn@google.com) Implement Microsoft x86-64 calling convention support.
cc6dea7: (jaydeep.patil@imgtec.com) [SubZero] Use DIV instruction instead of TargetHelperCall
3b61d70: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: lowerUnreachable
cf9c12f: (jaydeep.patil@imgtec.com) [SubZero] lower float and double constants for MIPS
8d16c1d: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Encoding of FP comparison instructions
0465d02: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Intrinsic call Trap
d895447: (jaydeep.patil@imgtec.com) [SubZero] Fix floating-point comparison for MIPS
f5d8e09: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Remove duplicate functionalities
cadda79: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Instruction NOR, pseudoinstruction NOT
d27ce3d: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Intrinsic call Ctlz for i32
6ee373f: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Fix floating point comparison crosstest
0a7f99d: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Intrinsic call Cttz for i32
86b60ef: (sagar.thakur@imgtec.com) [Subzero][MIPS32] Implements 64-bit shl, lshr, ashr for MIPS
98405d3: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: lowerSelect for i64
623f8ce: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Cross-testing enabled for MIPS32
4c49b10: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Filling missing bits from genTargetHelperCallFor
58eeedf: (jaydeep.patil@imgtec.com) Subzero, MIPS32: Binding intrablock labels, unconditional branch
6fd9c0e: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Intrinsic calls Ctlz and Cttz for i64
175cb13: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: Intrinsic call Bswap for i16, i32 and i64
6163c62: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: DIVU instruction encoding
b0f09fc: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: MOVZ instruction encoding
70b6ed4: (sagar.thakur@imgtec.com) [Subzero][MIPS] Implement 64-bit integer compare operations
fe93fdd: (Srdjan.Obucina@imgtec.com) Subzero, MIPS32: SRAV instruction encoding
f53580b: (capn@google.com) Don't emit address size prefixes for native x86-64 ABI.
269eed4: (sagar.thakur@imgtec.com) [Subzero][MIPS] Add RUN command line with -Om1 in test 64bit.pnacl.ll
9309756: (sagar.thakur@imgtec.com) [Subzero][MIPS] Implement conditional branches with 64-bit integer compares
958ddb7: (jaydeep.patil@imgtec.com) [SubZero] Vector types support for MIPS
033dda7: (stichnot@chromium.org) Subzero: Remove --skip-unimplemented from ARM lit tests.
afe5fe2: (makdstefan@gmail.com) Subzero, MIPS32: Fix conditional mov instructions
533a514: (stichnot@chromium.org) Subzero: Fix "make -f Makefile.standalone check-lit FORCEASM=1".
acfb3df: (capn@google.com) Implement intrinsics for loading/storing subvectors.
71c6937: (capn@google.com) Optimize lowering of x86 byte and word vector unpack.
b093539: (capn@google.com) Optimize x86 vector shift by constant.
46f4fea: (capn@google.com) Support running unit tests on Windows.
b001cc4: (sagar.thakur@imgtec.com) [Subzero][MIPS32] Implement bitcast operation for both 32-bit and 64-bit operands

BUG=  swiftshader:15 
BUG=  swiftshader:7 
BUG=  swiftshader:9 
TEST= PNaCl toolchain trybots
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/2408293003 .

[modify] https://crrev.com/a123a8b25857b7402198308a6b42a5172dac30c1/pnacl/COMPONENT_REVISIONS

Comment 10 by bugdroid1@chromium.org, Dec 1 2016

The following revision refers to this bug:
  https://swiftshader.googlesource.com/SwiftShader.git/+/58274b5af7a36c2b1f1ef3ccce1c82feb0b47f9f

commit 58274b5af7a36c2b1f1ef3ccce1c82feb0b47f9f
Author: Nicolas Capens <capn@google.com>
Date: Thu Oct 20 03:45:19 2016

Fix relocating the code just once.

 Bug swiftshader:9 

Change-Id: I5968426e6ffd53f65f0699017d35d07ff45bffab
Reviewed-on: https://swiftshader-review.googlesource.com/7750
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/8131
Reviewed-by: Alexis H├ętu <sugoi@google.com>

[modify] https://crrev.com/58274b5af7a36c2b1f1ef3ccce1c82feb0b47f9f/src/Reactor/SubzeroReactor.cpp

Comment 11 by bugdroid1@chromium.org, Jan 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/native_client/src/native_client.git/+/01d3ae00d277726b8aaee572120a5ba2a31d511e

commit 01d3ae00d277726b8aaee572120a5ba2a31d511e
Author: Jim Stichnoth <stichnot@chromium.org>
Date: Wed Jan 04 07:04:41 2017

PNaCl: Update subzero revision in pnacl/COMPONENT_REVISIONS

This pulls in the following Subzero changes:

ec92917: (jaydeep.patil@imgtec.com) [SubZero] Legalize load, store for MIPS post lower
4683237: (sagar.thakur@imgtec.com) [Subzero][MIPS32] Fix alloca alignment and offset for Om1 and O2 optimization
45e4d5e: (jaydeep.patil@imgtec.com) [SubZero] Handle relocatable constants for MIPS
3a01f33: (jaydeep.patil@imgtec.com) [SubZero] Implement Fcmp, ICmp, Cast and Select for vector type
f52cea4: (capn@google.com) Fix unpacking from a single vector.
7638e27: (capn@google.com) Add x86 vector packing instructions.
0e90622: (capn@google.com) Generate error on unexpected intrisics.
89be887: (sagar.thakur@imgtec.com) [Subzero][MIPS32] Account for variable alloca alignment bytes in addProlog
1448d95: (capn@google.com) Optimize shuffles corresponding to x86 punpckh instructions.
7145e69: (stichnot@chromium.org) Subzero: Fix compiler warnings.
32f9cce: (capn@google.com) Fix 64-bit pointer type for non-x32 ABIs.
ef8210d: (capn@google.com) Implement vector packing intrinsics.
8b8af82: (capn@google.com) Implement bitcast between i32 and (emulated) v4i8.
e3cabda: (capn@google.com) Implement vector sign mask intrinsic.
d0e3030: (capn@google.com) Assert that PNaCl bitcode only uses 128-bit vector casts.
c9e91af: (capn@google.com) Remove verified asserts.
61593fb: (capn@google.com) Fix unit tests.
a3688ea: (capn@google.com) Fix two-vector unpack case.
a7979bf: (jaydeep.patil@imgtec.com) [SubZero] Fix f64 to/from i64 moves
0dabe18: (makdstefan@gmail.com) Subzero, MIPS32: Remove --skip-unimplemented from lit tests
130aca7: (jaydeep.patil@imgtec.com) [SubZero] Generate relocations for MIPS
73ae4fd: (capn@google.com) Preserve rsi and rdi when using Microsoft x86-64 calling convention.
7ad028e: (makdstefan@gmail.com) This patch enables running a couple more of lit tests for MIPS32
956cfd6: (capn@google.com) Generalize the Sqrt intrinsic to process vectors.
13cde0f: (capn@google.com) Implement integer vector multiply intrinsics.
67a49b5: (capn@google.com) Implement saturated vector add/subtract.
0c4c07d: (jaydeep.patil@imgtec.com) [SubZero] Fix code generation for vector type
f8c9977: (makdstefan@gmail.com) Subzero, MIPS32: Stacksave/Stackrestore implementation
f0d12c3: (capn@google.com) Implement floating-point rounding intrinsic.
3da9f65: (jaydeep.patil@imgtec.com) [SubZero] Generate MIPS.abiflags section
21f78bb: (jaydeep.patil@imgtec.com) [SubZero] Utilize instructions with immediate operands
83425de: (capn@google.com) Support 64-bit jump tables with LP64 data model.
6e03343: (makdstefan@gmail.com) Subzero, MIPS32: Sandbox initial patch
becb85f: (sagar.thakur@imgtec.com) [Subzero][MIPS] Implements atomic intrinsics for MIPS32
8208e75: (makdstefan@gmail.com) Subzero, MIPS32: Changes for improving sandbox crosstest results
2220990: (capn@google.com) Fix offset adjustment in x86 address optimization.
ef18fc5: (capn@google.com) Match sub-vector load/store operand order to regular load/store.
8be6975: (jaydeep.patil@imgtec.com) [SubZero] Fix size of arguments on stack
e1e1783: (capn@google.com) Fix skipping deleted instructions before replacing operands.
a29da90: (capn@google.com) Ensure that the sub-vector load destination is a register.
579b1b3: (capn@google.com) Generalize vector shuffling to accept any operand.
373913f: (stichnot@chromium.org) Subzero: Legalize the movzx argument.
35bbca3: (stichnot@chromium.org) Subzero: Fix multiply defined symbols in Windows/g++ build.

BUG=  swiftshader:24 
BUG=  swiftshader:9 
BUG=  swiftshader:22 
BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4384
BUG=  swiftshader:15 
TEST= PNaCl toolchain trybots
R=dschuff@chromium.org

Review-Url: https://codereview.chromium.org/2602613002 .

[modify] https://crrev.com/01d3ae00d277726b8aaee572120a5ba2a31d511e/pnacl/COMPONENT_REVISIONS

Comment 12 by nicolasc...@google.com, Jan 13 2017

Project Member
Status: Fixed (was: Accepted)

Comment 13 by bugdroid1@chromium.org, May 3 2017

The following revision refers to this bug:
  https://swiftshader.googlesource.com/SwiftShader.git/+/3e376471fcd706be0e224a4f69fc31b7b7e4ee58

commit 3e376471fcd706be0e224a4f69fc31b7b7e4ee58
Author: Nicolas Capens <capn@google.com>
Date: Fri Sep 16 14:05:22 2016

Abstract the ELFStreamer class.

This enables other implementations, such as streaming to memory
instead of a file.

BUG= swiftshader:9 

Change-Id: I2a780ee67e9bccd157c120b7a0895d9764117464
Reviewed-on: https://chromium-review.googlesource.com/384911
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>

[modify] https://crrev.com/3e376471fcd706be0e224a4f69fc31b7b7e4ee58/src/IceBrowserCompileServer.cpp
[modify] https://crrev.com/3e376471fcd706be0e224a4f69fc31b7b7e4ee58/src/IceCompileServer.cpp
[modify] https://crrev.com/3e376471fcd706be0e224a4f69fc31b7b7e4ee58/src/IceDefs.h
[modify] https://crrev.com/3e376471fcd706be0e224a4f69fc31b7b7e4ee58/src/IceELFStreamer.h

Comment 14 by bugdroid1@chromium.org, May 3 2017

The following revision refers to this bug:
  https://swiftshader.googlesource.com/SwiftShader.git/+/41ce47ce144ee5f66cd957c3e6f213c96a137219

commit 41ce47ce144ee5f66cd957c3e6f213c96a137219
Author: Nicolas Capens <capn@google.com>
Date: Mon Sep 19 19:40:58 2016

Allow 64-bit code to be stored as ELF64.

Previously all unsandboxed 64-bit code was assumed to use ILP32 and
be stored in ELF32 format using the x32 ABI.

BUG= swiftshader:9 

Change-Id: I2476a09d1f0af60b1ac6f8807ee9ed37d54a99d4
Reviewed-on: https://chromium-review.googlesource.com/385277
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>

[modify] https://crrev.com/41ce47ce144ee5f66cd957c3e6f213c96a137219/src/IceClFlags.def
[modify] https://crrev.com/41ce47ce144ee5f66cd957c3e6f213c96a137219/src/IceDefs.h
[modify] https://crrev.com/41ce47ce144ee5f66cd957c3e6f213c96a137219/src/IceELFObjectWriter.cpp

Comment 15 by bugdroid1@chromium.org, May 3 2017

The following revision refers to this bug:
  https://swiftshader.googlesource.com/SwiftShader.git/+/464df5b9f7f3518a263c3f7f7050cc07dc6ce458

commit 464df5b9f7f3518a263c3f7f7050cc07dc6ce458
Author: Nicolas Capens <capn@google.com>
Date: Mon Sep 19 20:58:46 2016

Implement Microsoft x86-64 calling convention support.

BUG= swiftshader:9 

Change-Id: Ie58412c13991143c1ee39f3a122475bf93ead242
Reviewed-on: https://chromium-review.googlesource.com/385117
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>

[modify] https://crrev.com/464df5b9f7f3518a263c3f7f7050cc07dc6ce458/src/IceTargetLoweringX8664Traits.h

Comment 16 by bugdroid1@chromium.org, May 3 2017

The following revision refers to this bug:
  https://swiftshader.googlesource.com/SwiftShader.git/+/f53580b063d9a206e72a2b4166aff2c62e71555d

commit f53580b063d9a206e72a2b4166aff2c62e71555d
Author: Nicolas Capens <capn@google.com>
Date: Thu Sep 29 01:32:05 2016

Don't emit address size prefixes for native x86-64 ABI.

Address size prefixes are used in 64-bit x86 for PNaCl's use of the
x32 ABI with ILP32 data model. Don't emit them for any other ABI.

BUG= swiftshader:9 

Change-Id: I1351db086d44ce4b144b3428866a54e84637b9a4
Reviewed-on: https://chromium-review.googlesource.com/390409
Reviewed-by: Jim Stichnoth <stichnot@chromium.org>
Tested-by: Nicolas Capens <nicolascapens@google.com>

[modify] https://crrev.com/f53580b063d9a206e72a2b4166aff2c62e71555d/src/IceTargetLoweringX8664.h

Comment 17 by bugdroid1@chromium.org, May 3 2017

The following revision refers to this bug:
  https://swiftshader.googlesource.com/SwiftShader.git/+/32f9ccef8dee33110cc9ebdca2853d6a078752ed

commit 32f9ccef8dee33110cc9ebdca2853d6a078752ed
Author: Nicolas Capens <capn@google.com>
Date: Wed Oct 19 20:26:59 2016

Fix 64-bit pointer type for non-x32 ABIs.

BUG= swiftshader:9 

Change-Id: Ife06416736d47acba4f2cff1ea8b17be61134752

[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLowering.cpp
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLowering.h
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLoweringARM32.cpp
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLoweringARM32.h
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLoweringMIPS32.cpp
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLoweringMIPS32.h
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLoweringX8632.cpp
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLoweringX8664.cpp
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLoweringX86Base.h
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTargetLoweringX86BaseImpl.h
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTypes.cpp
[modify] https://crrev.com/32f9ccef8dee33110cc9ebdca2853d6a078752ed/src/IceTypes.h

Sign in to add a comment