[PATCH] D79687: [LLD][ELF][ARM] Support /DISCARD/ of subset of .ARM.exidx sections

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 10 04:15:35 PDT 2020


psmith created this revision.
psmith added reviewers: MaskRay, grimar, ruiu.
Herald added subscribers: danielkiss, kristof.beyls, arichardson, emaste.
Herald added a reviewer: espindola.

Both the .ARM.exidx and .eh_frame sections have a custom SyntheticSection that acts as a container for the InputSections. The InputSections are added to the SyntheticSection prior to /DISCARD/ which limits the affect a /DISCARD/ can have to the whole SyntheticSection. In the majority of cases this is sufficient as it is not common to discard subsets of the InputSections. The Linux kernel has one of these scripts which has something like:

  /DISCARD/ : { *(.ARM.exidx.exit.text) *(.ARM.extab.exit.text) ... }

The .ARM.exidx.exit.text are not discarded because the InputSection has been transferred to the Synthetic Section. The *(.ARM.extab.exit.text) sections have not so they are discarded. When we come to write out the .ARM.exidx sections the dangling references from .ARM.exidx.exit.text to .ARM.extab.exit.text currently cause relocation out of range errors, but could as easily cause a fatal error message if we check for dangling references at relocation time.

This patch attempts to respect the /DISCARD/ command by running it on the .ARM.exidx InputSections stored in the SyntheticSection.

The .eh_frame is in theory affected by this problem, but I don't think that there is a dangling reference problem that can happen with these sections.

Fixes remaining part of pr44824 (https://bugs.llvm.org/show_bug.cgi?id=44824)


https://reviews.llvm.org/D79687

Files:
  lld/ELF/LinkerScript.cpp
  lld/ELF/LinkerScript.h
  lld/ELF/SyntheticSections.cpp
  lld/test/ELF/arm-exidx-partial-discard-exidx.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79687.263064.patch
Type: text/x-patch
Size: 5338 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200510/e9ec8642/attachment.bin>


More information about the llvm-commits mailing list