]> sourceware.org Git - glibc.git/commit
sh: Fix building with gcc5/6
authorAlexey Neyman <stilor@att.net>
Wed, 8 Feb 2017 18:00:57 +0000 (16:00 -0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Sun, 12 Mar 2017 20:29:32 +0000 (17:29 -0300)
commitd40dbe722f004f999b589de776f7e57e564dda01
tree51eb85e0bdbb58f11d0275b58e7e46b6303ba065
parentcb09a3d49742aa4b8e541334e2e49e8cb9b652e2
sh: Fix building with gcc5/6

Build glibc for sh4-unknown-linux-gnu currently fails if one's
using GCC5/6: in dl-conflict.c, the elf_machine_rela() function
is called with NULL as its 3rd argument, sym. The implementation
of that function in sysdeps/sh/dl-machine.h dereferences that pointer:

const Elf32_Sym *const refsym = sym;
...
if (map == &GL(dl_rtld_map))
  value -= map->l_addr + refsym->st_value + reloc->r_addend;

GCC discovers a null pointer dereference, and in accordance with
-fdelete-null-pointer-checks (which is enabled in -O2) replaces this
code with a trap - which, as SH does not implement a trap pattern in
GCC, evaluates to an abort() call. This abort() call pulls many more
objects from libc_nonshared.a, eventually resulting in link failure
due to multiple definitions for a number of symbols.

As far as I see, the conditional before this code is always false in
rtld: _dl_resolve_conflicts() is called with main_map as the first
argument, not GL(_dl_rtld_map), but since that call is in yet another
compilation unit, GCC does not know about it. Patch that wraps this
conditional into !defined RESOLVE_CONFLICT_FIND_MAP attached.

* sysdeps/sh/dl-machine.h (elf_machine_rela): The condition
in R_SH_DIR32 case is always false when inlined from
dl-conflict.c. Ifdef out to prevent GCC from insertin an
abort() call.
ChangeLog
sysdeps/sh/dl-machine.h
This page took 0.038296 seconds and 5 git commands to generate.