[lld] r337256 - [ELF] - Check we able to report function symbols that encloses a location in error messages.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 02:37:53 PDT 2018


Author: grimar
Date: Tue Jul 17 02:37:53 2018
New Revision: 337256

URL: http://llvm.org/viewvc/llvm-project?rev=337256&view=rev
Log:
[ELF] - Check we able to report function symbols that encloses a location in error messages.

InputSectionBase::getLocation() have the following block of the code which
is uncovered by our test cases:
https://github.com/llvm-mirror/lld/blob/master/ELF/InputSection.cpp#L238

Patch adds a test to trigger this branch.

Added:
    lld/trunk/test/ELF/x86-64-reloc-error2.s

Added: lld/trunk/test/ELF/x86-64-reloc-error2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-error2.s?rev=337256&view=auto
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-error2.s (added)
+++ lld/trunk/test/ELF/x86-64-reloc-error2.s Tue Jul 17 02:37:53 2018
@@ -0,0 +1,14 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
+
+## Check we are able to find a function symbol that encloses
+## a given location when reporting error messages.
+# CHECK: {{.*}}.o:(function func): relocation R_X86_64_32S out of range: -281474974609408 is not in [-2147483648, 2147483647]
+
+.section .text.func, "ax", %progbits
+.globl func
+.type func, at function
+.size func, 0x10
+func:
+ movq func - 0x1000000000000, %rdx




More information about the llvm-commits mailing list