diff mbox series

[v3,1/4] elf: Consolidate stackinfo.h

Message ID 20240618194102.2059389-2-adhemerval.zanella@linaro.org
State Superseded
Headers show
Series Improve executable stack handling | expand

Commit Message

Adhemerval Zanella Netto June 18, 2024, 7:40 p.m. UTC
And use sane default the generic implementation.
---
 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/nios2/stackinfo.h                   | 33 ---------------------
 sysdeps/powerpc/{ => powerpc32}/stackinfo.h |  8 +----
 sysdeps/riscv/stackinfo.h                   | 33 ---------------------
 8 files changed, 13 insertions(+), 204 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
 delete mode 100644 sysdeps/nios2/stackinfo.h
 rename sysdeps/powerpc/{ => powerpc32}/stackinfo.h (82%)
 delete mode 100644 sysdeps/riscv/stackinfo.h
diff mbox series

Patch

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
-   <https://www.gnu.org/licenses/>.  */
-
-/* This file contains a bit of information about the stack allocation
-   of the processor.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H	1
-
-#include <elf.h>
-
-/* 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
-   <https://www.gnu.org/licenses/>.  */
-
-/* This file contains a bit of information about the stack allocation
-   of the processor.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H	1
-
-#include <elf.h>
-
-/* 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
-   <https://www.gnu.org/licenses/>.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H	1
-
-#include <elf.h>
-
-/* 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
    <https://www.gnu.org/licenses/>.  */
 
-/* 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 <elf.h>
+
+#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
-   <https://www.gnu.org/licenses/>.  */
-
-/* This file contains a bit of information about the stack allocation
-   of the processor.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H 1
-
-#include <elf.h>
-
-/* 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/nios2/stackinfo.h b/sysdeps/nios2/stackinfo.h
deleted file mode 100644
index e67d53ee87..0000000000
--- a/sysdeps/nios2/stackinfo.h
+++ /dev/null
@@ -1,33 +0,0 @@ 
-/* Stack environment definitions for Nios II.
-   Copyright (C) 2012-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
-   <https://www.gnu.org/licenses/>.  */
-
-/* This file contains a bit of information about the stack allocation
-   of the processor.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H	1
-
-#include <elf.h>
-
-/* On Nios II 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
-   <https://www.gnu.org/licenses/>.  */
-
-/* This file contains a bit of information about the stack allocation
-   of the processor.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H	1
-
-#include <elf.h>
-
-/* 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 */