[llvm] [BOLT] Retain certain local symbols (PR #184074)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 08:54:43 PST 2026


nikic wrote:

Full objdump output in the failing environment:
```
Disassembly of section .text:

0000000000800000 <_init>:
  800000: d503233f      paciasp
  800004: a9bf7bfd      stp     x29, x30, [sp, #-0x10]!
  800008: 910003fd      mov     x29, sp
  80000c: 97f00173      bl      0x4005d8 <call_weak_fn>
  800010: a8c17bfd      ldp     x29, x30, [sp], #0x10
  800014: d50323bf      autiasp
  800018: d65f03c0      ret

000000000080001c <_start>:
  80001c: d503245f      bti     c
  800020: d280001d      mov     x29, #0x0               // =0
  800024: d280001e      mov     x30, #0x0               // =0
  800028: aa0003e5      mov     x5, x0
  80002c: f94003e1      ldr     x1, [sp]
  800030: 910023e2      add     x2, sp, #0x8
  800034: 910003e6      mov     x6, sp
  800038: 90000000      adrp    x0, 0x800000 <_init>
  80003c: 91014000      add     x0, x0, #0x50
  800040: d2800003      mov     x3, #0x0                // =0
  800044: d2800004      mov     x4, #0x0                // =0
  800048: 97f00136      bl      0x400520 <__libc_start_main at plt>
  80004c: 97f00139      bl      0x400530 <abort at plt>

0000000000800050 <__wrap_main>:
  800050: d503245f      bti     c
  800054: 17f001ae      b       0x40070c <main>
```

`objdump -t` for the symbol is:
```
00000000004005b4 l       .text  0000000000000000              __wrap_main
```
So it seems to be indeed a local zero-size symbol. It's coming from crt1.o.

Looks like the reason we're using crt1.o instead of Scrt1.o is `-DCLANG_DEFAULT_PIE_ON_LINUX=OFF`.

Adding `-pie` to the `%clangxx` invocation fixes the test.


https://github.com/llvm/llvm-project/pull/184074


More information about the llvm-commits mailing list