From patchwork Thu Nov 28 17:36:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 102038 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 8532F3858C98 for ; Thu, 28 Nov 2024 17:40:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8532F3858C98 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=pWr6u3Pl X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by sourceware.org (Postfix) with ESMTPS id 47AEF3858C60 for ; Thu, 28 Nov 2024 17:38:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47AEF3858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 47AEF3858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::541 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732815538; cv=none; b=qXzJfau1vpVN8HAegrohlx9fUIXFXHHL6LNDqSgblTHma+leaVMah+OgWkTO2/47b18iJPD+WOEcYxASE1QTrO29M5VdN3Wuh48vIhJESQ0PEY9s8uhh2oMV6zYxXBju3gIHQ0zEdHQZoc9vlbXda7YTG0PQSKuPtOiQN32XjNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732815538; c=relaxed/simple; bh=9+5p+DVW+1ONj47gRsDFQzRhMMK5uKZTH4iuZwY6dZs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XzOeMlXbx8tU6tgkPWyfQKcqQ0VdzUjWIeAu0jJCQYMoMuGL+rSXEkRdkUBCaWr4TlBaHdYmS9hVkNH1Zb60fwZb043SSKd82t6hzroeS030hW1G8ftKPMUHt1J8YKr9T1PcvedLyIuwqtSoRGJA3vjB4GqCeqNhdxK4Uoy8IlM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47AEF3858C60 Received: by mail-pg1-x541.google.com with SMTP id 41be03b00d2f7-7f450f7f11dso701557a12.2 for ; Thu, 28 Nov 2024 09:38:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732815537; x=1733420337; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ukMExROWCFeI5moccZONnrqyhF8WcGwn/5A5w759xI4=; b=pWr6u3PllpI7tQnRnHW/DM8Bk+a3rkEhyc9XjwwjoxgPFTH6l475QNhFWBh9yvNjnj IY4VjQfPl0TEcyYiUbfJmptvEecKGiEZoaExsYoD0Y6g7u1mMM8iFQShcjlEx1f17njp VniHzmniHDQCBBy+lwvQ48k+YtStRoY8HeqcA5qsDfs2mlwIw5lT8FLhssRguJ5pyH8g ZLACvvpn2rTD0HfB4wfL04VMbRoHvZufsfD0K073orU/zYcO63T/UAjLkyAGmh+8w/Fi 7mjiZe11RhDMCDD78AsY/cLTWg0Xt0C6Ay7QjDaJNBvY9O+UPruXdSrJq8B2sKJiJJ+N qKOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732815537; x=1733420337; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ukMExROWCFeI5moccZONnrqyhF8WcGwn/5A5w759xI4=; b=n6klQxcinitQTxfdAG25dyTkwUIKM7vCOHFabnMQSnB1QEbPVJtsfw/dhDZlGQxD+V fFmTnGBo/+m3wTio+hnT3f6rpJ9ffHWc49ti2zK5WkHUp876+nqrZl501E2rCr1bmlWF cCFk2NSqangQjj09g485waAd4gXlhFLj16fMmE1QLkyAZb2v3RYOVVmECieJ2ytoArnD hbGev92POmsy2eseYuyWWq6/V1v+KWxI/JItT7H6C0rM9o92RrcoB3LixnJSmjl/pegX YHxsXKQDX7Pe3Du48rhsRFPmobAyK093bCg0REiHmrfwmI40A9X/fhdPPifVYluEtb0D 8WMA== X-Gm-Message-State: AOJu0YyFIE4cCE3F+016ArcvTaTM6VbKlqFFe/2BccppILosY0fPgElI 3FqtQvRE3WoSJ0Fyxh5epmJo3odo4SoUeXTRCmitUWO1n5hTXNW6SesTmEWD76pjOpiVAEywx9R Xi+N9hNMA X-Gm-Gg: ASbGncvDo5CpJm/TfuvItkV5j7p3JmxBptyBMOSeb13dI97c+BxDLuj2xs2JKGz8Jzr P0U1UT2qPnuWSsEMzXI38MVZx5Jt39CAXLCDtIDTWIghRNI3kb3grNQYRPHuWRk8+NaxlKcqdPe EmAJD/oCKljTwLma0kDx+4PNfyMrNnU90TYWwNhQsl9dZINv8W1ROnj94oY8PQj/v3sgBEKs8rC BVDT+Nj9MKi8GENKVpib4dVmnO7DFVc3wtgRh4m+y9lQa/mqLQrOS5LRn0r5gM= X-Google-Smtp-Source: AGHT+IFxYhz3RwCbzbl7wUJuArDAyOKldU3YcWwV2HzOLovTesVJHG2Ooa00wH6VlBtJh0lw838dxQ== X-Received: by 2002:a05:6a20:6f8c:b0:1e0:cbcf:8917 with SMTP id adf61e73a8af0-1e0e0b0b329mr11082606637.21.1732815536855; Thu, 28 Nov 2024 09:38:56 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c1:68c8:2c85:3a76:728e:ead2]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72541849d6csm1860356b3a.182.2024.11.28.09.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2024 09:38:56 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Florian Weimer Subject: [PATCH v5 1/4] elf: Consolidate stackinfo.h Date: Thu, 28 Nov 2024 14:36:42 -0300 Message-ID: <20241128173851.1920696-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241128173851.1920696-1-adhemerval.zanella@linaro.org> References: <20241128173851.1920696-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org And use sane default the generic implementation. Reviewed-by: Florian Weimer --- sysdeps/aarch64/stackinfo.h | 33 --------------------- sysdeps/arc/stackinfo.h | 33 --------------------- sysdeps/csky/stackinfo.h | 29 ------------------ sysdeps/generic/stackinfo.h | 15 ++++++++-- sysdeps/loongarch/stackinfo.h | 33 --------------------- sysdeps/powerpc/{ => powerpc32}/stackinfo.h | 8 +---- sysdeps/riscv/stackinfo.h | 33 --------------------- 7 files changed, 13 insertions(+), 171 deletions(-) delete mode 100644 sysdeps/aarch64/stackinfo.h delete mode 100644 sysdeps/arc/stackinfo.h delete mode 100644 sysdeps/csky/stackinfo.h delete mode 100644 sysdeps/loongarch/stackinfo.h rename sysdeps/powerpc/{ => powerpc32}/stackinfo.h (82%) delete mode 100644 sysdeps/riscv/stackinfo.h diff --git a/sysdeps/aarch64/stackinfo.h b/sysdeps/aarch64/stackinfo.h deleted file mode 100644 index 5a4dce7309..0000000000 --- a/sysdeps/aarch64/stackinfo.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2001-2024 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* This file contains a bit of information about the stack allocation - of the processor. */ - -#ifndef _STACKINFO_H -#define _STACKINFO_H 1 - -#include - -/* On AArch64 the stack grows down. */ -#define _STACK_GROWS_DOWN 1 - -/* Default to a non-executable stack. */ -#define DEFAULT_STACK_PERMS (PF_R|PF_W) - -#endif /* stackinfo.h */ diff --git a/sysdeps/arc/stackinfo.h b/sysdeps/arc/stackinfo.h deleted file mode 100644 index 99a7f56ea0..0000000000 --- a/sysdeps/arc/stackinfo.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Stack environment definitions for ARC. - Copyright (C) 2020-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* This file contains a bit of information about the stack allocation - of the processor. */ - -#ifndef _STACKINFO_H -#define _STACKINFO_H 1 - -#include - -/* On ARC the stack grows down. */ -#define _STACK_GROWS_DOWN 1 - -/* Default to a non-executable stack. */ -#define DEFAULT_STACK_PERMS (PF_R|PF_W) - -#endif /* stackinfo.h */ diff --git a/sysdeps/csky/stackinfo.h b/sysdeps/csky/stackinfo.h deleted file mode 100644 index ef22fa3249..0000000000 --- a/sysdeps/csky/stackinfo.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Stack environment definitions. C-SKY version. - Copyright (C) 2018-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _STACKINFO_H -#define _STACKINFO_H 1 - -#include - -/* On C-SKY the stack grows down. */ -#define _STACK_GROWS_DOWN 1 - -#define DEFAULT_STACK_PERMS (PF_R|PF_W) - -#endif /* stackinfo.h */ diff --git a/sysdeps/generic/stackinfo.h b/sysdeps/generic/stackinfo.h index bf752ce94d..51e5f92055 100644 --- a/sysdeps/generic/stackinfo.h +++ b/sysdeps/generic/stackinfo.h @@ -15,6 +15,15 @@ License along with the GNU C Library; if not, see . */ -/* This file contains a bit of information about the stack allocation - of the processor. Since there is no general truth we can't say - anything here. */ +/* This file contains a bit of information about the stack allocation of the + processor. Default to a non executable stack that grows downwards. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +#include + +#define _STACK_GROWS_DOWN 1 +#define DEFAULT_STACK_PERMS (PF_R|PF_W) + +#endif diff --git a/sysdeps/loongarch/stackinfo.h b/sysdeps/loongarch/stackinfo.h deleted file mode 100644 index 6ee50552b7..0000000000 --- a/sysdeps/loongarch/stackinfo.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Stack environment definitions for LoongArch. - Copyright (C) 2022-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* This file contains a bit of information about the stack allocation - of the processor. */ - -#ifndef _STACKINFO_H -#define _STACKINFO_H 1 - -#include - -/* On LoongArch the stack grows down. */ -#define _STACK_GROWS_DOWN 1 - -/* Default to a non-executable stack. */ -#define DEFAULT_STACK_PERMS (PF_R | PF_W) - -#endif /* stackinfo.h */ diff --git a/sysdeps/powerpc/stackinfo.h b/sysdeps/powerpc/powerpc32/stackinfo.h similarity index 82% rename from sysdeps/powerpc/stackinfo.h rename to sysdeps/powerpc/powerpc32/stackinfo.h index 410689bc27..2ca360068a 100644 --- a/sysdeps/powerpc/stackinfo.h +++ b/sysdeps/powerpc/powerpc32/stackinfo.h @@ -26,13 +26,7 @@ /* On PPC the stack grows down. */ #define _STACK_GROWS_DOWN 1 -#if __WORDSIZE == 64 -/* PPC64 doesn't need an executable stack and doesn't need PT_GNU_STACK - * to make the stack nonexecutable. */ -# define DEFAULT_STACK_PERMS (PF_R|PF_W) -#else /* PF_X can be overridden if PT_GNU_STACK is present but is presumed absent. */ -# define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X) -#endif +#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X) #endif /* stackinfo.h */ diff --git a/sysdeps/riscv/stackinfo.h b/sysdeps/riscv/stackinfo.h deleted file mode 100644 index a786d4f9b0..0000000000 --- a/sysdeps/riscv/stackinfo.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Stack environment definitions for RISC-V. - Copyright (C) 2011-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -/* This file contains a bit of information about the stack allocation - of the processor. */ - -#ifndef _STACKINFO_H -#define _STACKINFO_H 1 - -#include - -/* On RISC-V the stack grows down. */ -#define _STACK_GROWS_DOWN 1 - -/* Default to a non-executable stack. */ -#define DEFAULT_STACK_PERMS (PF_R | PF_W) - -#endif /* stackinfo.h */