[lld] r316961 - Give .note.gnu.build-id section alignment 4
Jake Ehrlich via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 30 15:08:11 PDT 2017
Author: jakehehrlich
Date: Mon Oct 30 15:08:11 2017
New Revision: 316961
URL: http://llvm.org/viewvc/llvm-project?rev=316961&view=rev
Log:
Give .note.gnu.build-id section alignment 4
All SHT_NOTE sections should have minimum alignment 4.
Differential Revision: https://reviews.llvm.org/D38907
Modified:
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/test/ELF/build-id.s
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=316961&r1=316960&r2=316961&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Mon Oct 30 15:08:11 2017
@@ -322,7 +322,7 @@ static size_t getHashSize() {
}
BuildIdSection::BuildIdSection()
- : SyntheticSection(SHF_ALLOC, SHT_NOTE, 1, ".note.gnu.build-id"),
+ : SyntheticSection(SHF_ALLOC, SHT_NOTE, 4, ".note.gnu.build-id"),
HashSize(getHashSize()) {}
void BuildIdSection::writeTo(uint8_t *Buf) {
Modified: lld/trunk/test/ELF/build-id.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/build-id.s?rev=316961&r1=316960&r2=316961&view=diff
==============================================================================
--- lld/trunk/test/ELF/build-id.s (original)
+++ lld/trunk/test/ELF/build-id.s Mon Oct 30 15:08:11 2017
@@ -2,6 +2,9 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: ld.lld --build-id %t -o %t2
+# RUN: llvm-readobj -s %t2 | FileCheck -check-prefix=ALIGN %s
+
# RUN: ld.lld --build-id %t -o %t2 -threads
# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=DEFAULT %s
# RUN: ld.lld --build-id %t -o %t2 -no-threads
@@ -45,18 +48,30 @@ _start:
.section .note.test, "a", @note
.quad 42
+# ALIGN: Name: .note.gnu.build-id
+# ALIGN-NEXT: Type: SHT_NOTE
+# ALIGN-NEXT: Flags [
+# ALIGN-NEXT: SHF_ALLOC
+# ALIGN-NEXT: ]
+# ALIGN-NEXT: Address:
+# ALIGN-NEXT: Offset: [[_:0x[0-9A-Z]*(0|4|8|C)$]]
+# ALIGN-NEXT: Size:
+# ALIGN-NEXT: Link:
+# ALIGN-NEXT: Info:
+# ALIGN-NEXT: AddressAlignment: 4
+
# DEFAULT: Contents of section .note.test:
# DEFAULT: Contents of section .note.gnu.build-id:
# DEFAULT-NEXT: 04000000 08000000 03000000 474e5500 ............GNU.
-# DEFAULT-NEXT: bc208f98 7f8e4770
+# DEFAULT-NEXT: 1950bcad 6ffba153
# MD5: Contents of section .note.gnu.build-id:
# MD5-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.
-# MD5-NEXT: 8e13f077 f9c94068 9d63c715 6c952cd3
+# MD5-NEXT: 6560b957 58afb40a 70f61d5a 7d76104e
# SHA1: Contents of section .note.gnu.build-id:
# SHA1-NEXT: 04000000 14000000 03000000 474e5500 ............GNU.
-# SHA1-NEXT: 754ac1ea 0a2e5144 0f4642b9 3f096bbb
+# SHA1-NEXT: c41b2962 9fd0d863 0a35299a 746a626f
# UUID: Contents of section .note.gnu.build-id:
# UUID-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.
More information about the llvm-commits
mailing list