[PATCH] D56080: update the pr_datasz of .note.gnu.property section

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 26 00:50:32 PST 2018


xiangzhangllvm created this revision.
xiangzhangllvm added reviewers: hjl.tools, LuoYuanke, craig.topper.
Herald added a subscriber: llvm-commits.

System V Application Binary Interface
Linux Extensions
Version 0.1
Edited by
H.J. Lu1
September 18, 2018
.note.gnu.property
The program property array
Each array element represents one program property with type, data size and data.
In 64-bit objects, each element is an array of 8-byte integers in the format of the
target processor. In 32-bit objects, each element is an array of 4-byte integers in
the format of the target processor. An array element has the following structure:
typedef struct {
Elf_Word pr_type;
Elf_Word pr_datasz;
unsigned char pr_data[PR_DATASZ];
unsigned char pr_padding[PR_PADDING];
} Elf_Prop;
pr_type The type of program property. A 4-byte integer in the format of the
target processor.
pr_datasz The size of the pr_data field. A 4-byte integer in the format of the
target processor.
pr_data The program property descriptor which is aligned to 4 bytes in 32-bit
objects and 8 bytes in 64-bit objects.
pr_padding The padding. If necessary, it aligns the array element to 8 or 4-byte
alignment (depending on whether the file is a 64-bit or 32-bit object).
PR_DATASZ The value in the pr_datasz field. A constant.
PR_PADDING The size of the pr_padding field. A constant.


Repository:
  rL LLVM

https://reviews.llvm.org/D56080

Files:
  lib/Target/X86/X86AsmPrinter.cpp
  test/CodeGen/X86/note-cet-property.ll


Index: test/CodeGen/X86/note-cet-property.ll
===================================================================
--- test/CodeGen/X86/note-cet-property.ll
+++ test/CodeGen/X86/note-cet-property.ll
@@ -22,7 +22,7 @@
 ; X86_64-NEXT: .long    5
 ; X86_64-NEXT: .asciz   "GNU"
 ; X86_64-NEXT: .long    3221225474
-; X86_64-NEXT: .long    8
+; X86_64-NEXT: .long    4
 ; X86_64-NEXT: .quad    3
 ; X86_64-NEXT: .p2align 3
 
Index: lib/Target/X86/X86AsmPrinter.cpp
===================================================================
--- lib/Target/X86/X86AsmPrinter.cpp
+++ lib/Target/X86/X86AsmPrinter.cpp
@@ -572,7 +572,7 @@
 
       // Emitting an Elf_Prop for the CET properties.
       OutStreamer->EmitIntValue(ELF::GNU_PROPERTY_X86_FEATURE_1_AND, 4);
-      OutStreamer->EmitIntValue(WordSize, 4);               // data size
+      OutStreamer->EmitIntValue(4, 4);               // data size
       OutStreamer->EmitIntValue(FeatureFlagsAnd, WordSize); // data
       EmitAlignment(WordSize == 4 ? 2 : 3);                 // padding
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56080.179501.patch
Type: text/x-patch
Size: 1036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181226/8c18bdc5/attachment.bin>


More information about the llvm-commits mailing list