bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/23850] GNU strip should not discard/move .rela.plt in exec


From: maskray at google dot com
Subject: [Bug binutils/23850] GNU strip should not discard/move .rela.plt in executable linking glibc statically
Date: Fri, 02 Nov 2018 02:11:05 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23850

--- Comment #3 from Fangrui Song <maskray at google dot com> ---
(In reply to Alan Modra from comment #2)
> .rela.plt in a static executable can only contain IRELATIVE relocations that
> must have a zero symbol index.  Thus it is not necessary for that particular
> SHT_RELA section to have sh_link index .symtab.  As you recognize, it is
> also inconsistent to have a SHF_ALLOC SHT_RELA section sh_link point at a
> non-SHF_ALLOC symbol table.  You should probably report this problem as an
> lld bug.
> 
> That said, objcopy can be fixed without too much trouble, I think.

I've fixed that lld bug https://reviews.llvm.org/D53993

  InputSection *SymTab = Config->Relocatable ? In.SymTab : In.DynSymTab;
  getParent()->Link = SymTab ? SymTab->getParent()->SectionIndex : 0;

Do you think if readelf -S should be taught not to warn in this case? This was
the original motivation that sh_link pointed to .symtab

% readelf -S a
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
readelf: Warning: [ 1]: Link field (0) should index a symtab section.
  [ 1] .rela.plt         RELA            0000000000200238 000238 000108 18   A 
0  20  8

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]