[PATCH] D136203: [ARM] Support -mexecute-only with -mlong-calls.

Zhiyao Ma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 18:34:17 PDT 2022


ZhiyaoMa98 added a comment.

Unfortunately, `-fPIE` seems not to be generating the PLT on LLVM for embedded ARM.

C source file (test.c):

  extern void bar(void);
  void foo(void) {
      bar();
  }

LLVM with `clang -O2 -fPIE -fsemantic-interposition -mlong-calls --target=armv7em-none-eabi -c test.c`:

  00000000 <foo>:
     0:   4800            ldr     r0, [pc, #0]    ; (4 <foo+0x4>)
     2:   4700            bx      r0
     4:   00000000        .word   0x00000000

ARM GNU with `arm-none-eabi-gcc -O2 -fPIE -mlong-calls -msingle-pic-base -mcpu=cortex-m4 -c test.c`:

  00000000 <foo>:
     0:   4b01            ldr     r3, [pc, #4]    ; (8 <foo+0x8>)
     2:   f859 3003       ldr.w   r3, [r9, r3]
     6:   4718            bx      r3
     8:   00000000        .word   0x00000000


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136203/new/

https://reviews.llvm.org/D136203



More information about the cfe-commits mailing list