[PATCH] D76410: [ELF] Don't combine SHF_LINK_ORDER sections linking different output sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 18 23:19:31 PDT 2020


MaskRay created this revision.
MaskRay added reviewers: grimar, jhenderson, psmith, ruiu.
Herald added subscribers: llvm-commits, danielkiss, kristof.beyls, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay added a parent revision: D76409: [ELF][test] Improve arm-exidx-output.s to test different output text sections.

This generalizes D68094 <https://reviews.llvm.org/D68094> (relocatable link) to non-relocatable links.

clang -fstack-size-section produces .stack_sizes sections with the same name, say

sh_link(.stack_sizes[1]) = .text.f1
sh_link(.stack_sizes[2]) = .text.f2

If .text.f1 and .text.f2 and placed in different output sections, we
currently produce one output .stack_sizes with the sh_link field
arbitrarily set to the output section index of first input .stack_sizes section.
This causes the problem as described in https://bugs.llvm.org/show_bug.cgi?id=45228

One solution is not to combine SHF_LINK_ORDER sections linking different
output sections. The idea is similar to D66717 <https://reviews.llvm.org/D66717> (do not ICF two sections
with different output sections).

Note, .ARM.exidx (singleton synthetic section) is not affected by this change.
D76409 <https://reviews.llvm.org/D76409> improved the test.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76410

Files:
  lld/ELF/LinkerScript.cpp
  lld/test/ELF/linkorder-output-section.s
  lld/test/ELF/partition-move-to-main-startstop.s
  lld/test/ELF/relocatable-linkorder.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76410.251277.patch
Type: text/x-patch
Size: 4921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200319/f701073f/attachment.bin>


More information about the llvm-commits mailing list