[PATCH] D101689: [X32][CET] Fix size and alignment of .note.gnu.property section
Harald van Dijk via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 1 14:10:52 PDT 2021
hvdijk updated this revision to Diff 342177.
hvdijk retitled this revision from "[X32][CET] Fix alignment of .note.gnu.property section" to "[X32][CET] Fix size and alignment of .note.gnu.property section".
hvdijk added a comment.
It wasn't just the alignment that was wrong, the section contains its own size as a field, which had an incorrect value as a result of the alignment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101689/new/
https://reviews.llvm.org/D101689
Files:
llvm/lib/Target/X86/X86AsmPrinter.cpp
llvm/test/CodeGen/X86/note-cet-property.ll
Index: llvm/test/CodeGen/X86/note-cet-property.ll
===================================================================
--- llvm/test/CodeGen/X86/note-cet-property.ll
+++ llvm/test/CodeGen/X86/note-cet-property.ll
@@ -1,5 +1,6 @@
; RUN: llc -mtriple i686-pc-linux < %s | FileCheck %s --check-prefix=X86
; RUN: llc -mtriple x86_64-pc-linux < %s | FileCheck %s --check-prefix=X86_64
+; RUN: llc -mtriple x86_64-pc-linux-gnux32 < %s | FileCheck %s --check-prefix=X86
; This test checks that the compiler emits a .note.gnu.property section for
; modules with "cf-protection" module flags.
Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
===================================================================
--- llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -643,7 +643,8 @@
OutStreamer->SwitchSection(Nt);
// Emitting note header.
- int WordSize = TT.isArch64Bit() ? 8 : 4;
+ const int WordSize =
+ TT.isArch64Bit() && TT.getEnvironment() != Triple::GNUX32 ? 8 : 4;
emitAlignment(WordSize == 4 ? Align(4) : Align(8));
OutStreamer->emitIntValue(4, 4 /*size*/); // data size for "GNU\0"
OutStreamer->emitIntValue(8 + WordSize, 4 /*size*/); // Elf_Prop size
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101689.342177.patch
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210501/bddf43b4/attachment.bin>
More information about the llvm-commits
mailing list