[all-commits] [llvm/llvm-project] aaa931: [ARM] Exclude TLS symbols from the .reloc/R_ARM_RE...

dong jianqiang via All-commits all-commits at lists.llvm.org
Thu Jul 30 23:57:42 PDT 2026


  Branch: refs/heads/release/23.x
  Home:   https://github.com/llvm/llvm-project
  Commit: aaa931e5edae052b04334c54119f4c7fc4e53509
      https://github.com/llvm/llvm-project/commit/aaa931e5edae052b04334c54119f4c7fc4e53509
  Author: dong jianqiang <dongjianqiang2 at huawei.com>
  Date:   2026-07-31 (Fri, 31 Jul 2026)

  Changed paths:
    M llvm/lib/Target/ARM/ARMAsmPrinter.cpp
    M llvm/test/CodeGen/ARM/elf-preemption.ll

  Log Message:
  -----------
  [ARM] Exclude TLS symbols from the .reloc/R_ARM_REL32 path (#212549)

The .reloc branch in emitMachineConstantPoolValue fired for any
isWeakForLinker() + isDSOLocal() symbol, including TLS (thread_local)
weak symbols. R_ARM_REL32 is wrong for TLS: TLS symbols need
TLS-specific relocations (R_ARM_TLS_GD32 etc.). Using R_ARM_REL32 for a
TLS symbol produces a wrong address at runtime.

This broke the 2-stage ARM 32-bit buildbots: stage 1 (with the .reloc
branch) miscompiled stage 2's BPF codegen (BTFDebug.cpp references
llvm::sys::sandbox::Enabled, an inline thread_local weak variable),
causing a SIGSEGV in the BPF Assembly Printer.

Add a regression test (tls_weak_var in elf-preemption.ll) verifying that
TLS weak symbols get TLSGD/TPOFF, not R_ARM_REL32.

Fix #212545

(cherry picked from commit f4382bedc245a22ea7c354d08eb13543166a5f0d)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list