From patchwork Thu Nov 19 10:32:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 41129 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 22F59386F808; Thu, 19 Nov 2020 10:32:41 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 1EC74385700A for ; Thu, 19 Nov 2020 10:32:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1EC74385700A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=schwab@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3716DAC23 for ; Thu, 19 Nov 2020 10:32:37 +0000 (UTC) From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] Turn ___brk_addr into a compat symbol X-Yow: I invented skydiving in 1989! Date: Thu, 19 Nov 2020 11:32:37 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "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 #include /* For `struct mutex'. */ #include +#include /* 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 #include #include +#include /* 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 #include #include +#include /* 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 @@ . */ #include +#include #include @@ -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 #include #include +#include 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 #include #include +#include /* 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 #include #include +#include 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 #include #include +#include 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 #include #include +#include /* 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)