[PATCH] Turn ___brk_addr into a compat symbol

Andreas Schwab schwab@suse.de
Tue Nov 24 13:34:48 GMT 2020


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."


More information about the Libc-alpha mailing list