aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2013-05-10 16:00:11 -0700
committerDerek Schuff <dschuff@chromium.org>2013-05-10 16:00:11 -0700
commit52daf9d821c963f84dd312ff90921bfe1b1cc0a1 (patch)
tree8f94ccf4841f2a0bbfdb19bf3b230f7ad220e8ff /test
parent42ac59f56fb0d473f84b6be738a64e80b09557d1 (diff)
LLVM: Add ELF Note section to NaCl object files identifying them as such to gold
This is needed to switch the native linker to one based on upstream binutils 2.23 R=mseaborn@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=2971 also related to bug https://code.google.com/p/nativeclient/issues/detail?id=3424 Review URL: https://codereview.chromium.org/15067009
Diffstat (limited to 'test')
-rw-r--r--test/MC/ARM/elf-note-nacl.ll22
-rw-r--r--test/MC/Mips/elf-note-nacl.ll22
-rw-r--r--test/MC/X86/elf-note-nacl.ll36
3 files changed, 80 insertions, 0 deletions
diff --git a/test/MC/ARM/elf-note-nacl.ll b/test/MC/ARM/elf-note-nacl.ll
new file mode 100644
index 0000000000..8551cf52b4
--- /dev/null
+++ b/test/MC/ARM/elf-note-nacl.ll
@@ -0,0 +1,22 @@
+; RUN: llc -filetype=obj -mtriple armv7-none-nacl-gnueabi %s -o - \
+; RUN: | llvm-objdump -triple armv7 -s - | FileCheck %s
+
+; Tests that NaCl object files contain an ELF note section that identifies them
+; to the binutils gold linker
+
+define void @main() {
+ ret void
+}
+
+; There appears to be no way for llvm-objdump to show flags for sections, or
+; to dump groups like readelf.
+; CHECK: .group
+; CHECK: .note.NaCl.ABI.arm
+; The contents of the words in the note section should be:
+; sizeof "NaCl"
+; sizeof "arm"
+; 1 (NT_VERSION)
+; "NaCl" with nul termination and padding to align 4
+; "arm" with nul termination and padding to align 4
+; CHECK-NEXT: 0000 05000000 04000000 01000000 4e61436c
+; CHECK-NEXT: 0010 00000000 61726d00
diff --git a/test/MC/Mips/elf-note-nacl.ll b/test/MC/Mips/elf-note-nacl.ll
new file mode 100644
index 0000000000..0361eff25e
--- /dev/null
+++ b/test/MC/Mips/elf-note-nacl.ll
@@ -0,0 +1,22 @@
+; RUN: llc -filetype=obj -mtriple mipsel-none-nacl %s -o - \
+; RUN: | llvm-objdump -triple mipsel -s - | FileCheck %s
+
+; Tests that NaCl object files contain an ELF note section that identifies them
+; to the binutils gold linker
+
+define void @main() {
+ ret void
+}
+
+; There appears to be no way for llvm-objdump to show flags for sections, or
+; to dump groups like readelf.
+; CHECK: .group
+; CHECK: .note.NaCl.ABI.mipsel
+; The contents of the words in the note section should be:
+; sizeof "NaCl"
+; sizeof "mipsel"
+; 1 (NT_VERSION)
+; "NaCl" with nul termination and padding to align 4
+; "mipsel" with nul termination and padding to align 4
+; CHECK-NEXT: 0000 05000000 07000000 01000000 4e61436c
+; CHECK-NEXT: 0010 00000000 6d697073 656c0000
diff --git a/test/MC/X86/elf-note-nacl.ll b/test/MC/X86/elf-note-nacl.ll
new file mode 100644
index 0000000000..ce15455c84
--- /dev/null
+++ b/test/MC/X86/elf-note-nacl.ll
@@ -0,0 +1,36 @@
+; RUN: llc -filetype=obj -mtriple i686-none-nacl %s -o - \
+; RUN: | llvm-objdump -triple i686 -s - | FileCheck --check-prefix=I386 %s
+
+; RUN: llc -filetype=obj -mtriple x86_64-none-nacl %s -o - \
+; RUN: | llvm-objdump -triple x86_64 -s - | FileCheck --check-prefix=X8664 %s
+
+; Tests that NaCl object files contain an ELF note section that identifies them
+; to the binutils gold linker
+
+define void @main() {
+ ret void
+}
+
+; There appears to be no way for llvm-objdump to show flags for sections, or
+; to dump groups like readelf.
+; I386: .group
+; I386: .note.NaCl.ABI.x86-32
+; The contents of the words in the note section should be:
+; sizeof "NaCl"
+; sizeof "x86-32"
+; 1 (NT_VERSION)
+; "NaCl" with nul termination and padding to align 4
+; "x86-32" with nul termination and padding to align 4
+; I386-NEXT: 0000 05000000 07000000 01000000 4e61436c
+; I386-NEXT: 0010 00000000 7838362d 33320000
+
+; X8664: .group
+; X8664: .note.NaCl.ABI.x86-64
+; The contents of the words in the note section should be:
+; sizeof "NaCl"
+; sizeof "x86-64"
+; 1 (NT_VERSION)
+; "NaCl" with nul termination and padding to align 4
+; q"x86-64" with nul termination and padding to align 4
+; X8664-NEXT: 0000 05000000 07000000 01000000 4e61436c
+; X8664-NEXT: 0010 00000000 7838362d 36340000