public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Turn ___brk_addr into a compat symbol
@ 2020-11-19 10:32 Andreas Schwab
  2020-11-19 11:34 ` Florian Weimer
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2020-11-19 10:32 UTC (permalink / raw)
  To: libc-alpha

GCC hasn't been requiring the ___brk_addr symbol since 3.1, and before
that only on i386 at least since 2.95.
---
 sysdeps/mach/hurd/brk.c                     | 5 ++++-
 sysdeps/unix/sysv/linux/generic/brk.c       | 5 ++++-
 sysdeps/unix/sysv/linux/i386/brk.c          | 5 ++++-
 sysdeps/unix/sysv/linux/ia64/brk.S          | 5 ++++-
 sysdeps/unix/sysv/linux/m68k/brk.c          | 5 ++++-
 sysdeps/unix/sysv/linux/microblaze/brk.c    | 5 ++++-
 sysdeps/unix/sysv/linux/mips/brk.c          | 5 ++++-
 sysdeps/unix/sysv/linux/s390/brk.c          | 5 ++++-
 sysdeps/unix/sysv/linux/sparc/sparc32/brk.c | 5 ++++-
 9 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c
index 02fdefd4b7..711167bebb 100644
--- a/sysdeps/mach/hurd/brk.c
+++ b/sysdeps/mach/hurd/brk.c
@@ -20,6 +20,7 @@
 #include <hurd/resource.h>
 #include <lock-intern.h>	/* For `struct mutex'.  */
 #include <vm_param.h>
+#include <shlib-compat.h>
 
 
 /* Initial maximum size of the data segment (this is arbitrary).  */
@@ -33,10 +34,12 @@ vm_address_t _hurd_data_end;
    Pages beyond the one containing this address allow no access.  */
 vm_address_t _hurd_brk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* This name is used by the Linux crtbeginS.o for reasons you don't even
    want to think about it.  It's just easier to provide some definition for
    it than even to explain the braindamage involved.  */
-weak_alias (_hurd_brk, ___brk_addr)
+compat_symbol (libc, _hurd_brk, ___brk_addr, GLIBC_2_0);
+#endif
 
 struct mutex _hurd_brk_lock;
 
diff --git a/sysdeps/unix/sysv/linux/generic/brk.c b/sysdeps/unix/sysv/linux/generic/brk.c
index 40a80ab970..0c12b3a487 100644
--- a/sysdeps/unix/sysv/linux/generic/brk.c
+++ b/sysdeps/unix/sysv/linux/generic/brk.c
@@ -19,14 +19,17 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 /* This must be initialized data because commons can't have aliases.  */
 void *__curbrk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux ELF dynamic
    linker.  */
-weak_alias (__curbrk, ___brk_addr)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
+#endif
 
 int
 __brk (void *addr)
diff --git a/sysdeps/unix/sysv/linux/i386/brk.c b/sysdeps/unix/sysv/linux/i386/brk.c
index 021b6d37a0..2e56a8a9eb 100644
--- a/sysdeps/unix/sysv/linux/i386/brk.c
+++ b/sysdeps/unix/sysv/linux/i386/brk.c
@@ -24,14 +24,17 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 /* This must be initialized data because commons can't have aliases.  */
 void *__curbrk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux ELF dynamic
    linker.  */
-weak_alias (__curbrk, ___brk_addr)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
+#endif
 
 int
 __brk (void *addr)
diff --git a/sysdeps/unix/sysv/linux/ia64/brk.S b/sysdeps/unix/sysv/linux/ia64/brk.S
index 734d3467a7..3e643fa745 100644
--- a/sysdeps/unix/sysv/linux/ia64/brk.S
+++ b/sysdeps/unix/sysv/linux/ia64/brk.S
@@ -19,6 +19,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 #include <asm/errno.h>
 
@@ -30,7 +31,9 @@
 __curbrk:
 	data8	0
 
-weak_alias (__curbrk, ___brk_addr)
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0)
+#endif
 
 LEAF(__brk)
 	.regstk 1, 0, 0, 0
diff --git a/sysdeps/unix/sysv/linux/m68k/brk.c b/sysdeps/unix/sysv/linux/m68k/brk.c
index ee88acbdc4..ae5b260ee2 100644
--- a/sysdeps/unix/sysv/linux/m68k/brk.c
+++ b/sysdeps/unix/sysv/linux/m68k/brk.c
@@ -19,13 +19,16 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 void *__curbrk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux/x86 ELF
    dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
+#endif
 
 int
 __brk (void *addr)
diff --git a/sysdeps/unix/sysv/linux/microblaze/brk.c b/sysdeps/unix/sysv/linux/microblaze/brk.c
index 20c3e625e4..c41fbbf03a 100644
--- a/sysdeps/unix/sysv/linux/microblaze/brk.c
+++ b/sysdeps/unix/sysv/linux/microblaze/brk.c
@@ -18,14 +18,17 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 /* This must be initialized data because commons can't have aliases.  */
 void *__curbrk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux ELF dynamic
    linker.  */
-weak_alias (__curbrk, ___brk_addr)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
+#endif
 
 int
 __brk (void *addr)
diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c
index 0335837948..20d4be0e7c 100644
--- a/sysdeps/unix/sysv/linux/mips/brk.c
+++ b/sysdeps/unix/sysv/linux/mips/brk.c
@@ -19,13 +19,16 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 void *__curbrk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux/x86 ELF
    dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
+#endif
 
 int
 __brk (void *addr)
diff --git a/sysdeps/unix/sysv/linux/s390/brk.c b/sysdeps/unix/sysv/linux/s390/brk.c
index ca3a730f83..948d97fec8 100644
--- a/sysdeps/unix/sysv/linux/s390/brk.c
+++ b/sysdeps/unix/sysv/linux/s390/brk.c
@@ -20,13 +20,16 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 void *__curbrk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux/x86 ELF
    dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
+#endif
 
 int
 __brk (void *addr)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/brk.c b/sysdeps/unix/sysv/linux/sparc/sparc32/brk.c
index ba9a616f74..bbaf7876c2 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/brk.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/brk.c
@@ -20,14 +20,17 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 /* This must be initialized data because commons can't have aliases.  */
 void *__curbrk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux ELF dynamic
    linker.  */
-weak_alias (__curbrk, ___brk_addr)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
+#endif
 
 int
 __brk (void *addr)
-- 
2.29.0


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-19 10:32 [PATCH] Turn ___brk_addr into a compat symbol Andreas Schwab
@ 2020-11-19 11:34 ` Florian Weimer
  2020-11-19 12:25   ` Adhemerval Zanella
  0 siblings, 1 reply; 15+ messages in thread
From: Florian Weimer @ 2020-11-19 11:34 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha

* Andreas Schwab:

> GCC hasn't been requiring the ___brk_addr symbol since 3.1, and before
> that only on i386 at least since 2.95.

GCC 2.7.2.3 uses it as well on i386.

I think turning it into a compatibility symbol will prevent users from
using these compilers to link new binaries.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-19 11:34 ` Florian Weimer
@ 2020-11-19 12:25   ` Adhemerval Zanella
  2020-11-19 14:57     ` Florian Weimer
  0 siblings, 1 reply; 15+ messages in thread
From: Adhemerval Zanella @ 2020-11-19 12:25 UTC (permalink / raw)
  To: libc-alpha



On 19/11/2020 08:34, Florian Weimer wrote:
> * Andreas Schwab:
> 
>> GCC hasn't been requiring the ___brk_addr symbol since 3.1, and before
>> that only on i386 at least since 2.95.
> 
> GCC 2.7.2.3 uses it as well on i386.
> 
> I think turning it into a compatibility symbol will prevent users from
> using these compilers to link new binaries.
> 

Is this really a wide deployed scenario? And do we really care for that
awkward combination (a 20 years old compiler using an update runtime)?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-19 12:25   ` Adhemerval Zanella
@ 2020-11-19 14:57     ` Florian Weimer
  0 siblings, 0 replies; 15+ messages in thread
From: Florian Weimer @ 2020-11-19 14:57 UTC (permalink / raw)
  To: Adhemerval Zanella via Libc-alpha

* Adhemerval Zanella via Libc-alpha:

> On 19/11/2020 08:34, Florian Weimer wrote:
>> * Andreas Schwab:
>> 
>>> GCC hasn't been requiring the ___brk_addr symbol since 3.1, and before
>>> that only on i386 at least since 2.95.
>> 
>> GCC 2.7.2.3 uses it as well on i386.
>> 
>> I think turning it into a compatibility symbol will prevent users from
>> using these compilers to link new binaries.
>> 
>
> Is this really a wide deployed scenario?

Widely deployed is relative, especially in a glibc context with its
long list of supported targets.

> And do we really care for that awkward combination (a 20 years old
> compiler using an update runtime)?

GCC 2.7.2.3 is a bit of an outlier because the old Debian binaries
didn't run anymore because of a regression introduced in 1998 that was
only fixed last year.

For GCC 2.95, I have seen users building new programs with it quite
recently (although only reproducers for bugs in new glibc versions).

These early GCC versions have different C++ ABIs and accept language
constructs rejected by current compilers.  GCC 2.95 has been really
solid, so I guess those factors conspire to keep it around.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-12-02 11:21 ` Florian Weimer
@ 2020-12-08 11:43   ` Andreas Schwab
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2020-12-08 11:43 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

On Dez 02 2020, Florian Weimer wrote:

> Is the intent of this patch that __brk_addr should turn into a compat
> symbol on i386, too?

You objected.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-24 13:34 Andreas Schwab
  2020-11-24 13:41 ` H.J. Lu
@ 2020-12-02 11:21 ` Florian Weimer
  2020-12-08 11:43   ` Andreas Schwab
  1 sibling, 1 reply; 15+ messages in thread
From: Florian Weimer @ 2020-12-02 11:21 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha

* Andreas Schwab:

> At least since GCC 2.95 the ___brk_addr symbol has only been needed on
> i386-linux.  The architectures added later do not need to define it any
> more.  This includes all current users of .../generic/brk.c, plus ia64 and
> microblaze.  GCC 3.1 finally removed that reference even for i386-linux.

Is the intent of this patch that __brk_addr should turn into a compat
symbol on i386, too?

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-24 17:16             ` H.J. Lu
@ 2020-11-25 11:15               ` Andreas Schwab
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2020-11-25 11:15 UTC (permalink / raw)
  To: H.J. Lu; +Cc: H.J. Lu via Libc-alpha

On Nov 24 2020, H.J. Lu wrote:

> There is no need for that.  ___brk_addr should be simply removed from ia64
> and microblaze.

It is part of the ABI.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-24 16:13           ` Andreas Schwab
@ 2020-11-24 17:16             ` H.J. Lu
  2020-11-25 11:15               ` Andreas Schwab
  0 siblings, 1 reply; 15+ messages in thread
From: H.J. Lu @ 2020-11-24 17:16 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: H.J. Lu via Libc-alpha

On Tue, Nov 24, 2020 at 8:13 AM Andreas Schwab <schwab@suse.de> wrote:
>
> On Nov 24 2020, H.J. Lu via Libc-alpha wrote:
>
> > On Tue, Nov 24, 2020 at 7:43 AM Andreas Schwab <schwab@suse.de> wrote:
> >>
> >> On Nov 24 2020, H.J. Lu via Libc-alpha wrote:
> >>
> >> > I think ___brk_addr should be removed for ia64 and microblaze.
> >>
> >> That's exactly what I do.
> >>
> >
> > You added
> >
> > #include <shlib-compat.h>
> > ...
> > compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
> >
> > to ia64 and microblaze.
>
> Yes, and?
>

There is no need for that.  ___brk_addr should be simply removed from ia64
and microblaze.

-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-24 15:56         ` H.J. Lu
@ 2020-11-24 16:13           ` Andreas Schwab
  2020-11-24 17:16             ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2020-11-24 16:13 UTC (permalink / raw)
  To: H.J. Lu via Libc-alpha

On Nov 24 2020, H.J. Lu via Libc-alpha wrote:

> On Tue, Nov 24, 2020 at 7:43 AM Andreas Schwab <schwab@suse.de> wrote:
>>
>> On Nov 24 2020, H.J. Lu via Libc-alpha wrote:
>>
>> > I think ___brk_addr should be removed for ia64 and microblaze.
>>
>> That's exactly what I do.
>>
>
> You added
>
> #include <shlib-compat.h>
> ...
> compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
>
> to ia64 and microblaze.

Yes, and?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-24 15:43       ` Andreas Schwab
@ 2020-11-24 15:56         ` H.J. Lu
  2020-11-24 16:13           ` Andreas Schwab
  0 siblings, 1 reply; 15+ messages in thread
From: H.J. Lu @ 2020-11-24 15:56 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: H.J. Lu via Libc-alpha

On Tue, Nov 24, 2020 at 7:43 AM Andreas Schwab <schwab@suse.de> wrote:
>
> On Nov 24 2020, H.J. Lu via Libc-alpha wrote:
>
> > I think ___brk_addr should be removed for ia64 and microblaze.
>
> That's exactly what I do.
>

You added

#include <shlib-compat.h>
...
compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);

to ia64 and microblaze.

-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-24 15:33     ` H.J. Lu
@ 2020-11-24 15:43       ` Andreas Schwab
  2020-11-24 15:56         ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2020-11-24 15:43 UTC (permalink / raw)
  To: H.J. Lu via Libc-alpha

On Nov 24 2020, H.J. Lu via Libc-alpha wrote:

> I think ___brk_addr should be removed for ia64 and microblaze.

That's exactly what I do.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-24 14:46   ` Andreas Schwab
@ 2020-11-24 15:33     ` H.J. Lu
  2020-11-24 15:43       ` Andreas Schwab
  0 siblings, 1 reply; 15+ messages in thread
From: H.J. Lu @ 2020-11-24 15:33 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: GNU C Library

On Tue, Nov 24, 2020 at 6:46 AM Andreas Schwab <schwab@suse.de> wrote:
>
> On Nov 24 2020, H.J. Lu wrote:
>
> > Do any targets, except for i386-linux, ever reference this symbol?
>
> See gcc commit bced43dd6ca.
>
> Andreas.
>

I don't see references to ___brk_addr for ia64 nor microblaze since they were
added after

commit d0f8fcea2689a8c9c32648370c14e0ce40288bfa
Author: Richard Kenner <kenner@gcc.gnu.org>
Date:   Fri Jun 28 14:08:53 1996 -0400

    (init_dummy): Only i386-linux (at most) needs ___brk_addr hack.

I think ___brk_addr should be removed for ia64 and microblaze.

-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-24 13:41 ` H.J. Lu
@ 2020-11-24 14:46   ` Andreas Schwab
  2020-11-24 15:33     ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Schwab @ 2020-11-24 14:46 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GNU C Library

On Nov 24 2020, H.J. Lu wrote:

> Do any targets, except for i386-linux, ever reference this symbol?

See gcc commit bced43dd6ca.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] Turn ___brk_addr into a compat symbol
  2020-11-24 13:34 Andreas Schwab
@ 2020-11-24 13:41 ` H.J. Lu
  2020-11-24 14:46   ` Andreas Schwab
  2020-12-02 11:21 ` Florian Weimer
  1 sibling, 1 reply; 15+ messages in thread
From: H.J. Lu @ 2020-11-24 13:41 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: GNU C Library

On Tue, Nov 24, 2020 at 5:35 AM Andreas Schwab <schwab@suse.de> wrote:
>
> At least since GCC 2.95 the ___brk_addr symbol has only been needed on
> i386-linux.  The architectures added later do not need to define it any
> more.  This includes all current users of .../generic/brk.c, plus ia64 and
> microblaze.  GCC 3.1 finally removed that reference even for i386-linux.

Do any targets, except for i386-linux, ever reference this symbol?

-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] Turn ___brk_addr into a compat symbol
@ 2020-11-24 13:34 Andreas Schwab
  2020-11-24 13:41 ` H.J. Lu
  2020-12-02 11:21 ` Florian Weimer
  0 siblings, 2 replies; 15+ messages in thread
From: Andreas Schwab @ 2020-11-24 13:34 UTC (permalink / raw)
  To: libc-alpha

At least since GCC 2.95 the ___brk_addr symbol has only been needed on
i386-linux.  The architectures added later do not need to define it any
more.  This includes all current users of .../generic/brk.c, plus ia64 and
microblaze.  GCC 3.1 finally removed that reference even for i386-linux.
---
 sysdeps/unix/sysv/linux/generic/brk.c    | 5 ++++-
 sysdeps/unix/sysv/linux/ia64/brk.S       | 5 ++++-
 sysdeps/unix/sysv/linux/microblaze/brk.c | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/generic/brk.c b/sysdeps/unix/sysv/linux/generic/brk.c
index 40a80ab970..0c12b3a487 100644
--- a/sysdeps/unix/sysv/linux/generic/brk.c
+++ b/sysdeps/unix/sysv/linux/generic/brk.c
@@ -19,14 +19,17 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 /* This must be initialized data because commons can't have aliases.  */
 void *__curbrk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux ELF dynamic
    linker.  */
-weak_alias (__curbrk, ___brk_addr)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
+#endif
 
 int
 __brk (void *addr)
diff --git a/sysdeps/unix/sysv/linux/ia64/brk.S b/sysdeps/unix/sysv/linux/ia64/brk.S
index 734d3467a7..3e643fa745 100644
--- a/sysdeps/unix/sysv/linux/ia64/brk.S
+++ b/sysdeps/unix/sysv/linux/ia64/brk.S
@@ -19,6 +19,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 #include <asm/errno.h>
 
@@ -30,7 +31,9 @@
 __curbrk:
 	data8	0
 
-weak_alias (__curbrk, ___brk_addr)
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0)
+#endif
 
 LEAF(__brk)
 	.regstk 1, 0, 0, 0
diff --git a/sysdeps/unix/sysv/linux/microblaze/brk.c b/sysdeps/unix/sysv/linux/microblaze/brk.c
index 20c3e625e4..c41fbbf03a 100644
--- a/sysdeps/unix/sysv/linux/microblaze/brk.c
+++ b/sysdeps/unix/sysv/linux/microblaze/brk.c
@@ -18,14 +18,17 @@
 #include <errno.h>
 #include <unistd.h>
 #include <sysdep.h>
+#include <shlib-compat.h>
 
 /* This must be initialized data because commons can't have aliases.  */
 void *__curbrk = 0;
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_33)
 /* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
    to work around different old braindamage in the old Linux ELF dynamic
    linker.  */
-weak_alias (__curbrk, ___brk_addr)
+compat_symbol (libc, __curbrk, ___brk_addr, GLIBC_2_0);
+#endif
 
 int
 __brk (void *addr)
-- 
2.29.0


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-12-08 11:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 10:32 [PATCH] Turn ___brk_addr into a compat symbol Andreas Schwab
2020-11-19 11:34 ` Florian Weimer
2020-11-19 12:25   ` Adhemerval Zanella
2020-11-19 14:57     ` Florian Weimer
2020-11-24 13:34 Andreas Schwab
2020-11-24 13:41 ` H.J. Lu
2020-11-24 14:46   ` Andreas Schwab
2020-11-24 15:33     ` H.J. Lu
2020-11-24 15:43       ` Andreas Schwab
2020-11-24 15:56         ` H.J. Lu
2020-11-24 16:13           ` Andreas Schwab
2020-11-24 17:16             ` H.J. Lu
2020-11-25 11:15               ` Andreas Schwab
2020-12-02 11:21 ` Florian Weimer
2020-12-08 11:43   ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).