From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 6746838418BD for ; Mon, 25 Jul 2022 02:45:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6746838418BD Received: from [IPv6:240e:358:11c1:5100:dc73:854d:832e:3] (unknown [IPv6:240e:358:11c1:5100:dc73:854d:832e:3]) (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 8241C66782; Sun, 24 Jul 2022 22:44:59 -0400 (EDT) Message-ID: <194be062c7812a604ff914b49caa1532d7bd85ed.camel@xry111.site> Subject: Re: [PATCH] LoongArch: Set defaults to exec stack 0. From: Xi Ruoyao To: WANG Xuerui , liuzhensong , binutils@sourceware.org Cc: maskray@google.com, caiyinyu@loongson.cn, chenglulu@loongson.cn, mengqinggang@loongson.cn, xuchenghua@loongson.cn Date: Mon, 25 Jul 2022 10:44:52 +0800 In-Reply-To: <94ed682f-1b36-0fe1-7383-19657fa33468@xen0n.name> References: <20220725022227.16266-1-liuzhensong@loongson.cn> <94ed682f-1b36-0fe1-7383-19657fa33468@xen0n.name> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.3 MIME-Version: 1.0 X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, GIT_PATCH_0, LIKELY_SPAM_FROM, PDS_OTHER_BAD_TLD, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2022 02:45:09 -0000 On Mon, 2022-07-25 at 10:24 +0800, WANG Xuerui wrote: > On 2022/7/25 10:22, liuzhensong wrote: > > --- > > =C2=A0 bfd/elfnn-loongarch.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 1 + > > =C2=A0 ld/testsuite/ld-elf/elf.exp | 1 + > > =C2=A0 2 files changed, 2 insertions(+) > >=20 > > diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c > > index 4efe3d9370c..43182ead8cd 100644 > > --- a/bfd/elfnn-loongarch.c > > +++ b/bfd/elfnn-loongarch.c > > @@ -132,6 +132,7 @@ struct loongarch_elf_link_hash_table > > =C2=A0=20 > > =C2=A0 #define elf_backend_want_dynrelro 1 > > =C2=A0 #define elf_backend_rela_normal 1 > > +#define elf_backend_default_execstack 0 > > =C2=A0=20 > > =C2=A0 /* Generate a PLT header.=C2=A0 */ > > =C2=A0=20 > > diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld- > > elf/elf.exp > > index 10c635e9593..b8829b4e3ee 100644 > > --- a/ld/testsuite/ld-elf/elf.exp > > +++ b/ld/testsuite/ld-elf/elf.exp > > @@ -187,6 +187,7 @@ proc target_defaults_to_execstack {} { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|| [istarget "nios2*-*-= *"] > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|| [istarget "powerpc64= *-*-*"] > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|| [istarget "riscv*-*-= *"] > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|| [istarget "loongarch*-*-*= "] > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|| [istarget "tilegx*-*= -*"] > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|| [istarget "tilepro*-= *-*"] } { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0 > Looks good to me. I don't know why this isn't the case from the=20 > beginning... I'll test on Gentoo shortly after. I guess it's just noticed recently because ld has started to emit warning for assembly inputs w/o .note.GNU-stack section. Before the warning the only way to notice this problem is "process xxx is started with executable stack" in the kernel log if someone forgot to add a .note.GNU-stack section in the assembly source file. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University