[llvm] Reland "[ObjectYAML][ELF] Take alignment into account when generating notes" (PR #118434)
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 16:43:59 PST 2024
================
@@ -1810,7 +1810,7 @@ void ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader,
break;
default:
reportError(Section.Name + ": invalid alignment for a note section: 0x" +
- Twine::utohexstr(SHeader.sh_addralign));
+ Twine::utohexstr(Section.AddressAlign));
----------------
igorkudrin wrote:
Well, `overrideFields()` is called after `writeSectionContent()`, so even if there are different values in `ShAddrAlign` and `AddressAlign` properties, `writeSectionContent()` will still see the same value in `Section.AddressAlign` and `SHeader.sh_addralign`, taken from `AddressAlign`. Nevertheless, I've added a new test for this scenario. It even shows that you can generate a note section with an invalid alignment without triggering an error, as long as an expected alignment is specified in the `AddressAlign` property.
https://github.com/llvm/llvm-project/pull/118434
More information about the llvm-commits
mailing list