Commit 41ce47ce by Nicolas Capens Committed by Nicolas Capens

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/385277Reviewed-by: 's avatarJim Stichnoth <stichnot@chromium.org> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 132ea7a5
...@@ -229,6 +229,13 @@ struct dev_list_flag {}; ...@@ -229,6 +229,13 @@ struct dev_list_flag {};
"Low-level integrated assembly ('.s') file"), \ "Low-level integrated assembly ('.s') file"), \
clEnumValEnd)) \ clEnumValEnd)) \
\ \
X(ApplicationBinaryInterface, Ice::ABI, dev_opt_flag, "abi", \
cl::desc("ABI type"), cl::init(Ice::ABI_PNaCl), \
cl::values( \
clEnumValN(Ice::ABI_PNaCl, "pnacl", "x32 for unsandboxed 64-bit x86"), \
clEnumValN(Ice::ABI_Platform, "platform", "Native executable ABI"), \
clEnumValEnd)) \
\
X(ParseParallel, bool, dev_opt_flag, "parse-parallel", \ X(ParseParallel, bool, dev_opt_flag, "parse-parallel", \
cl::desc("Parse function blocks in parallel"), cl::init(true)) \ cl::desc("Parse function blocks in parallel"), cl::init(true)) \
\ \
......
...@@ -372,6 +372,11 @@ enum FileType { ...@@ -372,6 +372,11 @@ enum FileType {
FT_Iasm /// "Integrated assembler" .byte-style .s file FT_Iasm /// "Integrated assembler" .byte-style .s file
}; };
enum ABI {
ABI_PNaCl, /// x32 for unsandboxed 64-bit x86
ABI_Platform /// Native executable ABI
};
using Ostream = llvm::raw_ostream; using Ostream = llvm::raw_ostream;
using Fdstream = llvm::raw_fd_ostream; using Fdstream = llvm::raw_fd_ostream;
......
...@@ -49,8 +49,9 @@ bool isELF64(const ClFlags &Flags) { ...@@ -49,8 +49,9 @@ bool isELF64(const ClFlags &Flags) {
return false; return false;
} }
if (!Flags.getUseSandboxing()) { if (Flags.getApplicationBinaryInterface() == ABI_PNaCl &&
// Unsandboxed code is always ELF32 (pexes are ILP32.) !Flags.getUseSandboxing()) {
// Unsandboxed PNaCl code is always ELF32 (pexes are ILP32.)
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment