public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/2] [MIPS] Emit .note.GNU-stack for linux targets.
@ 2019-08-05 10:43 Dragan Mladjenovic
  2019-08-05 10:48 ` [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float " Dragan Mladjenovic
  2019-08-05 10:49 ` [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float " Dragan Mladjenovic
  0 siblings, 2 replies; 18+ messages in thread
From: Dragan Mladjenovic @ 2019-08-05 10:43 UTC (permalink / raw)
  To: gcc-patches
  Cc: Dragan Mladjenovic, Jakub Jelinek, Matthew Fortune, Joseph Myers,
	Maciej W . Rozycki, Faraz Shahbazker

From: "Dragan Mladjenovic" <dmladjenovic@wavecomp.com>

Greetings,

These patches enable emitting .note.GNU-stack by default on mips linux targets.
First one enables it unconditionally for soft-float builds while the second one
enables it for hard-float build if gcc is configured against the future version
of glibc that should enable safe usage of PT_GNU_STACK [1].


[1] https://sourceware.org/ml/libc-alpha/2019-08/msg00065.html

Best regards,

Dragan

Dragan Mladjenovic (2):
  Emit .note.GNU-stack for soft-float linux targets.
  Emit .note.GNU-stack for hard-float linux targets.

 gcc/config.in                   |  6 ++++++
 gcc/config/mips/linux.h         |  8 +++++++
 gcc/config/mips/mips.c          | 11 ++++++++++
 gcc/config/mips/mips.h          |  2 ++
 gcc/configure                   | 47 +++++++++++++++++++++++++++++++++--------
 gcc/configure.ac                | 12 +++++++++++
 libgcc/config/mips/crti.S       |  3 +++
 libgcc/config/mips/crtn.S       |  3 +++
 libgcc/config/mips/gnustack.h   |  7 ++++++
 libgcc/config/mips/mips16.S     |  3 +++
 libgcc/config/mips/vr4120-div.S |  3 +++
 11 files changed, 96 insertions(+), 9 deletions(-)
 create mode 100644 libgcc/config/mips/gnustack.h

-- 
1.9.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float linux targets.
  2019-08-05 10:43 [PATCH 0/2] [MIPS] Emit .note.GNU-stack for linux targets Dragan Mladjenovic
@ 2019-08-05 10:48 ` Dragan Mladjenovic
  2019-08-09 21:36   ` Jeff Law
  2019-08-05 10:49 ` [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float " Dragan Mladjenovic
  1 sibling, 1 reply; 18+ messages in thread
From: Dragan Mladjenovic @ 2019-08-05 10:48 UTC (permalink / raw)
  To: gcc-patches
  Cc: Dragan Mladjenovic, Jakub Jelinek, Matthew Fortune, Joseph Myers,
	Maciej W . Rozycki, Faraz Shahbazker

From: "Dragan Mladjenovic" <dmladjenovic@wavecomp.com>

gcc/ChangeLog:

2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to
	TARGET_SOFT_FLOAT.
	* config/mips/mips.c (TARGET_ASM_FILE_END): Define to ...
	(mips_asm_file_end): New function. Delegate to
	file_end_indicate_exec_stack if NEED_INDICATE_EXEC_STACK is true.
	* config/mips/mips.h (NEED_INDICATE_EXEC_STACK): Define to 0.

libgcc/ChangeLog:

2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

	* config/mips/gnustack.h: New file.
	* config/mips/crti.S: Include gnustack.h.
	* config/mips/crtn.S: Likewise.
	* config/mips/mips16.S: Likewise.
	* config/mips/vr4120-div.S: Likewise.
---
 gcc/config/mips/linux.h         |  4 ++++
 gcc/config/mips/mips.c          | 11 +++++++++++
 gcc/config/mips/mips.h          |  2 ++
 libgcc/config/mips/crti.S       |  3 +++
 libgcc/config/mips/crtn.S       |  3 +++
 libgcc/config/mips/gnustack.h   |  7 +++++++
 libgcc/config/mips/mips16.S     |  3 +++
 libgcc/config/mips/vr4120-div.S |  3 +++
 8 files changed, 36 insertions(+)
 create mode 100644 libgcc/config/mips/gnustack.h

diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
index 6f79ac9..1fa72ef 100644
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -50,3 +50,7 @@ along with GCC; see the file COPYING3.  If not see
 #define GNU_USER_DYNAMIC_LINKERN32 \
   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
                          BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+
+#undef NEED_INDICATE_EXEC_STACK
+
+#define NEED_INDICATE_EXEC_STACK TARGET_SOFT_FLOAT
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index e0535b1..66ef23a 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -22522,6 +22522,13 @@ mips_starting_frame_offset (void)
     return 0;
   return crtl->outgoing_args_size + MIPS_GP_SAVE_AREA_SIZE;
 }
+
+static void
+mips_asm_file_end (void)
+{
+  if (NEED_INDICATE_EXEC_STACK)
+    file_end_indicate_exec_stack ();
+}
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -22829,6 +22836,10 @@ mips_starting_frame_offset (void)
 #undef TARGET_STARTING_FRAME_OFFSET
 #define TARGET_STARTING_FRAME_OFFSET mips_starting_frame_offset
 
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END mips_asm_file_end
+
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 #include "gt-mips.h"
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index a5be7fa3..22a1b3c 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -3461,3 +3461,5 @@ struct GTY(())  machine_function {
   (TARGET_LOAD_STORE_PAIRS \
    && (TUNE_P5600 || TUNE_I6400 || TUNE_P6600) \
    && !TARGET_MICROMIPS && !TARGET_FIX_24K)
+
+#define NEED_INDICATE_EXEC_STACK 0
diff --git a/libgcc/config/mips/crti.S b/libgcc/config/mips/crti.S
index 44409c7..8733415 100644
--- a/libgcc/config/mips/crti.S
+++ b/libgcc/config/mips/crti.S
@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+/* An executable stack is *not* required for these functions.  */
+#include "gnustack.h"
+
 /* 4 slots for argument spill area.  1 for cpreturn, 1 for stack.
    Return spill offset of 40 and 20.  Aligned to 16 bytes for n32.  */
 
diff --git a/libgcc/config/mips/crtn.S b/libgcc/config/mips/crtn.S
index b56d77c..f897906 100644
--- a/libgcc/config/mips/crtn.S
+++ b/libgcc/config/mips/crtn.S
@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+/* An executable stack is *not* required for these functions.  */
+#include "gnustack.h"
+
 /* 4 slots for argument spill area.  1 for cpreturn, 1 for stack.
    Return spill offset of 40 and 20.  Aligned to 16 bytes for n32.  */
 
diff --git a/libgcc/config/mips/gnustack.h b/libgcc/config/mips/gnustack.h
new file mode 100644
index 0000000..6d5f618
--- /dev/null
+++ b/libgcc/config/mips/gnustack.h
@@ -0,0 +1,7 @@
+#include "config.h"
+#if defined(__ELF__) && defined(__linux__)
+#if defined (__mips_soft_float)
+        .section .note.GNU-stack,"",%progbits
+        .previous
+#endif
+#endif
diff --git a/libgcc/config/mips/mips16.S b/libgcc/config/mips/mips16.S
index 8cfd9e4..1f4df43 100644
--- a/libgcc/config/mips/mips16.S
+++ b/libgcc/config/mips/mips16.S
@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+/* An executable stack is *not* required for these functions.  */
+#include "gnustack.h"
+
 #include "auto-host.h"
 
 #if defined(__mips_micromips) || defined(__mips_soft_float) \
diff --git a/libgcc/config/mips/vr4120-div.S b/libgcc/config/mips/vr4120-div.S
index 7f6729d..783b59e 100644
--- a/libgcc/config/mips/vr4120-div.S
+++ b/libgcc/config/mips/vr4120-div.S
@@ -22,6 +22,9 @@ a copy of the GCC Runtime Library Exception along with this program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
+/* An executable stack is *not* required for these functions.  */
+#include "gnustack.h"
+
 /* This file contains functions which implement divsi3 and modsi3 for
    -mfix-vr4120.  div and ddiv do not give the correct result when one
    of the operands is negative.  */
-- 
1.9.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2019-08-05 10:43 [PATCH 0/2] [MIPS] Emit .note.GNU-stack for linux targets Dragan Mladjenovic
  2019-08-05 10:48 ` [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float " Dragan Mladjenovic
@ 2019-08-05 10:49 ` Dragan Mladjenovic
  2019-08-09 21:38   ` Jeff Law
  2019-08-09 22:03   ` Maciej W. Rozycki
  1 sibling, 2 replies; 18+ messages in thread
From: Dragan Mladjenovic @ 2019-08-05 10:49 UTC (permalink / raw)
  To: gcc-patches
  Cc: Dragan Mladjenovic, Jakub Jelinek, Matthew Fortune, Joseph Myers,
	Maciej W . Rozycki, Faraz Shahbazker

From: "Dragan Mladjenovic" <dmladjenovic@wavecomp.com>

libgcc/ChangeLog:

2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

	* config/mips/gnustack.h: Check for TARGET_LIBC_GNUSTACK also.

gcc/ChangeLog:

2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>

	* config.in: Regenerated.
	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to 1
	for TARGET_LIBC_GNUSTACK.
	* configure: Regenerated.
	* configure.ac: Define TARGET_LIBC_GNUSTACK if glibc version is
	found 2.31 or greater.
---
 gcc/config/mips/linux.h       |  4 ++++
 gcc/configure.ac              | 12 ++++++++++++
 libgcc/config/mips/gnustack.h |  2 +-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
index 1fa72ef..30b22e7 100644
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -53,4 +53,8 @@ along with GCC; see the file COPYING3.  If not see
 
 #undef NEED_INDICATE_EXEC_STACK
 
+#ifdef TARGET_LIBC_GNUSTACK
+#define NEED_INDICATE_EXEC_STACK 1
+#else
 #define NEED_INDICATE_EXEC_STACK TARGET_SOFT_FLOAT
+#endif
diff --git a/gcc/configure.ac b/gcc/configure.ac
index c620dd2..ab080c8 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6143,6 +6143,18 @@ if test x$gcc_cv_libc_provides_hwcap_in_tcb = xyes; then
 	    [Define if your target C Library provides the AT_HWCAP value in the TCB])
 fi
 
+# Check if the target LIBC handles PT_GNU_STACK.
+gcc_cv_libc_gnustack=unknown
+case "$target" in
+  mips*-*-linux*)
+    GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
+    ;;
+esac
+if test x$gcc_cv_libc_gnustack = xyes; then
+  AC_DEFINE(TARGET_LIBC_GNUSTACK, 1,
+            [Define if your target C Library properly handles PT_GNU_STACK])
+fi
+
 AC_MSG_CHECKING(dl_iterate_phdr in target C library)
 gcc_cv_target_dl_iterate_phdr=unknown
 case "$target" in
diff --git a/libgcc/config/mips/gnustack.h b/libgcc/config/mips/gnustack.h
index 6d5f618..a67c4b2 100644
--- a/libgcc/config/mips/gnustack.h
+++ b/libgcc/config/mips/gnustack.h
@@ -1,6 +1,6 @@
 #include "config.h"
 #if defined(__ELF__) && defined(__linux__)
-#if defined (__mips_soft_float)
+#if defined (TARGET_LIBC_GNUSTACK) || defined (__mips_soft_float)
         .section .note.GNU-stack,"",%progbits
         .previous
 #endif
-- 
1.9.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float linux targets.
  2019-08-05 10:48 ` [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float " Dragan Mladjenovic
@ 2019-08-09 21:36   ` Jeff Law
  2019-08-12 16:34     ` [EXTERNAL]Re: " Dragan Mladjenovic
  0 siblings, 1 reply; 18+ messages in thread
From: Jeff Law @ 2019-08-09 21:36 UTC (permalink / raw)
  To: Dragan Mladjenovic, gcc-patches
  Cc: Jakub Jelinek, Matthew Fortune, Joseph Myers, Maciej W . Rozycki,
	Faraz Shahbazker

On 8/5/19 4:47 AM, Dragan Mladjenovic wrote:
> From: "Dragan Mladjenovic" <dmladjenovic@wavecomp.com>
> 
> gcc/ChangeLog:
> 
> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
> 
> 	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to
> 	TARGET_SOFT_FLOAT.
> 	* config/mips/mips.c (TARGET_ASM_FILE_END): Define to ...
> 	(mips_asm_file_end): New function. Delegate to
> 	file_end_indicate_exec_stack if NEED_INDICATE_EXEC_STACK is true.
> 	* config/mips/mips.h (NEED_INDICATE_EXEC_STACK): Define to 0.
> 
> libgcc/ChangeLog:
> 
> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
> 
> 	* config/mips/gnustack.h: New file.
> 	* config/mips/crti.S: Include gnustack.h.
> 	* config/mips/crtn.S: Likewise.
> 	* config/mips/mips16.S: Likewise.
> 	* config/mips/vr4120-div.S: Likewise.
Seems reasonable.  What testing has been done for this patch?  I don't
doubt it works for the MIPS linux targets, I'm more interested in making
sure it doesn't do the wrong thing for the embedded mips targets.

Do you have write access to the repository?

jeff

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2019-08-05 10:49 ` [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float " Dragan Mladjenovic
@ 2019-08-09 21:38   ` Jeff Law
  2019-08-09 23:13     ` Joseph Myers
  2019-08-09 22:03   ` Maciej W. Rozycki
  1 sibling, 1 reply; 18+ messages in thread
From: Jeff Law @ 2019-08-09 21:38 UTC (permalink / raw)
  To: Dragan Mladjenovic, gcc-patches
  Cc: Jakub Jelinek, Matthew Fortune, Joseph Myers, Maciej W . Rozycki,
	Faraz Shahbazker

On 8/5/19 4:49 AM, Dragan Mladjenovic wrote:
> From: "Dragan Mladjenovic" <dmladjenovic@wavecomp.com>
> 
> libgcc/ChangeLog:
> 
> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
> 
> 	* config/mips/gnustack.h: Check for TARGET_LIBC_GNUSTACK also.
> 
> gcc/ChangeLog:
> 
> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
> 
> 	* config.in: Regenerated.
> 	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to 1
> 	for TARGET_LIBC_GNUSTACK.
> 	* configure: Regenerated.
> 	* configure.ac: Define TARGET_LIBC_GNUSTACK if glibc version is
> 	found 2.31 or greater.
My only concern here is the configure bits.  So for example, will it do
the right thing if you're cross-compiling to a MIPS linux target?  If
so, how?  If not, do we need to make it a first class configure option
so that it can be specified when building cross MIPS linux toolchains?

jeff

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2019-08-05 10:49 ` [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float " Dragan Mladjenovic
  2019-08-09 21:38   ` Jeff Law
@ 2019-08-09 22:03   ` Maciej W. Rozycki
  1 sibling, 0 replies; 18+ messages in thread
From: Maciej W. Rozycki @ 2019-08-09 22:03 UTC (permalink / raw)
  To: Dragan Mladjenovic
  Cc: gcc-patches, Jakub Jelinek, Matthew Fortune, Joseph Myers,
	Faraz Shahbazker

On Mon, 5 Aug 2019, Dragan Mladjenovic wrote:

> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index c620dd2..ab080c8 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -6143,6 +6143,18 @@ if test x$gcc_cv_libc_provides_hwcap_in_tcb = xyes; then
>  	    [Define if your target C Library provides the AT_HWCAP value in the TCB])
>  fi
>  
> +# Check if the target LIBC handles PT_GNU_STACK.
> +gcc_cv_libc_gnustack=unknown
> +case "$target" in
> +  mips*-*-linux*)
> +    GCC_GLIBC_VERSION_GTE_IFELSE([2], [31], [gcc_cv_libc_gnustack=yes], )
> +    ;;
> +esac

 It looks to me like this should be using AC_CACHE_VAL.

  Maciej

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2019-08-09 21:38   ` Jeff Law
@ 2019-08-09 23:13     ` Joseph Myers
  2019-11-01 10:32       ` Dragan Mladjenovic
  0 siblings, 1 reply; 18+ messages in thread
From: Joseph Myers @ 2019-08-09 23:13 UTC (permalink / raw)
  To: Jeff Law
  Cc: Dragan Mladjenovic, gcc-patches, Jakub Jelinek, Matthew Fortune,
	Maciej W . Rozycki, Faraz Shahbazker

On Fri, 9 Aug 2019, Jeff Law wrote:

> > 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
> > 
> > 	* config.in: Regenerated.
> > 	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to 1
> > 	for TARGET_LIBC_GNUSTACK.
> > 	* configure: Regenerated.
> > 	* configure.ac: Define TARGET_LIBC_GNUSTACK if glibc version is
> > 	found 2.31 or greater.
> My only concern here is the configure bits.  So for example, will it do
> the right thing if you're cross-compiling to a MIPS linux target?  If
> so, how?  If not, do we need to make it a first class configure option
> so that it can be specified when building cross MIPS linux toolchains?

The key point of using GCC_GLIBC_VERSION_GTE_IFELSE is that (a) it checks 
the target glibc headers if available when GCC is built and (b) if not 
available, you can still use --with-glibc-version when configuring GCC, to 
get the right configuration in a bootstrap compiler built before glibc is 
built (the latter is necessary on some architectures to get the right 
stack-protector configuration for bootstrapping glibc, but may be useful 
in other cases as well).

My main concern about this patch is the one I gave in 
<https://sourceware.org/ml/libc-alpha/2019-08/msg00086.html> about what 
the configuration mechanism should be, on a whole-toolchain level, to say 
whether you are OK with a requirement for a 4.8 or later kernel.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [EXTERNAL]Re: [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float linux targets.
  2019-08-09 21:36   ` Jeff Law
@ 2019-08-12 16:34     ` Dragan Mladjenovic
  2019-08-20  7:26       ` Jeff Law
  0 siblings, 1 reply; 18+ messages in thread
From: Dragan Mladjenovic @ 2019-08-12 16:34 UTC (permalink / raw)
  To: Jeff Law, gcc-patches
  Cc: Jakub Jelinek, Matthew Fortune, Joseph Myers, Maciej W . Rozycki,
	Faraz Shahbazker

On 09.08.2019. 23:31, Jeff Law wrote:
> On 8/5/19 4:47 AM, Dragan Mladjenovic wrote:
>> From: "Dragan Mladjenovic" <dmladjenovic@wavecomp.com>
>>
>> gcc/ChangeLog:
>>
>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>
>> 	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to
>> 	TARGET_SOFT_FLOAT.
>> 	* config/mips/mips.c (TARGET_ASM_FILE_END): Define to ...
>> 	(mips_asm_file_end): New function. Delegate to
>> 	file_end_indicate_exec_stack if NEED_INDICATE_EXEC_STACK is true.
>> 	* config/mips/mips.h (NEED_INDICATE_EXEC_STACK): Define to 0.
>>
>> libgcc/ChangeLog:
>>
>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>
>> 	* config/mips/gnustack.h: New file.
>> 	* config/mips/crti.S: Include gnustack.h.
>> 	* config/mips/crtn.S: Likewise.
>> 	* config/mips/mips16.S: Likewise.
>> 	* config/mips/vr4120-div.S: Likewise.
> Seems reasonable.  What testing has been done for this patch?  I don't
> doubt it works for the MIPS linux targets, I'm more interested in making
> sure it doesn't do the wrong thing for the embedded mips targets.

I've built a cross mips-mti-elf toolchain, albeit with reduced multilib, 
but still there were not .note.GNU-stack in sysroot.
Is this enough?

 >
 > Do you have write access to the repository?
 >

I do not have write access to the repository.

Best regards,
Dragan

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [EXTERNAL]Re: [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float linux targets.
  2019-08-12 16:34     ` [EXTERNAL]Re: " Dragan Mladjenovic
@ 2019-08-20  7:26       ` Jeff Law
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Law @ 2019-08-20  7:26 UTC (permalink / raw)
  To: Dragan Mladjenovic, gcc-patches
  Cc: Jakub Jelinek, Matthew Fortune, Joseph Myers, Maciej W . Rozycki,
	Faraz Shahbazker

On 8/12/19 9:21 AM, Dragan Mladjenovic wrote:
> On 09.08.2019. 23:31, Jeff Law wrote:
>> On 8/5/19 4:47 AM, Dragan Mladjenovic wrote:
>>> From: "Dragan Mladjenovic" <dmladjenovic@wavecomp.com>
>>>
>>> gcc/ChangeLog:
>>>
>>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>>
>>> 	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to
>>> 	TARGET_SOFT_FLOAT.
>>> 	* config/mips/mips.c (TARGET_ASM_FILE_END): Define to ...
>>> 	(mips_asm_file_end): New function. Delegate to
>>> 	file_end_indicate_exec_stack if NEED_INDICATE_EXEC_STACK is true.
>>> 	* config/mips/mips.h (NEED_INDICATE_EXEC_STACK): Define to 0.
>>>
>>> libgcc/ChangeLog:
>>>
>>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>>
>>> 	* config/mips/gnustack.h: New file.
>>> 	* config/mips/crti.S: Include gnustack.h.
>>> 	* config/mips/crtn.S: Likewise.
>>> 	* config/mips/mips16.S: Likewise.
>>> 	* config/mips/vr4120-div.S: Likewise.
>> Seems reasonable.  What testing has been done for this patch?  I don't
>> doubt it works for the MIPS linux targets, I'm more interested in making
>> sure it doesn't do the wrong thing for the embedded mips targets.
> 
> I've built a cross mips-mti-elf toolchain, albeit with reduced multilib, 
> but still there were not .note.GNU-stack in sysroot.
> Is this enough?
Yea.  Mostly just wanted to make sure the *-elf targets still build -- I
didn't expect problems, but it's good to have sanity checking.

> 
>  >
>  > Do you have write access to the repository?
>  >
> 
> I do not have write access to the repository.
We should probably fix that.

https://sourceware.org/cgi-bin/pdw/ps_form.cgi

List me as your sponsor.



jeff

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2019-08-09 23:13     ` Joseph Myers
@ 2019-11-01 10:32       ` Dragan Mladjenovic
  2019-11-07 17:05         ` Dragan Mladjenovic
  0 siblings, 1 reply; 18+ messages in thread
From: Dragan Mladjenovic @ 2019-11-01 10:32 UTC (permalink / raw)
  To: Joseph Myers, Jeff Law
  Cc: gcc-patches, Jakub Jelinek, Matthew Fortune, Maciej W . Rozycki,
	Faraz Shahbazker, Aurelien Jarno

On 10.08.2019. 00:15, Joseph Myers wrote:
> On Fri, 9 Aug 2019, Jeff Law wrote:
>
>>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>>
>>> 	* config.in: Regenerated.
>>> 	* config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to 1
>>> 	for TARGET_LIBC_GNUSTACK.
>>> 	* configure: Regenerated.
>>> 	* configure.ac: Define TARGET_LIBC_GNUSTACK if glibc version is
>>> 	found 2.31 or greater.
>> My only concern here is the configure bits.  So for example, will it do
>> the right thing if you're cross-compiling to a MIPS linux target?  If
>> so, how?  If not, do we need to make it a first class configure option
>> so that it can be specified when building cross MIPS linux toolchains?
>
> The key point of using GCC_GLIBC_VERSION_GTE_IFELSE is that (a) it checks
> the target glibc headers if available when GCC is built and (b) if not
> available, you can still use --with-glibc-version when configuring GCC, to
> get the right configuration in a bootstrap compiler built before glibc is
> built (the latter is necessary on some architectures to get the right
> stack-protector configuration for bootstrapping glibc, but may be useful
> in other cases as well).
>
> My main concern about this patch is the one I gave in
> <https://sourceware.org/ml/libc-alpha/2019-08/msg00086.html> about what
> the configuration mechanism should be, on a whole-toolchain level, to say
> whether you are OK with a requirement for a 4.8 or later kernel.
>

Sorry for the late reply.

I was waiting to backport [1] to most of the glibc release branches in 
use, but I got sidetracked along the way.

After this patch lands the preferred way to configure gcc would be using 
--with-glibc-version=2.31 and to use said glibc.
If the user/distribution can live with minimal kernel requirement of 4.8
the glibc used should be configured with --enable-kernel=4.8.
I also plan to backport the [1] to limit the opportunity for building 
the possibly broken glibc with the gcc w/ enabled .note.GNU-stack.

This is all tedious and user has to be aware of all of it to make it 
work, but hopefully over time the distributions will default to 
--with-glibc-version=2.31 and --enable-kernel=4.8. I guess providing the 
detailed NEWS entry for this change would help a bit.

Is there any objections to getting this on the trunk before the end of
stage1?

[1] https://sourceware.org/ml/libc-alpha/2019-08/msg00639.html

Best regards,
Dragan

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2019-11-01 10:32       ` Dragan Mladjenovic
@ 2019-11-07 17:05         ` Dragan Mladjenovic
  2019-11-27 18:59           ` [PING] " Dragan Mladjenovic
  2019-12-07 18:33           ` Jeff Law
  0 siblings, 2 replies; 18+ messages in thread
From: Dragan Mladjenovic @ 2019-11-07 17:05 UTC (permalink / raw)
  To: Joseph Myers, Jeff Law
  Cc: gcc-patches, Jakub Jelinek, Matthew Fortune, Maciej W . Rozycki,
	Faraz Shahbazker, Aurelien Jarno

On 01.11.2019. 11:32, Dragan Mladjenovic wrote:
> On 10.08.2019. 00:15, Joseph Myers wrote:
>> On Fri, 9 Aug 2019, Jeff Law wrote:
>>
>>>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>>>
>>>>     * config.in: Regenerated.
>>>>     * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to 1
>>>>     for TARGET_LIBC_GNUSTACK.
>>>>     * configure: Regenerated.
>>>>     * configure.ac: Define TARGET_LIBC_GNUSTACK if glibc version is
>>>>     found 2.31 or greater.
>>> My only concern here is the configure bits.  So for example, will it do
>>> the right thing if you're cross-compiling to a MIPS linux target?  If
>>> so, how?  If not, do we need to make it a first class configure option
>>> so that it can be specified when building cross MIPS linux toolchains?
>>
>> The key point of using GCC_GLIBC_VERSION_GTE_IFELSE is that (a) it checks
>> the target glibc headers if available when GCC is built and (b) if not
>> available, you can still use --with-glibc-version when configuring
>> GCC, to
>> get the right configuration in a bootstrap compiler built before glibc is
>> built (the latter is necessary on some architectures to get the right
>> stack-protector configuration for bootstrapping glibc, but may be useful
>> in other cases as well).
>>
>> My main concern about this patch is the one I gave in
>> <https://sourceware.org/ml/libc-alpha/2019-08/msg00086.html> about what
>> the configuration mechanism should be, on a whole-toolchain level, to say
>> whether you are OK with a requirement for a 4.8 or later kernel.
>>
>
> Sorry for the late reply.
>
> I was waiting to backport [1] to most of the glibc release branches in
> use, but I got sidetracked along the way.
>
> After this patch lands the preferred way to configure gcc would be using
> --with-glibc-version=2.31 and to use said glibc.
> If the user/distribution can live with minimal kernel requirement of 4.8
> the glibc used should be configured with --enable-kernel=4.8.
> I also plan to backport the [1] to limit the opportunity for building
> the possibly broken glibc with the gcc w/ enabled .note.GNU-stack.
>
> This is all tedious and user has to be aware of all of it to make it
> work, but hopefully over time the distributions will default to
> --with-glibc-version=2.31 and --enable-kernel=4.8. I guess providing the
> detailed NEWS entry for this change would help a bit.
>
> Is there any objections to getting this on the trunk before the end of
> stage1?
>
> [1] https://sourceware.org/ml/libc-alpha/2019-08/msg00639.html
>

Small update and gentle ping. The glibc change was backported all the 
way back to 2.24.

Best regards,
Dragan

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PING] Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2019-11-07 17:05         ` Dragan Mladjenovic
@ 2019-11-27 18:59           ` Dragan Mladjenovic
  2019-12-07 18:33           ` Jeff Law
  1 sibling, 0 replies; 18+ messages in thread
From: Dragan Mladjenovic @ 2019-11-27 18:59 UTC (permalink / raw)
  To: Joseph Myers, Jeff Law
  Cc: gcc-patches, Jakub Jelinek, Matthew Fortune, Maciej W . Rozycki,
	Faraz Shahbazker, Aurelien Jarno

On 07.11.2019. 18:05, Dragan Mladjenovic wrote:
> On 01.11.2019. 11:32, Dragan Mladjenovic wrote:
>> On 10.08.2019. 00:15, Joseph Myers wrote:
>>> On Fri, 9 Aug 2019, Jeff Law wrote:
>>>
>>>>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>>>>
>>>>>     * config.in: Regenerated.
>>>>>     * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to 1
>>>>>     for TARGET_LIBC_GNUSTACK.
>>>>>     * configure: Regenerated.
>>>>>     * configure.ac: Define TARGET_LIBC_GNUSTACK if glibc version is
>>>>>     found 2.31 or greater.
>>>> My only concern here is the configure bits.  So for example, will it do
>>>> the right thing if you're cross-compiling to a MIPS linux target?  If
>>>> so, how?  If not, do we need to make it a first class configure option
>>>> so that it can be specified when building cross MIPS linux toolchains?
>>>
>>> The key point of using GCC_GLIBC_VERSION_GTE_IFELSE is that (a) it
>>> checks
>>> the target glibc headers if available when GCC is built and (b) if not
>>> available, you can still use --with-glibc-version when configuring
>>> GCC, to
>>> get the right configuration in a bootstrap compiler built before
>>> glibc is
>>> built (the latter is necessary on some architectures to get the right
>>> stack-protector configuration for bootstrapping glibc, but may be useful
>>> in other cases as well).
>>>
>>> My main concern about this patch is the one I gave in
>>> <https://sourceware.org/ml/libc-alpha/2019-08/msg00086.html> about what
>>> the configuration mechanism should be, on a whole-toolchain level, to
>>> say
>>> whether you are OK with a requirement for a 4.8 or later kernel.
>>>
>>
>> Sorry for the late reply.
>>
>> I was waiting to backport [1] to most of the glibc release branches in
>> use, but I got sidetracked along the way.
>>
>> After this patch lands the preferred way to configure gcc would be using
>> --with-glibc-version=2.31 and to use said glibc.
>> If the user/distribution can live with minimal kernel requirement of 4.8
>> the glibc used should be configured with --enable-kernel=4.8.
>> I also plan to backport the [1] to limit the opportunity for building
>> the possibly broken glibc with the gcc w/ enabled .note.GNU-stack.
>>
>> This is all tedious and user has to be aware of all of it to make it
>> work, but hopefully over time the distributions will default to
>> --with-glibc-version=2.31 and --enable-kernel=4.8. I guess providing the
>> detailed NEWS entry for this change would help a bit.
>>
>> Is there any objections to getting this on the trunk before the end of
>> stage1?
>>
>> [1] https://sourceware.org/ml/libc-alpha/2019-08/msg00639.html
>>
>
> Small update and gentle ping. The glibc change was backported all the
> way back to 2.24.
>
> Best regards,
> Dragan
>

Ping.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2019-11-07 17:05         ` Dragan Mladjenovic
  2019-11-27 18:59           ` [PING] " Dragan Mladjenovic
@ 2019-12-07 18:33           ` Jeff Law
  2020-01-23 11:14             ` Dragan Mladjenovic
  1 sibling, 1 reply; 18+ messages in thread
From: Jeff Law @ 2019-12-07 18:33 UTC (permalink / raw)
  To: Dragan Mladjenovic, Joseph Myers
  Cc: gcc-patches, Jakub Jelinek, Matthew Fortune, Maciej W . Rozycki,
	Faraz Shahbazker, Aurelien Jarno

On Thu, 2019-11-07 at 17:05 +0000, Dragan Mladjenovic wrote:
> On 01.11.2019. 11:32, Dragan Mladjenovic wrote:
> > On 10.08.2019. 00:15, Joseph Myers wrote:
> > > On Fri, 9 Aug 2019, Jeff Law wrote:
> > > 
> > > > > 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
> > > > > 
> > > > >     * config.in: Regenerated.
> > > > >     * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define
> > > > > to 1
> > > > >     for TARGET_LIBC_GNUSTACK.
> > > > >     * configure: Regenerated.
> > > > >     * configure.ac: Define TARGET_LIBC_GNUSTACK if glibc
> > > > > version is
> > > > >     found 2.31 or greater.
> > > > My only concern here is the configure bits.  So for example,
> > > > will it do
> > > > the right thing if you're cross-compiling to a MIPS linux
> > > > target?  If
> > > > so, how?  If not, do we need to make it a first class configure
> > > > option
> > > > so that it can be specified when building cross MIPS linux
> > > > toolchains?
> > > 
> > > The key point of using GCC_GLIBC_VERSION_GTE_IFELSE is that (a)
> > > it checks
> > > the target glibc headers if available when GCC is built and (b)
> > > if not
> > > available, you can still use --with-glibc-version when
> > > configuring
> > > GCC, to
> > > get the right configuration in a bootstrap compiler built before
> > > glibc is
> > > built (the latter is necessary on some architectures to get the
> > > right
> > > stack-protector configuration for bootstrapping glibc, but may be
> > > useful
> > > in other cases as well).
> > > 
> > > My main concern about this patch is the one I gave in
> > > <https://sourceware.org/ml/libc-alpha/2019-08/msg00086.html>
> > > about what
> > > the configuration mechanism should be, on a whole-toolchain
> > > level, to say
> > > whether you are OK with a requirement for a 4.8 or later kernel.
> > > 
> > 
> > Sorry for the late reply.
> > 
> > I was waiting to backport [1] to most of the glibc release branches
> > in
> > use, but I got sidetracked along the way.
> > 
> > After this patch lands the preferred way to configure gcc would be
> > using
> > --with-glibc-version=2.31 and to use said glibc.
> > If the user/distribution can live with minimal kernel requirement
> > of 4.8
> > the glibc used should be configured with --enable-kernel=4.8.
> > I also plan to backport the [1] to limit the opportunity for
> > building
> > the possibly broken glibc with the gcc w/ enabled .note.GNU-stack.
> > 
> > This is all tedious and user has to be aware of all of it to make
> > it
> > work, but hopefully over time the distributions will default to
> > --with-glibc-version=2.31 and --enable-kernel=4.8. I guess
> > providing the
> > detailed NEWS entry for this change would help a bit.
> > 
> > Is there any objections to getting this on the trunk before the end
> > of
> > stage1?
> > 
> > [1] https://sourceware.org/ml/libc-alpha/2019-08/msg00639.html
> > 
> 
> Small update and gentle ping. The glibc change was backported all
> the 
> way back to 2.24.
I think this is fine.  And yes, we'd like to get it mentioned in the
release notes since I suspect folks will want the GNU-stack ELF notes.

jeff


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2019-12-07 18:33           ` Jeff Law
@ 2020-01-23 11:14             ` Dragan Mladjenovic
  2020-01-23 15:22               ` Jeff Law
  2020-01-29 12:20               ` Tobias Burnus
  0 siblings, 2 replies; 18+ messages in thread
From: Dragan Mladjenovic @ 2020-01-23 11:14 UTC (permalink / raw)
  To: Richard Biener
  Cc: law, Joseph Myers, gcc-patches, Jakub Jelinek, Matthew Fortune,
	Maciej W . Rozycki, Faraz Shahbazker, Aurelien Jarno

On 07.12.2019. 19:33, Jeff Law wrote:
> On Thu, 2019-11-07 at 17:05 +0000, Dragan Mladjenovic wrote:
>> On 01.11.2019. 11:32, Dragan Mladjenovic wrote:
>>> On 10.08.2019. 00:15, Joseph Myers wrote:
>>>> On Fri, 9 Aug 2019, Jeff Law wrote:
>>>>
>>>>>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>>>>>
>>>>>>      * config.in: Regenerated.
>>>>>>      * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define
>>>>>> to 1
>>>>>>      for TARGET_LIBC_GNUSTACK.
>>>>>>      * configure: Regenerated.
>>>>>>      * configure.ac: Define TARGET_LIBC_GNUSTACK if glibc
>>>>>> version is
>>>>>>      found 2.31 or greater.
>>>>> My only concern here is the configure bits.  So for example,
>>>>> will it do
>>>>> the right thing if you're cross-compiling to a MIPS linux
>>>>> target?  If
>>>>> so, how?  If not, do we need to make it a first class configure
>>>>> option
>>>>> so that it can be specified when building cross MIPS linux
>>>>> toolchains?
>>>>
>>>> The key point of using GCC_GLIBC_VERSION_GTE_IFELSE is that (a)
>>>> it checks
>>>> the target glibc headers if available when GCC is built and (b)
>>>> if not
>>>> available, you can still use --with-glibc-version when
>>>> configuring
>>>> GCC, to
>>>> get the right configuration in a bootstrap compiler built before
>>>> glibc is
>>>> built (the latter is necessary on some architectures to get the
>>>> right
>>>> stack-protector configuration for bootstrapping glibc, but may be
>>>> useful
>>>> in other cases as well).
>>>>
>>>> My main concern about this patch is the one I gave in
>>>> <https://sourceware.org/ml/libc-alpha/2019-08/msg00086.html>
>>>> about what
>>>> the configuration mechanism should be, on a whole-toolchain
>>>> level, to say
>>>> whether you are OK with a requirement for a 4.8 or later kernel.
>>>>
>>>
>>> Sorry for the late reply.
>>>
>>> I was waiting to backport [1] to most of the glibc release branches
>>> in
>>> use, but I got sidetracked along the way.
>>>
>>> After this patch lands the preferred way to configure gcc would be
>>> using
>>> --with-glibc-version=2.31 and to use said glibc.
>>> If the user/distribution can live with minimal kernel requirement
>>> of 4.8
>>> the glibc used should be configured with --enable-kernel=4.8.
>>> I also plan to backport the [1] to limit the opportunity for
>>> building
>>> the possibly broken glibc with the gcc w/ enabled .note.GNU-stack.
>>>
>>> This is all tedious and user has to be aware of all of it to make
>>> it
>>> work, but hopefully over time the distributions will default to
>>> --with-glibc-version=2.31 and --enable-kernel=4.8. I guess
>>> providing the
>>> detailed NEWS entry for this change would help a bit.
>>>
>>> Is there any objections to getting this on the trunk before the end
>>> of
>>> stage1?
>>>
>>> [1] https://sourceware.org/ml/libc-alpha/2019-08/msg00639.html
>>>
>>
>> Small update and gentle ping. The glibc change was backported all
>> the
>> way back to 2.24.
> I think this is fine.  And yes, we'd like to get it mentioned in the
> release notes since I suspect folks will want the GNU-stack ELF notes.
>
> jeff
>
>

I left this to fall through the cracks once again. In light of [1], is 
there any leeway for me to push this now?

[1] https://gcc.gnu.org/ml/gcc/2020-01/msg00199.html



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2020-01-23 11:14             ` Dragan Mladjenovic
@ 2020-01-23 15:22               ` Jeff Law
  2020-01-29 12:20               ` Tobias Burnus
  1 sibling, 0 replies; 18+ messages in thread
From: Jeff Law @ 2020-01-23 15:22 UTC (permalink / raw)
  To: Dragan Mladjenovic, Richard Biener
  Cc: Joseph Myers, gcc-patches, Jakub Jelinek, Matthew Fortune,
	Maciej W . Rozycki, Faraz Shahbazker, Aurelien Jarno

On Thu, 2020-01-23 at 10:58 +0000, Dragan Mladjenovic wrote:
> On 07.12.2019. 19:33, Jeff Law wrote:
> > On Thu, 2019-11-07 at 17:05 +0000, Dragan Mladjenovic wrote:
> > > On 01.11.2019. 11:32, Dragan Mladjenovic wrote:
> > > > On 10.08.2019. 00:15, Joseph Myers wrote:
> > > > > On Fri, 9 Aug 2019, Jeff Law wrote:
> > > > > 
> > > > > > > 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
> > > > > > > 
> > > > > > >      * config.in: Regenerated.
> > > > > > >      * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define
> > > > > > > to 1
> > > > > > >      for TARGET_LIBC_GNUSTACK.
> > > > > > >      * configure: Regenerated.
> > > > > > >      * configure.ac: Define TARGET_LIBC_GNUSTACK if glibc
> > > > > > > version is
> > > > > > >      found 2.31 or greater.
> > > > > > My only concern here is the configure bits.  So for example,
> > > > > > will it do
> > > > > > the right thing if you're cross-compiling to a MIPS linux
> > > > > > target?  If
> > > > > > so, how?  If not, do we need to make it a first class configure
> > > > > > option
> > > > > > so that it can be specified when building cross MIPS linux
> > > > > > toolchains?
> > > > > 
> > > > > The key point of using GCC_GLIBC_VERSION_GTE_IFELSE is that (a)
> > > > > it checks
> > > > > the target glibc headers if available when GCC is built and (b)
> > > > > if not
> > > > > available, you can still use --with-glibc-version when
> > > > > configuring
> > > > > GCC, to
> > > > > get the right configuration in a bootstrap compiler built before
> > > > > glibc is
> > > > > built (the latter is necessary on some architectures to get the
> > > > > right
> > > > > stack-protector configuration for bootstrapping glibc, but may be
> > > > > useful
> > > > > in other cases as well).
> > > > > 
> > > > > My main concern about this patch is the one I gave in
> > > > > <https://sourceware.org/ml/libc-alpha/2019-08/msg00086.html>
> > > > > about what
> > > > > the configuration mechanism should be, on a whole-toolchain
> > > > > level, to say
> > > > > whether you are OK with a requirement for a 4.8 or later kernel.
> > > > > 
> > > > 
> > > > Sorry for the late reply.
> > > > 
> > > > I was waiting to backport [1] to most of the glibc release branches
> > > > in
> > > > use, but I got sidetracked along the way.
> > > > 
> > > > After this patch lands the preferred way to configure gcc would be
> > > > using
> > > > --with-glibc-version=2.31 and to use said glibc.
> > > > If the user/distribution can live with minimal kernel requirement
> > > > of 4.8
> > > > the glibc used should be configured with --enable-kernel=4.8.
> > > > I also plan to backport the [1] to limit the opportunity for
> > > > building
> > > > the possibly broken glibc with the gcc w/ enabled .note.GNU-stack.
> > > > 
> > > > This is all tedious and user has to be aware of all of it to make
> > > > it
> > > > work, but hopefully over time the distributions will default to
> > > > --with-glibc-version=2.31 and --enable-kernel=4.8. I guess
> > > > providing the
> > > > detailed NEWS entry for this change would help a bit.
> > > > 
> > > > Is there any objections to getting this on the trunk before the end
> > > > of
> > > > stage1?
> > > > 
> > > > [1] https://sourceware.org/ml/libc-alpha/2019-08/msg00639.html
> > > > 
> > > 
> > > Small update and gentle ping. The glibc change was backported all
> > > the
> > > way back to 2.24.
> > I think this is fine.  And yes, we'd like to get it mentioned in the
> > release notes since I suspect folks will want the GNU-stack ELF notes.
> > 
> > jeff
> > 
> > 
> 
> I left this to fall through the cracks once again. In light of [1], is 
> there any leeway for me to push this now?
> 
> [1] https://gcc.gnu.org/ml/gcc/2020-01/msg00199.html
We generally allow more leeway for the ports simply because getting
something wrong doesn't have as wide an impact.  Additionally, you're
using a configure-time flag to turn on the new behavior which further
limits the impact if something were to go wrong.

So if you want to commit it now, go ahead

jeff
> 
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2020-01-23 11:14             ` Dragan Mladjenovic
  2020-01-23 15:22               ` Jeff Law
@ 2020-01-29 12:20               ` Tobias Burnus
  2020-01-30  0:14                 ` [EXTERNAL]Re: " Dragan Mladjenovic
  1 sibling, 1 reply; 18+ messages in thread
From: Tobias Burnus @ 2020-01-29 12:20 UTC (permalink / raw)
  To: Dragan Mladjenovic, Richard Biener
  Cc: law, Joseph Myers, gcc-patches, Jakub Jelinek, Matthew Fortune,
	Maciej W . Rozycki, Faraz Shahbazker, Aurelien Jarno

[-- Attachment #1: Type: text/plain, Size: 882 bytes --]

Hi Dragan,

I think your committed patch was incomplete – at least I see the 
following bits when running --enable-maintainer-mode (see attachment, 
line numbers wrong as I edited my changes out).

Can you re-check?

(The other change in gcc/configure seems to be due to Andrew Burgess's 
e7c26e04b2dd6266d62d5a5825ff7eb44d1cf14e )

Tobias

PS: The following was committed as 54b3d52c3cca836c7c4c08cc9c02eda6c096372a

On 1/23/20 11:58 AM, Dragan Mladjenovic wrote: […]
>>>>>>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>>>>>>
>>>>>>>       * config.in: Regenerated.
>>>>>>>       * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define
>>>>>>> to 1
>>>>>>>       for TARGET_LIBC_GNUSTACK.
>>>>>>>       * configure: Regenerated.
>>>>>>>       * configure.ac: Define TARGET_LIBC_GNUSTACK if glibc
>>>>>>> version is
>>>>>>>       found 2.31 or greater.

[-- Attachment #2: generated.diff --]
[-- Type: text/x-patch, Size: 5182 bytes --]

diff --git a/gcc/config.in b/gcc/config.in
index ec5c46abdb5..05dc9499f22 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -2185,6 +2191,12 @@
 #endif
 
 
+/* Define if your target C Library properly handles PT_GNU_STACK */
+#ifndef USED_FOR_TARGET
+#undef TARGET_LIBC_GNUSTACK
+#endif
+
+
 /* Define if your target C Library provides the AT_HWCAP value in the TCB */
 #ifndef USED_FOR_TARGET
 #undef TARGET_LIBC_PROVIDES_HWCAP_IN_TCB
diff --git a/gcc/configure b/gcc/configure
index 490fe6ac8e8..facbbacd06a 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -974,6 +974,7 @@ with_zstd_include
 with_zstd_lib
 enable_rpath
 with_libiconv_prefix
+with_libiconv_type
 enable_sjlj_exceptions
 with_gcc_major_version_only
 enable_secureplt
@@ -1811,6 +1812,7 @@ Optional Packages:
   --with-gnu-ld           assume the C compiler uses GNU ld default=no
   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
   --without-libiconv-prefix     don't search for libiconv in includedir and libdir
+  --with-libiconv-type=TYPE     type of library to search for (auto/static/shared)
   --with-gcc-major-version-only
                           use only GCC major number in filesystem paths
   --with-pic              try to use only PIC/non-PIC objects [default=use
@@ -10730,6 +10732,16 @@ if test "${with_libiconv_prefix+set}" = set; then :
 
 fi
 
+
+# Check whether --with-libiconv-type was given.
+if test "${with_libiconv_type+set}" = set; then :
+  withval=$with_libiconv_type;  with_libiconv_type=$withval
+else
+   with_libiconv_type=auto
+fi
+
+  lib_type=`eval echo \$with_libiconv_type`
+
       LIBICONV=
   LTLIBICONV=
   INCICONV=
@@ -10767,13 +10779,13 @@ fi
           found_so=
           found_a=
           if test $use_additional = yes; then
-            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext" && test x$lib_type != xstatic; then
               found_dir="$additional_libdir"
               found_so="$additional_libdir/lib$name.$shlibext"
               if test -f "$additional_libdir/lib$name.la"; then
                 found_la="$additional_libdir/lib$name.la"
               fi
-            else
+            elif test x$lib_type != xshared; then
               if test -f "$additional_libdir/lib$name.$libext"; then
                 found_dir="$additional_libdir"
                 found_a="$additional_libdir/lib$name.$libext"
@@ -10797,13 +10809,13 @@ fi
               case "$x" in
                 -L*)
                   dir=`echo "X$x" | sed -e 's/^X-L//'`
-                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext" && test x$lib_type != xstatic; then
                     found_dir="$dir"
                     found_so="$dir/lib$name.$shlibext"
                     if test -f "$dir/lib$name.la"; then
                       found_la="$dir/lib$name.la"
                     fi
-                  else
+                  elif test x$lib_type != xshared; then
                     if test -f "$dir/lib$name.$libext"; then
                       found_dir="$dir"
                       found_a="$dir/lib$name.$libext"
@@ -11031,8 +11043,13 @@ fi
               done
             fi
           else
-                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
-            LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
+                                                            if x$lib_type = xauto || x$lib_type = xshared; then
+              LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+              LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
+            else
+              LIBICONV="${LIBICONV}${LIBICONV:+ }-l:lib$name.$libext"
+              LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l:lib$name.$libext"
+            fi
           fi
         fi
       fi
@@ -18957,7 +18974,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18960 "configure"
+#line 18977 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19063,7 +19080,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19066 "configure"
+#line 19083 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -29800,6 +29850,23 @@ $as_echo "#define TARGET_LIBC_PROVIDES_HWCAP_IN_TCB 1" >>confdefs.h
 
 fi
 
+# Check if the target LIBC handles PT_GNU_STACK.
+gcc_cv_libc_gnustack=unknown
+case "$target" in
+  mips*-*-linux*)
+
+if test $glibc_version_major -gt 2 \
+  || ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 31 ); then :
+  gcc_cv_libc_gnustack=yes
+fi
+    ;;
+esac
+if test x$gcc_cv_libc_gnustack = xyes; then
+
+$as_echo "#define TARGET_LIBC_GNUSTACK 1" >>confdefs.h
+
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dl_iterate_phdr in target C library" >&5
 $as_echo_n "checking dl_iterate_phdr in target C library... " >&6; }
 gcc_cv_target_dl_iterate_phdr=unknown

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [EXTERNAL]Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2020-01-29 12:20               ` Tobias Burnus
@ 2020-01-30  0:14                 ` Dragan Mladjenovic
  2020-01-30  9:20                   ` Dragan Mladjenovic
  0 siblings, 1 reply; 18+ messages in thread
From: Dragan Mladjenovic @ 2020-01-30  0:14 UTC (permalink / raw)
  To: Tobias Burnus
  Cc: Richard Biener, law, Joseph Myers, gcc-patches, Jakub Jelinek,
	Matthew Fortune, Maciej W . Rozycki, Faraz Shahbazker,
	Aurelien Jarno


On 29.01.2020. 12:06, Tobias Burnus wrote:
> Hi Dragan,
>
> I think your committed patch was incomplete – at least I see the
> following bits when running --enable-maintainer-mode (see attachment,
> line numbers wrong as I edited my changes out).
>
> Can you re-check?
>
> (The other change in gcc/configure seems to be due to Andrew Burgess's
> e7c26e04b2dd6266d62d5a5825ff7eb44d1cf14e )
>
> Tobias
>
> PS: The following was committed as 54b3d52c3cca836c7c4c08cc9c02eda6c096372a
>
> On 1/23/20 11:58 AM, Dragan Mladjenovic wrote: […]
>>>>>>>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>>>>>>>
>>>>>>>>       * config.in: Regenerated.
>>>>>>>>       * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define
>>>>>>>> to 1
>>>>>>>>       for TARGET_LIBC_GNUSTACK.
>>>>>>>>       * configure: Regenerated.
>>>>>>>>       * configure.ac: Define TARGET_LIBC_GNUSTACK if glibc
>>>>>>>> version is
>>>>>>>>       found 2.31 or greater.

Thank you for letting me know.

Your change looks fine. How should I handle this? Do I just commit the 
portion related to my change or perhaps you wish to commit everything
altogether?


Best regards,
Dragan



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.
  2020-01-30  0:14                 ` [EXTERNAL]Re: " Dragan Mladjenovic
@ 2020-01-30  9:20                   ` Dragan Mladjenovic
  0 siblings, 0 replies; 18+ messages in thread
From: Dragan Mladjenovic @ 2020-01-30  9:20 UTC (permalink / raw)
  To: Tobias Burnus
  Cc: Richard Biener, law, Joseph Myers, gcc-patches, Jakub Jelinek,
	Matthew Fortune, Maciej W . Rozycki, Faraz Shahbazker,
	Aurelien Jarno

On 29.01.2020. 22:57, Dragan Mladjenovic wrote:
>
> On 29.01.2020. 12:06, Tobias Burnus wrote:
>> Hi Dragan,
>>
>> I think your committed patch was incomplete – at least I see the
>> following bits when running --enable-maintainer-mode (see attachment,
>> line numbers wrong as I edited my changes out).
>>
>> Can you re-check?
>>
>> (The other change in gcc/configure seems to be due to Andrew Burgess's
>> e7c26e04b2dd6266d62d5a5825ff7eb44d1cf14e )
>>
>> Tobias
>>
>> PS: The following was committed as
>> 54b3d52c3cca836c7c4c08cc9c02eda6c096372a
>>
>> On 1/23/20 11:58 AM, Dragan Mladjenovic wrote: […]
>>>>>>>>> 2019-08-05  Dragan Mladjenovic  <dmladjenovic@wavecomp.com>
>>>>>>>>>
>>>>>>>>>       * config.in: Regenerated.
>>>>>>>>>       * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define
>>>>>>>>> to 1
>>>>>>>>>       for TARGET_LIBC_GNUSTACK.
>>>>>>>>>       * configure: Regenerated.
>>>>>>>>>       * configure.ac: Define TARGET_LIBC_GNUSTACK if glibc
>>>>>>>>> version is
>>>>>>>>>       found 2.31 or greater.
>
> Thank you for letting me know.
>
> Your change looks fine. How should I handle this? Do I just commit the
> portion related to my change or perhaps you wish to commit everything
> altogether?

Ok, I now see that that e7c26e04b2dd6266d62d5a5825ff7eb44d1cf14e 
mentions that files will be regenerated later. So I went ahead and
committed this as e0332517f900c7947f03c15fd27e7f71ace98629.

Best regards,
Dragan

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-01-30  8:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05 10:43 [PATCH 0/2] [MIPS] Emit .note.GNU-stack for linux targets Dragan Mladjenovic
2019-08-05 10:48 ` [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float " Dragan Mladjenovic
2019-08-09 21:36   ` Jeff Law
2019-08-12 16:34     ` [EXTERNAL]Re: " Dragan Mladjenovic
2019-08-20  7:26       ` Jeff Law
2019-08-05 10:49 ` [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float " Dragan Mladjenovic
2019-08-09 21:38   ` Jeff Law
2019-08-09 23:13     ` Joseph Myers
2019-11-01 10:32       ` Dragan Mladjenovic
2019-11-07 17:05         ` Dragan Mladjenovic
2019-11-27 18:59           ` [PING] " Dragan Mladjenovic
2019-12-07 18:33           ` Jeff Law
2020-01-23 11:14             ` Dragan Mladjenovic
2020-01-23 15:22               ` Jeff Law
2020-01-29 12:20               ` Tobias Burnus
2020-01-30  0:14                 ` [EXTERNAL]Re: " Dragan Mladjenovic
2020-01-30  9:20                   ` Dragan Mladjenovic
2019-08-09 22:03   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).