[v2] libgcc: m68k: avoid TEXTRELs in shared library (PR 86224)

Message ID 20180728194202.25174-1-slyfox@inbox.ru
State New
Headers show
Series
  • [v2] libgcc: m68k: avoid TEXTRELs in shared library (PR 86224)
Related show

Commit Message

David Malcolm via Gcc-patches July 28, 2018, 7:42 p.m.
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 | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.18.0

Comments

David Malcolm via Gcc-patches Sept. 17, 2018, 9:18 p.m. | #1
On Sat, 28 Jul 2018 20:42:02 +0100
"slyfox.inbox.ru via gcc-patches" <gcc-patches@gcc.gnu.org> 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 | 3 +++

>  1 file changed, 3 insertions(+)

> 

> diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S

> index 325a7c17d9b..d5240d4aa55 100644

> --- a/libgcc/config/m68k/lb1sf68.S

> +++ b/libgcc/config/m68k/lb1sf68.S

> @@ -435,6 +435,7 @@ $_exception_handler:

>  	.text

>  	FUNC(__mulsi3)

>  	.globl	SYM (__mulsi3)

> +	.hidden	SYM (__mulsi3)

>  SYM (__mulsi3):

>  	movew	sp@(4), d0	/* x0 -> d0 */

>  	muluw	sp@(10), d0	/* x0*y1 */

> @@ -458,6 +459,7 @@ SYM (__mulsi3):

>  	.text

>  	FUNC(__udivsi3)

>  	.globl	SYM (__udivsi3)

> +	.hidden	SYM (__udivsi3)

>  SYM (__udivsi3):

>  #ifndef __mcoldfire__

>  	movel	d2, sp@-

> @@ -534,6 +536,7 @@ L2:	subql	IMM (1),d4

>  	.text

>  	FUNC(__divsi3)

>  	.globl	SYM (__divsi3)

> +	.hidden	SYM (__divsi3)

>  SYM (__divsi3):

>  	movel	d2, sp@-

>  

> -- 

> 2.18.0

> 


Patch ping. Not sure which is preferable v1 (as other targets do) or v2.

-- 

  Sergei
Jeff Law Sept. 17, 2018, 9:29 p.m. | #2
On 9/17/18 3:18 PM, Sergei Trofimovich wrote:
> On Sat, 28 Jul 2018 20:42:02 +0100

> "slyfox.inbox.ru via gcc-patches" <gcc-patches@gcc.gnu.org> 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 | 3 +++

>>  1 file changed, 3 insertions(+)

>>

>> diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S

>> index 325a7c17d9b..d5240d4aa55 100644

>> --- a/libgcc/config/m68k/lb1sf68.S

>> +++ b/libgcc/config/m68k/lb1sf68.S

>> @@ -435,6 +435,7 @@ $_exception_handler:

>>  	.text

>>  	FUNC(__mulsi3)

>>  	.globl	SYM (__mulsi3)

>> +	.hidden	SYM (__mulsi3)

>>  SYM (__mulsi3):

>>  	movew	sp@(4), d0	/* x0 -> d0 */

>>  	muluw	sp@(10), d0	/* x0*y1 */

>> @@ -458,6 +459,7 @@ SYM (__mulsi3):

>>  	.text

>>  	FUNC(__udivsi3)

>>  	.globl	SYM (__udivsi3)

>> +	.hidden	SYM (__udivsi3)

>>  SYM (__udivsi3):

>>  #ifndef __mcoldfire__

>>  	movel	d2, sp@-

>> @@ -534,6 +536,7 @@ L2:	subql	IMM (1),d4

>>  	.text

>>  	FUNC(__divsi3)

>>  	.globl	SYM (__divsi3)

>> +	.hidden	SYM (__divsi3)

>>  SYM (__divsi3):

>>  	movel	d2, sp@-

>>  

>> -- 

>> 2.18.0

>>

> 

> Patch ping. Not sure which is preferable v1 (as other targets do) or v2.

Hmm, I thought Andreas NAK'd V1.  And I think Rich's comments
essentially NAK'd V2.

Jeff
David Malcolm via Gcc-patches Sept. 17, 2018, 9:50 p.m. | #3
On Mon, 17 Sep 2018 15:29:08 -0600
Jeff Law <law@redhat.com> wrote:

> On 9/17/18 3:18 PM, Sergei Trofimovich wrote:

> > On Sat, 28 Jul 2018 20:42:02 +0100

> > "slyfox.inbox.ru via gcc-patches" <gcc-patches@gcc.gnu.org> 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 | 3 +++

> >>  1 file changed, 3 insertions(+)

> >>

> >> diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S

> >> index 325a7c17d9b..d5240d4aa55 100644

> >> --- a/libgcc/config/m68k/lb1sf68.S

> >> +++ b/libgcc/config/m68k/lb1sf68.S

> >> @@ -435,6 +435,7 @@ $_exception_handler:

> >>  	.text

> >>  	FUNC(__mulsi3)

> >>  	.globl	SYM (__mulsi3)

> >> +	.hidden	SYM (__mulsi3)

> >>  SYM (__mulsi3):

> >>  	movew	sp@(4), d0	/* x0 -> d0 */

> >>  	muluw	sp@(10), d0	/* x0*y1 */

> >> @@ -458,6 +459,7 @@ SYM (__mulsi3):

> >>  	.text

> >>  	FUNC(__udivsi3)

> >>  	.globl	SYM (__udivsi3)

> >> +	.hidden	SYM (__udivsi3)

> >>  SYM (__udivsi3):

> >>  #ifndef __mcoldfire__

> >>  	movel	d2, sp@-

> >> @@ -534,6 +536,7 @@ L2:	subql	IMM (1),d4

> >>  	.text

> >>  	FUNC(__divsi3)

> >>  	.globl	SYM (__divsi3)

> >> +	.hidden	SYM (__divsi3)

> >>  SYM (__divsi3):

> >>  	movel	d2, sp@-

> >>  

> >> -- 

> >> 2.18.0

> >>  

> > 

> > Patch ping. Not sure which is preferable v1 (as other targets do) or v2.  

> Hmm, I thought Andreas NAK'd V1.  And I think Rich's comments

> essentially NAK'd V2.


Aha. I'm trying to clarify the desired state then to try to tweak
patch properly:

Current:
  - static library:
    * global public __divsi3
  - shared library: 
    * global public __divsi3

Desired:
  - static library:
    * global hidden __divsi3 [ABI change:public->hidden]
  - shared library: 
    * global public __divsi3 [no change]
    * global hidden __divsi3_internal [change:new symbol for internal references]

Does that sound reasonable?
Should all targets follow the same pattern? I think they don't today.

v1 was a step in desired direction but without user-visible ABI change.

-- 

  Sergei
Jeff Law Sept. 17, 2018, 10:47 p.m. | #4
On 9/17/18 3:50 PM, Sergei Trofimovich wrote:
> On Mon, 17 Sep 2018 15:29:08 -0600

> Jeff Law <law@redhat.com> wrote:

> 

>> On 9/17/18 3:18 PM, Sergei Trofimovich wrote:

>>> On Sat, 28 Jul 2018 20:42:02 +0100

>>> "slyfox.inbox.ru via gcc-patches" <gcc-patches@gcc.gnu.org> 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 | 3 +++

>>>>  1 file changed, 3 insertions(+)

>>>>

>>>> diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S

>>>> index 325a7c17d9b..d5240d4aa55 100644

>>>> --- a/libgcc/config/m68k/lb1sf68.S

>>>> +++ b/libgcc/config/m68k/lb1sf68.S

>>>> @@ -435,6 +435,7 @@ $_exception_handler:

>>>>  	.text

>>>>  	FUNC(__mulsi3)

>>>>  	.globl	SYM (__mulsi3)

>>>> +	.hidden	SYM (__mulsi3)

>>>>  SYM (__mulsi3):

>>>>  	movew	sp@(4), d0	/* x0 -> d0 */

>>>>  	muluw	sp@(10), d0	/* x0*y1 */

>>>> @@ -458,6 +459,7 @@ SYM (__mulsi3):

>>>>  	.text

>>>>  	FUNC(__udivsi3)

>>>>  	.globl	SYM (__udivsi3)

>>>> +	.hidden	SYM (__udivsi3)

>>>>  SYM (__udivsi3):

>>>>  #ifndef __mcoldfire__

>>>>  	movel	d2, sp@-

>>>> @@ -534,6 +536,7 @@ L2:	subql	IMM (1),d4

>>>>  	.text

>>>>  	FUNC(__divsi3)

>>>>  	.globl	SYM (__divsi3)

>>>> +	.hidden	SYM (__divsi3)

>>>>  SYM (__divsi3):

>>>>  	movel	d2, sp@-

>>>>  

>>>> -- 

>>>> 2.18.0

>>>>  

>>>

>>> Patch ping. Not sure which is preferable v1 (as other targets do) or v2.  

>> Hmm, I thought Andreas NAK'd V1.  And I think Rich's comments

>> essentially NAK'd V2.

> 

> Aha. I'm trying to clarify the desired state then to try to tweak

> patch properly:

> 

> Current:

>   - static library:

>     * global public __divsi3

>   - shared library: 

>     * global public __divsi3

Right.  And presumably the problem here is with public visibility we
have to support the possibility to interposition which can be costly.

> 

> Desired:

>   - static library:

>     * global hidden __divsi3 [ABI change:public->hidden]

Right.  But since everything should be linking against libgcc, each DSO
or executable should end up carrying whatever libgcc functions it needs
and we can hide them from the dynamic linker becuase we don't need to
support interposition and/or function pointer testing on them.

>   - shared library: 

>     * global public __divsi3 [no change]

>     * global hidden __divsi3_internal [change:new symbol for internal references]

> 

> Does that sound reasonable?

> Should all targets follow the same pattern? I think they don't today.

And in the shared case we need to leave the original symbol alone and
provide an alias with hidden visibility IIRC.

I might have mis-understood Rich Felker's objection.

Jeff
Andreas Schwab Sept. 18, 2018, 4:28 p.m. | #5
On Sep 17 2018, Jeff Law <law@redhat.com> wrote:

> Hmm, I thought Andreas NAK'd V1.


Consider that retracted.  My misunderstanding.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Patch

diff --git a/libgcc/config/m68k/lb1sf68.S b/libgcc/config/m68k/lb1sf68.S
index 325a7c17d9b..d5240d4aa55 100644
--- a/libgcc/config/m68k/lb1sf68.S
+++ b/libgcc/config/m68k/lb1sf68.S
@@ -435,6 +435,7 @@  $_exception_handler:
 	.text
 	FUNC(__mulsi3)
 	.globl	SYM (__mulsi3)
+	.hidden	SYM (__mulsi3)
 SYM (__mulsi3):
 	movew	sp@(4), d0	/* x0 -> d0 */
 	muluw	sp@(10), d0	/* x0*y1 */
@@ -458,6 +459,7 @@  SYM (__mulsi3):
 	.text
 	FUNC(__udivsi3)
 	.globl	SYM (__udivsi3)
+	.hidden	SYM (__udivsi3)
 SYM (__udivsi3):
 #ifndef __mcoldfire__
 	movel	d2, sp@-
@@ -534,6 +536,7 @@  L2:	subql	IMM (1),d4
 	.text
 	FUNC(__divsi3)
 	.globl	SYM (__divsi3)
+	.hidden	SYM (__divsi3)
 SYM (__divsi3):
 	movel	d2, sp@-