[lld] r362207 - [ELF][test] Restore linkerscript/symbol-location.s to test getLinkerScriptLocation()

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 01:20:43 PDT 2019


Author: maskray
Date: Fri May 31 01:20:43 2019
New Revision: 362207

URL: http://llvm.org/viewvc/llvm-project?rev=362207&view=rev
Log:
[ELF][test] Restore linkerscript/symbol-location.s to test getLinkerScriptLocation()

The test (the only test that checks getLinkerScriptLocation()) deleted
by r358652 can be restored by replacing R_X86_64_PLT32 with
R_X86_64_PC32, and changing -pie to -shared (preemptable). Then, the
symbol will not be a link-time constant and a -fPIC error will be
issued.

Added:
    lld/trunk/test/ELF/linkerscript/symbol-location.s

Added: lld/trunk/test/ELF/linkerscript/symbol-location.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/symbol-location.s?rev=362207&view=auto
==============================================================================
--- lld/trunk/test/ELF/linkerscript/symbol-location.s (added)
+++ lld/trunk/test/ELF/linkerscript/symbol-location.s Fri May 31 01:20:43 2019
@@ -0,0 +1,16 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: echo 'foo = _start;' > %t.script
+# RUN: not ld.lld -shared -T %t.script %t.o -o /dev/null 2>&1 | FileCheck %s
+
+## Here we check that symbol 'foo' location is reported properly.
+
+# CHECK: error: relocation R_X86_64_PC32 cannot be used against symbol foo
+# CHECK: >>> defined in {{.*}}.script:1
+# CHECK: >>> referenced by {{.*}}.o:(.text+0x1)
+
+.text
+.globl _start
+_start:
+  .byte 0xe8
+  .long foo - .




More information about the llvm-commits mailing list