[PATCH] D70962: [LLD][ELF][AArch64] .note.gnu.property sections should have alignment 8

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 09:37:31 PST 2019


MaskRay added a comment.

> [LLD][ELF][AArch64] .note.gnu.property sections should have alignment 8

Mention x86-64 or just delete [AArch64]. I think all 64-bit architectures use 8 (though currently only x86-64 and AArch64 define architecture specific GNU_PROPERTY_*). The code in binutils-gdb is architecture-agnostic `bfd/elf-properties.c:_bfd_elf_convert_gnu_properties`

  bed = get_elf_backend_data (obfd);
  align_shift = bed->s->elfclass == ELFCLASS64 ? 3 : 2;
  
  /* Get the output .note.gnu.property section size.  */
  size = bfd_section_size (isec->output_section);
  
  /* Update the output .note.gnu.property section alignment.  */
  bfd_set_section_alignment (isec->output_section, align_shift);



================
Comment at: lld/ELF/SyntheticSections.cpp:302
+    : SyntheticSection(llvm::ELF::SHF_ALLOC, llvm::ELF::SHT_NOTE,
+                       config->is64 ? 8 : 4, ".note.gnu.property") {}
 
----------------
`config->wordsize`


================
Comment at: lld/test/ELF/aarch64-pt-gnu-property.s:19
 # CHECK-NEXT:     Info: 0
-# CHECK-NEXT:     AddressAlignment: 4
+# CHECK-NEXT:     AddressAlignment: 8
 
----------------
grimar wrote:
> Do we have a test for `!config->is64`?
A `!config->is64` test will need `GNU_PROPERTY_X86_*` on EM_386. There is no `GNU_PROPERTY_ARM_*`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70962/new/

https://reviews.llvm.org/D70962





More information about the llvm-commits mailing list