Skip to content

AArch32 port in assembler does not handle PC offset, causing CREL issues #141678

Open
@aeubanks

Description

@aeubanks
$ cat /tmp/a.cc
void f();

int main() {
        try {
                f();
        } catch (...) {
                return 1;
        }
        return 0;
}
# sysroot required for the following, reproducers attached below
$ clang++ -O2 -shared -o /tmp/nocrel.so /tmp/a.cc -fuse-ld=lld --target=arm-linux-androideabi26
$ clang++ -O2 -shared -o /tmp/crel.so /tmp/a.cc -fuse-ld=lld --target=arm-linux-androideabi26 -Wa,--crel,--allow-experimental-crel
$ llvm-objdump --disassemble /tmp/nocrel.so  > /tmp/nocrel.s
$ llvm-objdump --disassemble /tmp/crel.so  > /tmp/crel.s
$ diff /tmp/nocrel.s /tmp/crel.s
43c43
<      6b4: eb000025            bl      0x750 <_Z1fv@plt>       @ imm = #0x94
---
>      6b4: eb000027            bl      0x758 <_Z1fv@plt+0x8>   @ imm = #0x9c
47,48c47,48
<      6c4: eb000025            bl      0x760 <__cxa_begin_catch@plt> @ imm = #0x94
<      6c8: eb000028            bl      0x770 <__cxa_end_catch@plt> @ imm = #0xa0
---
>      6c4: eb000027            bl      0x768 <__cxa_begin_catch@plt+0x8> @ imm = #0x9c
>      6c8: eb00002a            bl      0x778 <__cxa_end_catch@plt+0x8> @ imm = #0xa8

reproducers

@MaskRay

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions