[lld] r272305 - Use errorDynRel like every other target.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 01:32:34 PDT 2016


>Author: rafael
>Date: Thu Jun  9 15:42:04 2016
>New Revision: 272305
>
>URL: http://llvm.org/viewvc/llvm-project?rev=272305&view=rev
>Log:
>Use errorDynRel like every other target.
>
>Modified:
>    lld/trunk/ELF/Target.cpp
>    lld/trunk/test/ELF/x86-64-dyn-rel-error.s
>    lld/trunk/test/ELF/x86-64-dyn-rel-error2.s
>
>Modified: lld/trunk/ELF/Target.cpp
>URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=272305&r1=272304&r2=272305&view=diff
>==============================================================================
>--- lld/trunk/ELF/Target.cpp (original)
>+++ lld/trunk/ELF/Target.cpp Thu Jun  9 15:42:04 2016
>@@ -618,7 +618,7 @@ void X86_64TargetInfo::writePlt(uint8_t
>
> uint32_t X86_64TargetInfo::getDynRel(uint32_t Type) const {
>   if (Type == R_X86_64_PC32 || Type == R_X86_64_32)
>-    error(getRelName(Type) + " cannot be a dynamic relocation");
>+    errorDynRel(Type);
>   return Type;
> }

So, after this change + r272303 ("Also reject 32 bit dynamic relocs when producing executable."),
error message says "cannot be used when making a shared object", but for example
x86-64-dyn-rel-error.s does not link DSO, it links executable and error message looks confusing.

Shouldn't  we change the part saying we making shared object to something about that relocations
against shared symbol can't be one of these ?

>Modified: lld/trunk/test/ELF/x86-64-dyn-rel-error.s
>URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-dyn-rel-error.s?rev=272305&r1=272304&r2=272305&view=diff
>==============================================================================
>--- lld/trunk/test/ELF/x86-64-dyn-rel-error.s (original)
>+++ lld/trunk/test/ELF/x86-64-dyn-rel-error.s Thu Jun  9 15:42:04 2016
>@@ -9,4 +9,4 @@ _start:
>         .data
>         .long bar
>
>-// CHECK: R_X86_64_32 cannot be a dynamic relocation
>+// CHECK: R_X86_64_32 cannot be used when making a shared object; recompile with -fPIC.
>
>Modified: lld/trunk/test/ELF/x86-64-dyn-rel-error2.s
>URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-dyn-rel-error2.s?rev=272305&r1=272304&r2=272305&view=diff
>==============================================================================
>--- lld/trunk/test/ELF/x86-64-dyn-rel-error2.s (original)
>+++ lld/trunk/test/ELF/x86-64-dyn-rel-error2.s Thu Jun  9 15:42:04 2016
>@@ -9,4 +9,4 @@ _start:
>         .data
>         .long bar - .
>
>-// CHECK: R_X86_64_PC32 cannot be a dynamic relocation
>+// CHECK: R_X86_64_PC32 cannot be used when making a shared object; recompile with -fPIC.

George.


More information about the llvm-commits mailing list