Message ID | 20180728162144.16552-1-slyfox@inbox.ru |
---|---|
State | New |
Headers | show |
Series | libgcc: m68k: avoid TEXTRELs in shared library (PR 86224) | expand |
On Jul 28 2018, slyfox@inbox.ru wrote: > From: Sergei Trofimovich <slyfox@gentoo.org> > > Cc: Ian Lance Taylor <ian@airs.com> > Cc: Jeff Law <law@redhat.com> > Cc: Andreas Schwab <schwab@linux-m68k.org> > Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> > --- > libgcc/config/m68k/lb1sf68.S | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S > index 325a7c17d9b..16c6dc3f5a7 100644 > --- a/libgcc/config/m68k/lb1sf68.S > +++ b/libgcc/config/m68k/lb1sf68.S > @@ -435,7 +435,10 @@ $_exception_handler: > .text > FUNC(__mulsi3) > .globl SYM (__mulsi3) > + .globl SYM (__mulsi3_internal) > + .hidden SYM (__mulsi3_internal) No need for extra entry symbols, just mark the real entry point as hidden, like in the static library. Andreas.
On Sat, Jul 28, 2018 at 08:47:33PM +0200, Andreas Schwab wrote: > On Jul 28 2018, slyfox@inbox.ru wrote: > > > From: Sergei Trofimovich <slyfox@gentoo.org> > > > > Cc: Ian Lance Taylor <ian@airs.com> > > Cc: Jeff Law <law@redhat.com> > > Cc: Andreas Schwab <schwab@linux-m68k.org> > > Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> > > --- > > libgcc/config/m68k/lb1sf68.S | 19 ++++++++++++++----- > > 1 file changed, 14 insertions(+), 5 deletions(-) > > > > diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S > > index 325a7c17d9b..16c6dc3f5a7 100644 > > --- a/libgcc/config/m68k/lb1sf68.S > > +++ b/libgcc/config/m68k/lb1sf68.S > > @@ -435,7 +435,10 @@ $_exception_handler: > > .text > > FUNC(__mulsi3) > > .globl SYM (__mulsi3) > > + .globl SYM (__mulsi3_internal) > > + .hidden SYM (__mulsi3_internal) > > No need for extra entry symbols, just mark the real entry point as > hidden, like in the static library. That's clearly not correct or valid, as these are public interfaces. If you make them hidden they'll be dropped from the dynamic symbol table of libgcc_s.so. Of course for libgcc.a they need to be hidden (it's an ABI bug if they're not hidden there already but I think there's a separate layer of the build system that forces them to be hidden). Rich
On Sat, 28 Jul 2018 21:11:22 -0400 Rich Felker <dalias@libc.org> wrote: > On Sat, Jul 28, 2018 at 08:47:33PM +0200, Andreas Schwab wrote: > > On Jul 28 2018, slyfox@inbox.ru wrote: > > > > > From: Sergei Trofimovich <slyfox@gentoo.org> > > > > > > Cc: Ian Lance Taylor <ian@airs.com> > > > Cc: Jeff Law <law@redhat.com> > > > Cc: Andreas Schwab <schwab@linux-m68k.org> > > > Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> > > > --- > > > libgcc/config/m68k/lb1sf68.S | 19 ++++++++++++++----- > > > 1 file changed, 14 insertions(+), 5 deletions(-) > > > > > > diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S > > > index 325a7c17d9b..16c6dc3f5a7 100644 > > > --- a/libgcc/config/m68k/lb1sf68.S > > > +++ b/libgcc/config/m68k/lb1sf68.S > > > @@ -435,7 +435,10 @@ $_exception_handler: > > > .text > > > FUNC(__mulsi3) > > > .globl SYM (__mulsi3) > > > + .globl SYM (__mulsi3_internal) > > > + .hidden SYM (__mulsi3_internal) > > > > No need for extra entry symbols, just mark the real entry point as > > hidden, like in the static library. > > That's clearly not correct or valid, as these are public interfaces. > If you make them hidden they'll be dropped from the dynamic symbol > table of libgcc_s.so. > > Of course for libgcc.a they need to be hidden (it's an ABI bug if > they're not hidden there already but I think there's a separate layer > of the build system that forces them to be hidden). > > Rich Oh, that's a good point! gcc/doc/libgcc.texi also suggests __<symbols> is the libgcc_s API. Would it make sense for gcc/doc/libgcc.texi to be expanded to more explicitly articulate expectation of symbol visibility on ELF platforms?
diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S index 325a7c17d9b..16c6dc3f5a7 100644 --- a/libgcc/config/m68k/lb1sf68.S +++ b/libgcc/config/m68k/lb1sf68.S @@ -435,7 +435,10 @@ $_exception_handler: .text FUNC(__mulsi3) .globl SYM (__mulsi3) + .globl SYM (__mulsi3_internal) + .hidden SYM (__mulsi3_internal) SYM (__mulsi3): +SYM (__mulsi3_internal): movew sp@(4), d0 /* x0 -> d0 */ muluw sp@(10), d0 /* x0*y1 */ movew sp@(6), d1 /* x1 -> d1 */ @@ -458,7 +461,10 @@ SYM (__mulsi3): .text FUNC(__udivsi3) .globl SYM (__udivsi3) + .globl SYM (__udivsi3_internal) + .hidden SYM (__udivsi3_internal) SYM (__udivsi3): +SYM (__udivsi3_internal): #ifndef __mcoldfire__ movel d2, sp@- movel sp@(12), d1 /* d1 = divisor */ @@ -534,7 +540,10 @@ L2: subql IMM (1),d4 .text FUNC(__divsi3) .globl SYM (__divsi3) + .globl SYM (__divsi3_internal) + .hidden SYM (__divsi3_internal) SYM (__divsi3): +SYM (__divsi3_internal): movel d2, sp@- moveq IMM (1), d2 /* sign of result stored in d2 (=1 or =-1) */ @@ -557,7 +566,7 @@ L1: movel sp@(8), d0 /* d0 = dividend */ L2: movel d1, sp@- movel d0, sp@- - PICCALL SYM (__udivsi3) /* divide abs(dividend) by abs(divisor) */ + PICCALL SYM (__udivsi3_internal) /* divide abs(dividend) by abs(divisor) */ addql IMM (8), sp tstb d2 @@ -577,13 +586,13 @@ SYM (__umodsi3): movel sp@(4), d0 /* d0 = dividend */ movel d1, sp@- movel d0, sp@- - PICCALL SYM (__udivsi3) + PICCALL SYM (__udivsi3_internal) addql IMM (8), sp movel sp@(8), d1 /* d1 = divisor */ #ifndef __mcoldfire__ movel d1, sp@- movel d0, sp@- - PICCALL SYM (__mulsi3) /* d0 = (a/b)*b */ + PICCALL SYM (__mulsi3_internal) /* d0 = (a/b)*b */ addql IMM (8), sp #else mulsl d1,d0 @@ -603,13 +612,13 @@ SYM (__modsi3): movel sp@(4), d0 /* d0 = dividend */ movel d1, sp@- movel d0, sp@- - PICCALL SYM (__divsi3) + PICCALL SYM (__divsi3_internal) addql IMM (8), sp movel sp@(8), d1 /* d1 = divisor */ #ifndef __mcoldfire__ movel d1, sp@- movel d0, sp@- - PICCALL SYM (__mulsi3) /* d0 = (a/b)*b */ + PICCALL SYM (__mulsi3_internal) /* d0 = (a/b)*b */ addql IMM (8), sp #else mulsl d1,d0