diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-03-16 09:15:57 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2017-04-06 15:14:44 -0300 |
commit | bdc543e338281da051b3dc06eae96c330a485ce6 (patch) | |
tree | e4735c7a00f75d884c119f786ac968bd62525047 /sysdeps | |
parent | db3d848e154b00071f4a5e729d5884efad410109 (diff) | |
download | glibc-bdc543e338281da051b3dc06eae96c330a485ce6.zip glibc-bdc543e338281da051b3dc06eae96c330a485ce6.tar.gz glibc-bdc543e338281da051b3dc06eae96c330a485ce6.tar.bz2 |
sparc: Fix .udiv plt on libc
With the removal of divdi3 object from sparcv9-linux-gnu build, its
definition came from libgcc and its functions internall calls .udiv.
Since glibc also exports these symbols for compatibility reasons, it
will end up creating PLT calls internally in libc.so.
To avoid it, this patch uses the linker option --wrap to replace all
the internal libc.so .udiv calls to the wrapper __wrap_.udiv. Along
with strong alias in the udiv implementations, it makes linker do
local calls.
Checked on sparcv9-linux-gnu.
* sysdeps/sparc/sparc32/Makefile (libc.so-gnulib): New rule.
* sysdeps/sparc/sparc32/sparcv8/udiv.S (.udiv): Make a strong_alias
to __wrap_.udiv.
* sysdeps/sparc/sparc32/sparcv9/udiv.S (.udiv): Likewise.
* sysdeps/sparc/sparc32/udiv.S (.udiv): Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/sparc/sparc32/Makefile | 6 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/sparcv8/udiv.S | 1 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/sparcv9/udiv.S | 1 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/udiv.S | 1 |
4 files changed, 9 insertions, 0 deletions
diff --git a/sysdeps/sparc/sparc32/Makefile b/sysdeps/sparc/sparc32/Makefile index da20589..14d6e03 100644 --- a/sysdeps/sparc/sparc32/Makefile +++ b/sysdeps/sparc/sparc32/Makefile @@ -47,3 +47,9 @@ $(divrem:%=$(sysdep_dir)/sparc/sparc32/%.S): $(sysdep_dir)/sparc/sparc32/divrem. mv -f $@-tmp $@ sysdep-realclean := $(sysdep-realclean) $(divrem:%=sysdeps/sparc/sparc32/%.S) + +# libgcc __divdi3 and __moddi3 uses .udiv and since it is also exported by +# libc.so linker will create PLTs for the symbol. To avoid it we strong alias +# the exported libc one to __wrap_.udiv and use linker option --wrap to make any +# call to .udiv to call the wrapper symbol. +libc.so-gnulib += -Wl,--wrap=.udiv diff --git a/sysdeps/sparc/sparc32/sparcv8/udiv.S b/sysdeps/sparc/sparc32/sparcv8/udiv.S index d719543..e9cab4e 100644 --- a/sysdeps/sparc/sparc32/sparcv8/udiv.S +++ b/sysdeps/sparc/sparc32/sparcv8/udiv.S @@ -13,3 +13,4 @@ ENTRY(.udiv) udiv %o0, %o1, %o0 END(.udiv) +strong_alias (.udiv, __wrap_.udiv) diff --git a/sysdeps/sparc/sparc32/sparcv9/udiv.S b/sysdeps/sparc/sparc32/sparcv9/udiv.S index de79899..368f85e 100644 --- a/sysdeps/sparc/sparc32/sparcv9/udiv.S +++ b/sysdeps/sparc/sparc32/sparcv9/udiv.S @@ -15,3 +15,4 @@ ENTRY(.udiv) udiv %o0, %o1, %o0 END(.udiv) +strong_alias (.udiv, __wrap_.udiv) diff --git a/sysdeps/sparc/sparc32/udiv.S b/sysdeps/sparc/sparc32/udiv.S index 8dfff66..ade0afd 100644 --- a/sysdeps/sparc/sparc32/udiv.S +++ b/sysdeps/sparc/sparc32/udiv.S @@ -344,3 +344,4 @@ LOC(got_result): mov %o2, %o0 END(.udiv) +strong_alias (.udiv, __wrap_.udiv) |