• Max Filippov's avatar
    xtensa: don't emit dynamic relocation for weak undefined symbol · 82f32155
    Max Filippov authored
    Resolved reference to a weak undefined symbol in PIE must not have
    a dynamic relative relocation against itself, otherwise the value of a
    reference will be changed from 0 to the base of executable, breaking
    code like the following:
    
      void weak_function (void);
      if (weak_function)
        weak_function ();
    
    This fixes tests for PR ld/22269 and a number of PIE tests in xtensa gcc
    testsuite.
    
    bfd/
    2018-07-11  Max Filippov  <jcmvbkbc@gmail.com>
    
    	* elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate
    	space for dynamic relocation for undefined weak symbol.
    	(elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE
    	relocation for undefined weak symbols.
    	(shrink_dynamic_reloc_sections): Don't shrink dynamic relocation
    	section for relocations against undefined weak symbols.
    
    (cherry picked from commit c451bb34ae8bd2d0669bd563366883cfbcf0de9b)
    82f32155
Name
Last commit
Last update
bfd Loading commit data...
binutils Loading commit data...
config Loading commit data...
cpu Loading commit data...
elfcpp Loading commit data...
etc Loading commit data...
gas Loading commit data...
gdb Loading commit data...
gold Loading commit data...
gprof Loading commit data...
include Loading commit data...
intl Loading commit data...
ld Loading commit data...
libdecnumber Loading commit data...
libiberty Loading commit data...
opcodes Loading commit data...
readline Loading commit data...
sim Loading commit data...
texinfo Loading commit data...
zlib Loading commit data...
.cvsignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
COPYING Loading commit data...
COPYING.LIB Loading commit data...
COPYING.LIBGLOSS Loading commit data...
COPYING.NEWLIB Loading commit data...
COPYING3 Loading commit data...
COPYING3.LIB Loading commit data...
ChangeLog Loading commit data...
MAINTAINERS Loading commit data...
Makefile.def Loading commit data...
Makefile.in Loading commit data...
Makefile.tpl Loading commit data...
README Loading commit data...
README-maintainer-mode Loading commit data...
ar-lib Loading commit data...
compile Loading commit data...
config-ml.in Loading commit data...
config.guess Loading commit data...
config.rpath Loading commit data...
config.sub Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...
depcomp Loading commit data...
djunpack.bat Loading commit data...
install-sh Loading commit data...
libtool.m4 Loading commit data...
ltgcc.m4 Loading commit data...
ltmain.sh Loading commit data...
ltoptions.m4 Loading commit data...
ltsugar.m4 Loading commit data...
ltversion.m4 Loading commit data...
lt~obsolete.m4 Loading commit data...
makefile.vms Loading commit data...
missing Loading commit data...
mkdep Loading commit data...
mkinstalldirs Loading commit data...
move-if-change Loading commit data...
setup.com Loading commit data...
src-release.sh Loading commit data...
symlink-tree Loading commit data...
test-driver Loading commit data...
ylwrap Loading commit data...