[lld] r327963 - [ELF] - Add test case for "unsupported relocation reference" error. NFCI.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 20 02:49:03 PDT 2018


Author: grimar
Date: Tue Mar 20 02:49:03 2018
New Revision: 327963

URL: http://llvm.org/viewvc/llvm-project?rev=327963&view=rev
Log:
[ELF] - Add test case for "unsupported relocation reference" error. NFCI.

We do not have test showing we explicitly reject objects
where relocation section goes before the target, i.e
.rel[a].text is listed before .text, for example.
The patch adds it.

Added:
    lld/trunk/test/ELF/invalid/reloc-section-reordered.test

Added: lld/trunk/test/ELF/invalid/reloc-section-reordered.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/reloc-section-reordered.test?rev=327963&view=auto
==============================================================================
--- lld/trunk/test/ELF/invalid/reloc-section-reordered.test (added)
+++ lld/trunk/test/ELF/invalid/reloc-section-reordered.test Tue Mar 20 02:49:03 2018
@@ -0,0 +1,30 @@
+# REQUIRES: x86
+
+# RUN: yaml2obj %s -o %t.o
+# RUN: not ld.lld %t.o -o %t.exe 2>&1 | FileCheck %s
+# CHECK: unsupported relocation reference
+
+## YAML below lists .rela.text before .text, we do not support it.
+
+!ELF
+FileHeader:
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  OSABI:           ELFOSABI_FREEBSD
+  Type:            ET_REL
+  Machine:         EM_X86_64
+Sections:
+  - Type:            SHT_REL
+    Name:            .rela.text
+    Link:            .symtab
+    Info:            .text
+    AddressAlign:    0x04
+    Relocations:
+      - Offset:          0
+        Symbol:          .text
+        Type:            R_X86_64_NONE
+  - Type:            SHT_PROGBITS
+    Name:            .text
+    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+    AddressAlign:    0x04
+    Content:         "FFFFFFFFFFFFFFFF"




More information about the llvm-commits mailing list