[llvm] r366686 - Reland [ELF] Loose a condition for relocation with a symbol
Nikola Prica via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 06:07:01 PDT 2019
Author: nikolaprica
Date: Mon Jul 22 06:07:01 2019
New Revision: 366686
URL: http://llvm.org/viewvc/llvm-project?rev=366686&view=rev
Log:
Reland [ELF] Loose a condition for relocation with a symbol
This patch was not the reason of the buildbot failure.
Deleted code was introduced as a work around for a bug in the gold linker
(http://sourceware.org/PR16794). Test case that was given as a reason for
this part of code, the one on previous link, now works for the gold.
This condition is too strict and when a code is compiled with debug info
it forces generation of numerous relocations with symbol for architectures
that do not have relocation addend.
Reviewers: arsenm, espindola
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D64327
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/test/MC/ELF/basic-elf-32.s
llvm/trunk/test/MC/ELF/compression.s
llvm/trunk/test/MC/ELF/relocation-386.s
llvm/trunk/test/MC/Mips/elf-relsym.s
llvm/trunk/test/MC/Mips/xgot.s
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=366686&r1=366685&r2=366686&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Jul 22 06:07:01 2019
@@ -1396,11 +1396,6 @@ bool ELFObjectWriter::shouldRelocateWith
if (Flags & ELF::SHF_MERGE) {
if (C != 0)
return true;
-
- // It looks like gold has a bug (http://sourceware.org/PR16794) and can
- // only handle section relocations to mergeable sections if using RELA.
- if (!hasRelocationAddend())
- return true;
}
// Most TLS relocations use a got, so they need the symbol. Even those that
Modified: llvm/trunk/test/MC/ELF/basic-elf-32.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/basic-elf-32.s?rev=366686&r1=366685&r2=366686&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/basic-elf-32.s (original)
+++ llvm/trunk/test/MC/ELF/basic-elf-32.s Mon Jul 22 06:07:01 2019
@@ -46,9 +46,9 @@ main:
// CHECK: Relocations [
// CHECK: Section {{.*}} .rel.text {
-// CHECK: 0x6 R_386_32 .L.str1
+// CHECK: 0x6 R_386_32 .rodata.str1.1 0x0
// CHECK: 0xB R_386_PC32 puts
-// CHECK: 0x12 R_386_32 .L.str2
+// CHECK: 0x12 R_386_32 .rodata.str1.1 0x0
// CHECK: 0x17 R_386_PC32 puts
// CHECK: }
// CHECK: ]
Modified: llvm/trunk/test/MC/ELF/compression.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/compression.s?rev=366686&r1=366685&r2=366686&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/compression.s (original)
+++ llvm/trunk/test/MC/ELF/compression.s Mon Jul 22 06:07:01 2019
@@ -38,7 +38,7 @@
// In x86 32 bit named symbols are used for temporary symbols in merge
// sections, so make sure we handle symbols inside compressed sections
-// 386-SYMBOLS-GNU: Name: .Linfo_string0
+// 386-SYMBOLS-GNU: Name: .zdebug_str
// 386-SYMBOLS-GNU-NOT: }
// 386-SYMBOLS-GNU: Section: .zdebug_str
@@ -73,7 +73,7 @@
// ZLIB-STYLE-FLAGS32-NEXT: AddressAlignment: 4
// ZLIB-STYLE-FLAGS64-NEXT: AddressAlignment: 8
-// 386-SYMBOLS-ZLIB: Name: .Linfo_string0
+// 386-SYMBOLS-ZLIB: Name: .debug_str
// 386-SYMBOLS-ZLIB-NOT: }
// 386-SYMBOLS-ZLIB: Section: .debug_str
Modified: llvm/trunk/test/MC/ELF/relocation-386.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/relocation-386.s?rev=366686&r1=366685&r2=366686&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/relocation-386.s (original)
+++ llvm/trunk/test/MC/ELF/relocation-386.s Mon Jul 22 06:07:01 2019
@@ -8,7 +8,7 @@
// I386: Format: ELF32-i386
// CHECK: Relocations [
// CHECK-NEXT: Section {{.*}} .rel.text {
-// CHECK-NEXT: 0x2 R_386_GOTOFF .Lfoo 0x0
+// CHECK-NEXT: 0x2 R_386_GOTOFF .rodata.str1.16 0x0
// CHECK-NEXT: 0x{{[^ ]+}} R_386_PLT32 bar2 0x0
// CHECK-NEXT: 0x{{[^ ]+}} R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0
// Relocation 3 (bar3 at GOTOFF) is done with symbol 7 (bss)
Modified: llvm/trunk/test/MC/Mips/elf-relsym.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/elf-relsym.s?rev=366686&r1=366685&r2=366686&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/elf-relsym.s (original)
+++ llvm/trunk/test/MC/Mips/elf-relsym.s Mon Jul 22 06:07:01 2019
@@ -4,16 +4,10 @@
// CHECK: Symbols [
// CHECK: Symbol {
-// CHECK: Name: $.str
+// CHECK: Name: .rodata.cst8
// CHECK: }
// CHECK: Symbol {
-// CHECK: Name: $.str1
-// CHECK: }
-// CHECK: Symbol {
-// CHECK: Name: $CPI0_0
-// CHECK: }
-// CHECK: Symbol {
-// CHECK: Name: $CPI0_1
+// CHECK: Name: .rodata.str1.1
// CHECK: }
// CHECK: ]
Modified: llvm/trunk/test/MC/Mips/xgot.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/xgot.s?rev=366686&r1=366685&r2=366686&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/xgot.s (original)
+++ llvm/trunk/test/MC/Mips/xgot.s Mon Jul 22 06:07:01 2019
@@ -10,8 +10,8 @@
// CHECK: 0x1C R_MIPS_GOT_LO16 ext_1
// CHECK: 0x24 R_MIPS_CALL_HI16 printf
// CHECK: 0x30 R_MIPS_CALL_LO16 printf
-// CHECK: 0x2C R_MIPS_GOT16 $.str
-// CHECK: 0x38 R_MIPS_LO16 $.str
+// CHECK: 0x2C R_MIPS_GOT16 .rodata.str1.1 0x0
+// CHECK: 0x38 R_MIPS_LO16 .rodata.str1.1 0x0
// CHECK: ]
.text
More information about the llvm-commits
mailing list