From d476528e3d5a1b062f7fea67d61d173bbdeefc33 Mon Sep 17 00:00:00 2001 From: Shankar Easwaran Date: Fri, 1 Feb 2013 18:03:32 +0000 Subject: [PATCH] add alignment to .got/.got.plt/.plt sections & fix tests llvm-svn: 174199 --- lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp | 5 +++++ lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetInfo.cpp | 10 ++++++++++ lld/test/elf/ifunc.test | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp b/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp index b6a57bc..f1debcc 100644 --- a/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp +++ b/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp @@ -134,6 +134,11 @@ public: virtual ContentPermissions permissions() const { return permRW_; } + virtual Alignment alignment() const { + // Needs 8 byte alignment + return Alignment(3); + } + virtual ArrayRef rawContent() const { return ArrayRef(); } diff --git a/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetInfo.cpp b/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetInfo.cpp index ead1277..7a3e0ca 100644 --- a/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetInfo.cpp +++ b/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetInfo.cpp @@ -48,6 +48,11 @@ public: return ArrayRef(_defaultContent, 8); } + virtual Alignment alignment() const { + // The alignment should be 8 byte aligned + return Alignment(3); + } + #ifndef NDEBUG virtual StringRef name() const { return _name; } @@ -84,6 +89,11 @@ public: return ArrayRef(_defaultContent, 16); } + virtual Alignment alignment() const { + // The alignment should be 4 byte aligned + return Alignment(2); + } + #ifndef NDEBUG virtual StringRef name() const { return _name; } diff --git a/lld/test/elf/ifunc.test b/lld/test/elf/ifunc.test index e1a5d7b..a53a5b5 100644 --- a/lld/test/elf/ifunc.test +++ b/lld/test/elf/ifunc.test @@ -5,7 +5,7 @@ RUN: lld -core -target x86_64-linux -emit-yaml -output=- %p/Inputs/ifunc.x86-64 RUN: %p/Inputs/ifunc.cpp.x86-64 | FileCheck %s --check-prefix=PLT RUN: lld -core -target x86_64-linux -output=%t %p/Inputs/ifunc.x86-64 \ -RUN: %p/Inputs/ifunc.cpp.x86-64 && llvm-objdump -d %t| FileCheck %s \ +RUN: -noinhibit-exec %p/Inputs/ifunc.cpp.x86-64 && llvm-objdump -d -s %t| FileCheck %s \ RUN: --check-prefix=BIN CHECK: name: hey @@ -33,6 +33,6 @@ PLT: kind: R_X86_64_PC32 // This is a horribly brittle test. We need a way to do arithmetic on captured // variables. -BIN: 400136: ff 25 c4 0e 00 00 jumpq *3780(%rip) +BIN: 40011c: ff 25 de 0e 00 00 jmpq *3806(%rip) BIN: .got.plt: BIN-NEXT: 401000 00000000 00000000 -- 2.7.4