[PATCH 0/3] PR ld/21375: MIPS: Fix non-zero run-time value for undefined weaks

Maciej W. Rozycki macro@mips.com
Tue Jul 17 17:49:00 GMT 2018


Hi,

 This patch series addresses the MIPS backend issue observed with PR 
ld/21375 where undefined hidden and internal weak symbols have a non-zero 
run-time value in shared libraries and PIE executables in references that 
go via the GOT (i.e. code rather than data references).  This is because 
GOT entries associated with such symbols are assigned to the local part of 
the GOT, which at load time is implicitly relocated by the base address.  
Data references are unaffected because the relevant R_MIPS_32 or R_MIPS_64 
relocation is fully resolved (to 0) at link time.

 The issue does not currently trigger in PIE executables for undefined 
weak symbols that have the default or protected export class, because we 
always export such symbols, due to problems with `--no-export-dynamic' 
(covered by PR ld/21805) and `-z nodynamic-undefined-weak' options.  This 
issue does not trigger in regular executables, because the value of 0 
stored in the GOT entry referred by the static linker does not change at 
load time.

 Three patches are included, a preparatory change to factor out a piece of 
code that now will be used in a few places rather than just one, the 
actual fix for PR ld/21375 with the necessary adjustments to the test 
suite and a set of new test cases to cover various link scenarios the 
updated code has to work with, split off due to their size.  See 
individual change descriptions for further details.

 This has been regression-tested with my usual MIPS targets.  I will leave 
these changes waiting for 24 hours before I commit them, and will be happy 
to accept feedback during that time.

  Maciej



More information about the Binutils mailing list