[all-commits] [llvm/llvm-project] 7a2000: [LLD][ARM] Handle .ARM.exidx sections at non-zero ...

Peter Smith via All-commits all-commits at lists.llvm.org
Fri Apr 14 02:12:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7a2000ac5301dbdef8c3495fbeb49cab4ac439cb
      https://github.com/llvm/llvm-project/commit/7a2000ac5301dbdef8c3495fbeb49cab4ac439cb
  Author: Peter Smith <peter.smith at arm.com>
  Date:   2023-04-14 (Fri, 14 Apr 2023)

  Changed paths:
    M lld/ELF/SyntheticSections.cpp
    M lld/ELF/Writer.cpp
    M lld/docs/ReleaseNotes.rst
    A lld/test/ELF/arm-exidx-nonzero-offset.s

  Log Message:
  -----------
  [LLD][ARM] Handle .ARM.exidx sections at non-zero output sec offset

Embedded systems that do not use an ELF loader locate the
.ARM.exidx exception table via linker defined __exidx_start and
__exidx_end rather than use the PT_ARM_EXIDX program header. This
means that some linker scripts such as the picolibc C library's
linker script, do not have the .ARM.exidx sections at offset 0 in
the OutputSection. For example:

.except_unordered : {
    . = ALIGN(8);
    PROVIDE(__exidx_start = .);
    *(.ARM.exidx*)
    PROVIDE(__exidx_end = .);
} >flash AT>flash :text

This is within the specification of Arm exception tables, and is
handled correctly by ld.bfd.

This patch has 2 parts. The first updates the writing of the data
of the .ARM.exidx SyntheticSection to account for a non-zero
OutputSection offset. The second part makes the PT_ARM_EXIDX program
header generation a special case so that it covers only the
SyntheticSection and not the parent OutputSection. While not strictly
necessary for programs locating the exception tables via the symbols
it may cause ELF utilities that locate the exception tables via
the PT_ARM_EXIDX program header to fail. This does not seem to be the
case for GNU and LLVM readelf which seems to look for the
SHT_ARM_EXIDX section.

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




More information about the All-commits mailing list