diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 19:34:54 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 19:34:54 +0000 |
commit | 9a0dc1e027e2d37d85045d9b6a4bfbb319f2da1a (patch) | |
tree | 3a7af3ca34772f55def46546a155fa1648a0b0ae /sandbox | |
parent | bd672cafa8351373ebc642f3bb4c806589085bba (diff) | |
download | chromium_src-9a0dc1e027e2d37d85045d9b6a4bfbb319f2da1a.zip chromium_src-9a0dc1e027e2d37d85045d9b6a4bfbb319f2da1a.tar.gz chromium_src-9a0dc1e027e2d37d85045d9b6a4bfbb319f2da1a.tar.bz2 |
sandbox: Remove a TEXTREL on Linux ARM.
On Android, the sandbox logic is put into a shared library and the linker errors
out on having a TEXTREL.
The LDR pseudo-instruction directs the assembler to place the address of the
label in a "literal pool"[1], and then use a PC-relative load from that pool to
get the address during execution. The pool is responsible for generating
the R_ARM_RELATIVE TEXTREL.
Using the ADR instruction[2] does not produce the TEXTREL. This instruction
directs the assembler to calculate the PC-relative address to the label using an
immediate.
The text makes this difference more clear:
...
8: 4805 ldr r0, [pc, #20] ; (20 <SyscallAsm+0x20>)
a: e007 b.n 1c <SyscallAsm+0x1c>
...
1c: bd80 pop {r7, pc}
1e: 0000 .short 0x0000
20: 0000001c .word 0x0000001c
Versus:
...
8: 4804 ldr r0, [pc, #16] ; (1c <SyscallAsm+0x1c>)
a: e007 b.n 1c <SyscallAsm+0x1c>
...
1c: bd80 pop {r7, pc}
1e: bf00 nop
[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0041c/Babbfdih.html
[2] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0040d/Cihdhgbe.html
BUG=308763
Review URL: https://codereview.chromium.org/119453002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/linux/sandbox_linux.gypi | 5 | ||||
-rw-r--r-- | sandbox/linux/seccomp-bpf/syscall.cc | 2 |
2 files changed, 1 insertions, 6 deletions
diff --git a/sandbox/linux/sandbox_linux.gypi b/sandbox/linux/sandbox_linux.gypi index da77077..366e55a 100644 --- a/sandbox/linux/sandbox_linux.gypi +++ b/sandbox/linux/sandbox_linux.gypi @@ -77,11 +77,6 @@ 'dependencies': [ '../testing/android/native_test.gyp:native_test_native_code', ], - 'ldflags!': [ - # Remove warnings about text relocations, to prevent build - # failure. - '-Wl,--warn-shared-textrel' - ], }], ], }, diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc index 0b5cbcc..fd599e8 100644 --- a/sandbox/linux/seccomp-bpf/syscall.cc +++ b/sandbox/linux/seccomp-bpf/syscall.cc @@ -143,7 +143,7 @@ namespace sandbox { // used as a marker that BPF code inspects. "cmp r0, #0\n" "bge 1f\n" - "ldr r0, =2f\n" + "adr r0, 2f\n" "b 2f\n" // We declared (almost) all clobbered registers to the compiler. On // ARM there is no particular register pressure. So, we can go |