Skip to content

Commit

Permalink
[MC,x86-32] Remove a gold<2.34 workaround
Browse files Browse the repository at this point in the history
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 d63016a (Dec 2021).

This finishes a workaround removal work started by D64327 (2019).

Link: #45269
  • Loading branch information
MaskRay committed Jun 22, 2023
1 parent 213709e commit a699921
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions llvm/lib/MC/ELFObjectWriter.cpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/MC/ELF/relocation-386.s
Expand Up @@ -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

This comment has been minimized.

Copy link
@arichardson

arichardson Jun 23, 2023

Member

This comment now seems incorrect?

/// 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_
Expand Down

0 comments on commit a699921

Please sign in to comment.