Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22091

clang/ARM assembly - Misinterpreted absolute branch

$
0
0

I am working on a project where code is linked into an existing, statically linked binary. Thus code like this with absolute branches is necessary:

.arm.globl TestThunk    TestThunk:    mov     r0, #0    b       0x01001234

gcc output:

00000000 <TestThunk>:   0:   e3a00000    mov r0, #0   4:   eafffffe    b   1001234 <*ABS*0x1001234>

with

arm-none-eabi-gcc -march=armv6k -mtune=mpcore -x assembler-with-cpp -c test.s -o test_gcc.o

clang output:

00000000 <TestThunk>:   0:   e3a00000    mov r0, #0   4:   ea40048d    b   1001240 <TestThunk+0x1001240>

with

clang --target=armv6k-none-eabihf -mcpu=mpcore -mtune=mpcore -x assembler-with-cpp -c test.s -o test_clang.o

As you can see gcc emits an absolute relocation, just like I want.clang though emits a relocation relative to the object file itself, which is wrong.

Can I force clang to emit absolute relocations as well with specific compiler flags or assembler directives?

I am aware that I can create a linker script with symbols for the existing binary, but I don't want to do that for my existing code base.


Viewing all articles
Browse latest Browse all 22091

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>