[llvm] [AArch64][ELF] Section alignment of 4 for AArch64 instruction (PR #114031)
Florin Popa via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 04:15:25 PDT 2024
================
@@ -697,6 +697,15 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
getContext().getELFSection(SectionName, Type, Flags, Size, GroupName,
IsComdat, UniqueID, LinkedToSym);
getStreamer().switchSection(Section, Subsection);
+
+ // Section alignment of 4 if an AArch64 instruction is used when $x mapping
+ // symbol is added Match GNU Assembler
+ const Triple &TT = getContext().getTargetTriple();
+ if ((Section->getFlags() & ELF::SHF_EXECINSTR) && (TT.isAArch64())) {
+ if (Section->getAlign() < 4)
+ getStreamer().emitValueToAlignment(Align(4));
+ }
----------------
popaflorin wrote:
I have moved the logic into `MCStreamer::changeSection` of the AArch64ELFStreamer as suggested
https://github.com/llvm/llvm-project/pull/114031
More information about the llvm-commits
mailing list