[lld] r324264 - Change the default of --apply-dynamic-relocs.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 11:39:04 PST 2018


Author: rafael
Date: Mon Feb  5 11:39:04 2018
New Revision: 324264

URL: http://llvm.org/viewvc/llvm-project?rev=324264&view=rev
Log:
Change the default of --apply-dynamic-relocs.

When using Elf_Rela every tool should use the addend in the
relocation.

We have --apply-dynamic-relocs to work around bugs in tools that don't
do that.

The default value of --apply-dynamic-relocs should be false to make
sure these bugs are more easily found in the future.

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/test/ELF/dynamic-got-rela.s
    lld/trunk/test/ELF/relocation-non-alloc.s

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=324264&r1=324263&r2=324264&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Mon Feb  5 11:39:04 2018
@@ -598,7 +598,7 @@ void LinkerDriver::readConfigs(opt::Inpu
   Config->AllowMultipleDefinition =
       Args.hasArg(OPT_allow_multiple_definition) || hasZOption(Args, "muldefs");
   Config->ApplyDynamicRelocs = Args.hasFlag(OPT_apply_dynamic_relocs,
-                                            OPT_no_apply_dynamic_relocs, true);
+                                            OPT_no_apply_dynamic_relocs, false);
   Config->AuxiliaryList = args::getStrings(Args, OPT_auxiliary);
   Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic);
   Config->BsymbolicFunctions = Args.hasArg(OPT_Bsymbolic_functions);

Modified: lld/trunk/test/ELF/dynamic-got-rela.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynamic-got-rela.s?rev=324264&r1=324263&r2=324264&view=diff
==============================================================================
--- lld/trunk/test/ELF/dynamic-got-rela.s (original)
+++ lld/trunk/test/ELF/dynamic-got-rela.s Mon Feb  5 11:39:04 2018
@@ -1,7 +1,9 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: ld.lld %t.o -o %t.so -shared
+// RUN: ld.lld %t.o -o %t.so -shared --apply-dynamic-relocs
 // RUN: llvm-readobj -r -s -l -section-data %t.so | FileCheck -check-prefix CHECK -check-prefix APPLYDYNREL %s
+// RUN: ld.lld %t.o -o %t2.so -shared
+// RUN: llvm-readobj -r -s -l -section-data %t2.so | FileCheck -check-prefix CHECK -check-prefix NOAPPLYDYNREL %s
 // RUN: ld.lld %t.o -o %t2.so -shared --no-apply-dynamic-relocs
 // RUN: llvm-readobj -r -s -l -section-data %t2.so | FileCheck -check-prefix CHECK -check-prefix NOAPPLYDYNREL %s
 

Modified: lld/trunk/test/ELF/relocation-non-alloc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-non-alloc.s?rev=324264&r1=324263&r2=324264&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocation-non-alloc.s (original)
+++ lld/trunk/test/ELF/relocation-non-alloc.s Mon Feb  5 11:39:04 2018
@@ -1,9 +1,11 @@
 // REQUIRES: x86
 
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
-// RUN: ld.lld %t -o %t2 -shared
+// RUN: ld.lld %t -o %t2 -shared --apply-dynamic-relocs
 // RUN: llvm-readobj -s -section-data -r %t2 | FileCheck -check-prefix CHECK -check-prefix APPLYDYNREL %s
 
+// RUN: ld.lld %t -o %t2 -shared
+// RUN: llvm-readobj -s -section-data -r %t2 | FileCheck -check-prefix CHECK -check-prefix NOAPPLYDYNREL %s
 // RUN: ld.lld %t -o %t2 -shared --no-apply-dynamic-relocs
 // RUN: llvm-readobj -s -section-data -r %t2 | FileCheck -check-prefix CHECK -check-prefix NOAPPLYDYNREL %s
 




More information about the llvm-commits mailing list