[llvm] a699921 - [MC,x86-32] Remove a gold<2.34 workaround
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 13:44:19 PDT 2023
Author: Fangrui Song
Date: 2023-06-22T13:44:15-07:00
New Revision: a699921baa91e6c2979ec0f0482430c57f51761d
URL: https://github.com/llvm/llvm-project/commit/a699921baa91e6c2979ec0f0482430c57f51761d
DIFF: https://github.com/llvm/llvm-project/commit/a699921baa91e6c2979ec0f0482430c57f51761d.diff
LOG: [MC,x86-32] Remove a gold<2.34 workaround
This workaround appears to apply with gold<2.34 -O2/-O3 (linker -O2, not
compiler driver -O2). This used to be more visible as we used -Wl,-O3 in
CMake, but the option is generally not recommended and has been removed
by d63016a86548e8231002a760bbe9eb817cd1eb00 (Dec 2021).
This finishes a workaround removal work started by D64327 (2019).
Link: https://github.com/llvm/llvm-project/issues/45269
Added:
Modified:
llvm/lib/MC/ELFObjectWriter.cpp
llvm/test/MC/ELF/relocation-386.s
Removed:
################################################################################
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index ea2091dffe8b3..00f6f0c091327 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -1385,12 +1385,6 @@ bool ELFObjectWriter::shouldRelocateWithSymbol(const MCAssembler &Asm,
if (C != 0)
return true;
- // gold<2.34 incorrectly ignored the addend for R_386_GOTOFF (9)
- // (http://sourceware.org/PR16794).
- if (TargetObjectWriter->getEMachine() == ELF::EM_386 &&
- Type == ELF::R_386_GOTOFF)
- return true;
-
// ld.lld handles R_MIPS_HI16/R_MIPS_LO16 separately, not as a whole, so
// it doesn't know that an R_MIPS_HI16 with implicit addend 1 and an
// R_MIPS_LO16 with implicit addend -32768 represents 32768, which is in
diff --git a/llvm/test/MC/ELF/relocation-386.s b/llvm/test/MC/ELF/relocation-386.s
index e49b25a25ce53..dbabbe6d190d5 100644
--- a/llvm/test/MC/ELF/relocation-386.s
+++ b/llvm/test/MC/ELF/relocation-386.s
@@ -10,7 +10,7 @@
// CHECK-NEXT: Section {{.*}} .rel.text {
/// Do not use STT_SECTION symbol for R_386_GOTOFF to work around a gold<2.34 bug
/// https://sourceware.org/bugzilla/show_bug.cgi?id=16794
-// I386-NEXT: 0x2 R_386_GOTOFF .Lfoo
+// I386-NEXT: 0x2 R_386_GOTOFF .rodata.str1.1
// IAMCU-NEXT: 0x2 R_386_GOTOFF .rodata.str1.1
// CHECK-NEXT: 0x{{[^ ]+}} R_386_PLT32 bar2
// CHECK-NEXT: 0x{{[^ ]+}} R_386_GOTPC _GLOBAL_OFFSET_TABLE_
More information about the llvm-commits
mailing list