[all-commits] [llvm/llvm-project] 4ef560: [ELF] Handle .init_array prefix consistently

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jan 4 00:45:56 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ef560ec6026a2cef71748852c68cd4a79c0ac0a
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-01-04 (Tue, 04 Jan 2022)

  Changed paths:
    M llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    M llvm/test/CodeGen/X86/attribute-sections.ll

  Log Message:
  [ELF] Handle .init_array prefix consistently

Currently, the code in TargetLoweringObjectFile only assigns
@init_array section type to plain .init_array sections, but not
prioritized sections like .init_array.00001.

This is inconsistent with the interpretation in the AsmParser
(see https://github.com/llvm/llvm-project/blob/791523bae6153b13bb41ba05c9fc89e502cc4a1a/llvm/lib/MC/MCParser/ELFAsmParser.cpp#L621-L632)
and upcoming expectations in LLD
(see https://github.com/rust-lang/rust/issues/92181 for context).

This patch assigns @init_array section type to all sections with an
.init_array prefix. The same is done for .fini_array and
.preinit_array as well. With that, the logic matches the AsmParser.

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

More information about the All-commits mailing list