[PATCH] D124656: [ELF] Support custom sections before DATA_SEGMENT_RELRO_END

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 22:40:56 PDT 2022


MaskRay created this revision.
MaskRay added a reviewer: peter.smith.
Herald added subscribers: StephenFan, arichardson, emaste.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We currently hard code RELRO sections. When a custom section is between
DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END, we may report a spurious
`error: section: ... is not contiguous with other relro sections`. GNU ld
makes such sections RELRO.

glibc recently switched to default --with-default-link=no. This configuration
places `__libc_atexit` and others between DATA_SEGMENT_ALIGN and
DATA_SEGMENT_RELRO_END. This patch will fix its lld build.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124656

Files:
  lld/ELF/OutputSections.h
  lld/ELF/ScriptParser.cpp
  lld/ELF/Writer.cpp
  lld/test/ELF/linkerscript/data-segment-relro.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124656.425973.patch
Type: text/x-patch
Size: 4489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220429/570d7336/attachment.bin>


More information about the llvm-commits mailing list