Skip to content

Commit 33da0d9

Browse files
author
Jan Voung
committed
Start to disallow llvm.frameaddress and llvm.returnaddress in ABI checker.
They do not seem to be widely used by user code. * The boehm garbage collector library does reference __builtin_return_address under an ifdef, but it does not appear to be compiled in. * Mesa-7.6 uses __builtin_frame_address for u_debug_stack.c, but that also does not appear to be part of the built libraries. They expose stack/code addresses (at least the lower 32-bits of the address). As part of https://codereview.chromium.org/14619022/, we stopped considering the scons and gcc torture tests that use these intrinsics as meeting the stable ABI. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3378 [email protected] Review URL: https://codereview.chromium.org/14657017
1 parent a0efa09 commit 33da0d9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/Analysis/NaCl/PNaClABIVerifyModule.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ bool PNaClABIVerifyModule::IsWhitelistedIntrinsic(const Function* F,
129129
// (2) Never allowed
130130
// (3) "Dev" intrinsics, which may or may not be allowed.
131131
// "Dev" intrinsics are controlled by the PNaClABIAllowDevIntrinsics flag.
132-
// Please keep these sorted within each category.
132+
// Please keep these sorted or grouped in a sensible way, within
133+
// each category.
133134
switch(ID) {
134135
// Disallow by default.
135136
default: return false;
@@ -147,7 +148,10 @@ bool PNaClABIVerifyModule::IsWhitelistedIntrinsic(const Function* F,
147148

148149
// (2) Known to be never allowed.
149150
case Intrinsic::not_intrinsic:
151+
// Trampolines depend on a target-specific-sized/aligned buffer.
150152
case Intrinsic::adjust_trampoline:
153+
case Intrinsic::init_trampoline:
154+
// CXX exception handling is not stable.
151155
case Intrinsic::eh_dwarf_cfa:
152156
case Intrinsic::eh_return_i32:
153157
case Intrinsic::eh_return_i64:
@@ -158,8 +162,12 @@ bool PNaClABIVerifyModule::IsWhitelistedIntrinsic(const Function* F,
158162
case Intrinsic::eh_sjlj_setjmp:
159163
case Intrinsic::eh_typeid_for:
160164
case Intrinsic::eh_unwind_init:
161-
case Intrinsic::init_trampoline:
165+
// We do not want to expose addresses to the user.
166+
case Intrinsic::frameaddress:
167+
case Intrinsic::returnaddress:
168+
// Not supporting stack protectors.
162169
case Intrinsic::stackprotector:
170+
// Var-args handling is done w/out intrinsics.
163171
case Intrinsic::vacopy:
164172
case Intrinsic::vaend:
165173
case Intrinsic::vastart:
@@ -178,15 +186,13 @@ bool PNaClABIVerifyModule::IsWhitelistedIntrinsic(const Function* F,
178186
case Intrinsic::exp2: // Rounding not defined: support with fast-math?
179187
case Intrinsic::expect: // From __builtin_expect.
180188
case Intrinsic::flt_rounds:
181-
case Intrinsic::frameaddress: // Support for 0-level or not?
182189
case Intrinsic::log: // Rounding not defined: support with fast-math?
183190
case Intrinsic::log2: // Rounding not defined: support with fast-math?
184191
case Intrinsic::log10: // Rounding not defined: support with fast-math?
185192
case Intrinsic::nacl_target_arch: // Used by translator self-build.
186193
case Intrinsic::pow: // Rounding is supposed to be the same as libm.
187194
case Intrinsic::powi: // Rounding not defined: support with fast-math?
188195
case Intrinsic::prefetch: // Could ignore if target doesn't support?
189-
case Intrinsic::returnaddress: // Support for 0-level or not?
190196
case Intrinsic::sin: // Rounding not defined: support with fast-math?
191197
case Intrinsic::sqrt:
192198
case Intrinsic::stackrestore: // Used to support C99 VLAs.

0 commit comments

Comments
 (0)