[all-commits] [llvm/llvm-project] c88b53: Target: Stop assigning RELRO sections to .ldata.re...

Peter Collingbourne via All-commits all-commits at lists.llvm.org
Tue Apr 29 12:41:04 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c88b53777130a80ac08f39166c487ea7bb721441
      https://github.com/llvm/llvm-project/commit/c88b53777130a80ac08f39166c487ea7bb721441
  Author: Peter Collingbourne <peter at pcc.me.uk>
  Date:   2025-04-29 (Tue, 29 Apr 2025)

  Changed paths:
    M llvm/lib/Target/TargetMachine.cpp
    M llvm/test/CodeGen/X86/code-model-elf-sections.ll
    M llvm/test/CodeGen/X86/code-model-elf.ll

  Log Message:
  -----------
  Target: Stop assigning RELRO sections to .ldata.rel.ro.

Linkers do not currently support PT_GNU_RELRO for SHF_X86_64_LARGE
sections; that would require the linker to emit more than one
PT_GNU_RELRO because large sections are discontiguous by design,
and most ELF dynamic loaders do not support that (bionic appears to
support it but glibc/musl/FreeBSD/NetBSD/OpenBSD appear not to). With
current linkers these sections will end up in .ldata which results
in silently disabling RELRO. Therefore, disable SHF_X86_64_LARGE for
RELRO sections. If this ever gets supported by downstream components
in the future we could add an opt-in flag for moving these sections
to .ldata.rel.ro which would trigger the creation of a second
PT_GNU_RELRO.

Reviewers: MaskRay, aeubanks

Reviewed By: aeubanks

Pull Request: https://github.com/llvm/llvm-project/pull/137742



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