From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-1.4 required=3.0 tests=AWL,BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 864A61F910 for ; Wed, 23 Nov 2022 08:21:53 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="wEjTtqEK"; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 12CA73851895 for ; Wed, 23 Nov 2022 08:21:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12CA73851895 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669191709; bh=H7sHSE/Yge/Hp74htaGqXPIjqnUCYGjCCKdfqMIZSo4=; h=Subject:To:Cc:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=wEjTtqEK7ECJ0dIx2k2MJyLCLdBd4iBfrNipGHM8FHyjEjdLPIG/FWJxZSmIqHI+O wEE+v0NFEOGF47/3sQLliNo0JGsWDHWlIEZ3mJzyjKX0fGhs9uskP7tVXu5Gwk6T34 yrwxn/ywndEnpWx9YR2NnnyYK80S0NS1eIFBqWxE= Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id BF7263852225 for ; Wed, 23 Nov 2022 08:21:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BF7263852225 Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 6ACDC65B90; Wed, 23 Nov 2022 03:21:20 -0500 (EST) Message-ID: <82b0d2e04df178c0c537b03e43ef9f3ef46d02cb.camel@xry111.site> Subject: Re: [PATCH] LoongArch: Use medium cmodel build libc_nonshared.a. To: caiyinyu , adhemerval.zanella@linaro.org Cc: libc-alpha@sourceware.org, i.swmail@xen0n.name, xuchenghua@loongson.cn Date: Wed, 23 Nov 2022 16:21:18 +0800 In-Reply-To: <20221123070905.1618136-1-caiyinyu@loongson.cn> References: <20221123070905.1618136-1-caiyinyu@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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: , From: Xi Ruoyao via Libc-alpha Reply-To: Xi Ruoyao Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On Wed, 2022-11-23 at 15:09 +0800, caiyinyu wrote: > From: Chenghua Xu >=20 > This patch is used to fix address out-of-bounds error when building > firefox. This can be much simpler: diff --git a/sysdeps/loongarch/Makefile b/sysdeps/loongarch/Makefile index 746d4c2c8f..3822eb3df1 100644 --- a/sysdeps/loongarch/Makefile +++ b/sysdeps/loongarch/Makefile @@ -5,3 +5,7 @@ endif # LoongArch's assembler also needs to know about PIC as it changes the # definition of some assembler macros. ASFLAGS-.os +=3D $(pic-ccflag) + +# All the objects in lib*_nonshared.a need to be compiled with medium code +# model or large applications may fail to link. +CFLAGS-.oS +=3D -mcmodel=3Dmedium And we need a check in configure.ac: GCC 12 does not support - mcmodel=3Dmedium. A remaining question: should we use -mcmodel=3Dextreme here? I guess one day we'll see an extra large application which cannot be linked with even medium code model... > --- > =C2=A0sysdeps/loongarch/Makefile=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 18 ++++++++++++++++++ > =C2=A0sysdeps/loongarch/at_quick_exit.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/atexit.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/elf-init.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/fstat.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/fstat64.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/fstatat.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/fstatat64.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/lstat.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/lstat64.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/mknod.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/mknodat.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/pthread_atfork.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/stack_chk_fail_local.c |=C2=A0 1 + > =C2=A0sysdeps/loongarch/stat.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/stat64.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0sysdeps/loongarch/warning-nop.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A017 files changed, 34 insertions(+) > =C2=A0create mode 100644 sysdeps/loongarch/at_quick_exit.c > =C2=A0create mode 100644 sysdeps/loongarch/atexit.c > =C2=A0create mode 100644 sysdeps/loongarch/elf-init.c > =C2=A0create mode 100644 sysdeps/loongarch/fstat.c > =C2=A0create mode 100644 sysdeps/loongarch/fstat64.c > =C2=A0create mode 100644 sysdeps/loongarch/fstatat.c > =C2=A0create mode 100644 sysdeps/loongarch/fstatat64.c > =C2=A0create mode 100644 sysdeps/loongarch/lstat.c > =C2=A0create mode 100644 sysdeps/loongarch/lstat64.c > =C2=A0create mode 100644 sysdeps/loongarch/mknod.c > =C2=A0create mode 100644 sysdeps/loongarch/mknodat.c > =C2=A0create mode 100644 sysdeps/loongarch/pthread_atfork.c > =C2=A0create mode 100644 sysdeps/loongarch/stack_chk_fail_local.c > =C2=A0create mode 100644 sysdeps/loongarch/stat.c > =C2=A0create mode 100644 sysdeps/loongarch/stat64.c > =C2=A0create mode 100644 sysdeps/loongarch/warning-nop.c >=20 > diff --git a/sysdeps/loongarch/Makefile b/sysdeps/loongarch/Makefile > index 746d4c2c8f..ccda57e2d4 100644 > --- a/sysdeps/loongarch/Makefile > +++ b/sysdeps/loongarch/Makefile > @@ -5,3 +5,21 @@ endif > =C2=A0# LoongArch's assembler also needs to know about PIC as it changes > the > =C2=A0# definition of some assembler macros. > =C2=A0ASFLAGS-.os +=3D $(pic-ccflag) > + > +CFLAGS-elf-init.oS +=3D -mcmodel=3Dmedium > +CFLAGS-atexit.oS +=3D -mcmodel=3Dmedium > +CFLAGS-at_quick_exit.oS +=3D -mcmodel=3Dmedium > +CFLAGS-stat.oS +=3D -mcmodel=3Dmedium > +CFLAGS-fstat.oS +=3D -mcmodel=3Dmedium > +CFLAGS-lstat.oS +=3D -mcmodel=3Dmedium > +CFLAGS-stat64.oS +=3D -mcmodel=3Dmedium > +CFLAGS-fstat64.oS +=3D -mcmodel=3Dmedium > +CFLAGS-lstat64.oS +=3D -mcmodel=3Dmedium > +CFLAGS-fstatat.oS +=3D -mcmodel=3Dmedium > +CFLAGS-fstatat64.oS +=3D -mcmodel=3Dmedium > +CFLAGS-mknod.oS +=3D -mcmodel=3Dmedium > +CFLAGS-mknodat.oS +=3D -mcmodel=3Dmedium > +CFLAGS-pthread_atfork.oS +=3D -mcmodel=3Dmedium > +CFLAGS-warning-nop.oS +=3D -mcmodel=3Dmedium > +CFLAGS-stack_chk_fail_local.oS +=3D -mcmodel=3Dmedium > +=20 > diff --git a/sysdeps/loongarch/at_quick_exit.c > b/sysdeps/loongarch/at_quick_exit.c > new file mode 100644 > index 0000000000..8d4b44a7eb > --- /dev/null > +++ b/sysdeps/loongarch/at_quick_exit.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/atexit.c b/sysdeps/loongarch/atexit.c > new file mode 100644 > index 0000000000..fc055a4851 > --- /dev/null > +++ b/sysdeps/loongarch/atexit.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/elf-init.c b/sysdeps/loongarch/elf- > init.c > new file mode 100644 > index 0000000000..5f261a9d16 > --- /dev/null > +++ b/sysdeps/loongarch/elf-init.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/fstat.c b/sysdeps/loongarch/fstat.c > new file mode 100644 > index 0000000000..c4504eebe7 > --- /dev/null > +++ b/sysdeps/loongarch/fstat.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/fstat64.c b/sysdeps/loongarch/fstat64.c > new file mode 100644 > index 0000000000..143ca2b051 > --- /dev/null > +++ b/sysdeps/loongarch/fstat64.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/fstatat.c b/sysdeps/loongarch/fstatat.c > new file mode 100644 > index 0000000000..0b0a334241 > --- /dev/null > +++ b/sysdeps/loongarch/fstatat.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/fstatat64.c > b/sysdeps/loongarch/fstatat64.c > new file mode 100644 > index 0000000000..e82b927477 > --- /dev/null > +++ b/sysdeps/loongarch/fstatat64.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/lstat.c b/sysdeps/loongarch/lstat.c > new file mode 100644 > index 0000000000..f47a56aff8 > --- /dev/null > +++ b/sysdeps/loongarch/lstat.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/lstat64.c b/sysdeps/loongarch/lstat64.c > new file mode 100644 > index 0000000000..d681165600 > --- /dev/null > +++ b/sysdeps/loongarch/lstat64.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/mknod.c b/sysdeps/loongarch/mknod.c > new file mode 100644 > index 0000000000..1ed3681ffe > --- /dev/null > +++ b/sysdeps/loongarch/mknod.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/mknodat.c b/sysdeps/loongarch/mknodat.c > new file mode 100644 > index 0000000000..82bc6ee637 > --- /dev/null > +++ b/sysdeps/loongarch/mknodat.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/pthread_atfork.c > b/sysdeps/loongarch/pthread_atfork.c > new file mode 100644 > index 0000000000..0f01d80512 > --- /dev/null > +++ b/sysdeps/loongarch/pthread_atfork.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/stack_chk_fail_local.c > b/sysdeps/loongarch/stack_chk_fail_local.c > new file mode 100644 > index 0000000000..305871fbc0 > --- /dev/null > +++ b/sysdeps/loongarch/stack_chk_fail_local.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/stat.c b/sysdeps/loongarch/stat.c > new file mode 100644 > index 0000000000..36461b870e > --- /dev/null > +++ b/sysdeps/loongarch/stat.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/stat64.c b/sysdeps/loongarch/stat64.c > new file mode 100644 > index 0000000000..0897282e6a > --- /dev/null > +++ b/sysdeps/loongarch/stat64.c > @@ -0,0 +1 @@ > +#include > diff --git a/sysdeps/loongarch/warning-nop.c > b/sysdeps/loongarch/warning-nop.c > new file mode 100644 > index 0000000000..b76aae79f9 > --- /dev/null > +++ b/sysdeps/loongarch/warning-nop.c > @@ -0,0 +1 @@ > +#include --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University