[all-commits] [llvm/llvm-project] 0ae799: [ELF][ARM] Support /DISCARD/ of subset of .ARM.exi...

Peter Smith via All-commits all-commits at lists.llvm.org
Mon May 11 06:29:41 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0ae7990b6071b941995183d872b928bba3a5d3b8
      https://github.com/llvm/llvm-project/commit/0ae7990b6071b941995183d872b928bba3a5d3b8
  Author: Peter Smith <peter.smith at arm.com>
  Date:   2020-05-11 (Mon, 11 May 2020)

  Changed paths:
    M lld/ELF/LinkerScript.cpp
    M lld/ELF/LinkerScript.h
    M lld/ELF/SyntheticSections.cpp
    A lld/test/ELF/arm-exidx-partial-discard-exidx.s

  Log Message:
  -----------
  [ELF][ARM] Support /DISCARD/ of subset of .ARM.exidx sections

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

Differential Revision: https://reviews.llvm.org/D79687




More information about the All-commits mailing list