Re: [EXTERNAL]Re: [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float linux targets.

2019-08-19 Thread Jeff Law
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" 
>>>
>>> gcc/ChangeLog:
>>>
>>> 2019-08-05  Dragan Mladjenovic  
>>>
>>> * 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  
>>>
>>> * 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



Re: [EXTERNAL]Re: [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float linux targets.

2019-08-12 Thread Dragan Mladjenovic
On 09.08.2019. 23:31, Jeff Law wrote:
> On 8/5/19 4:47 AM, Dragan Mladjenovic wrote:
>> From: "Dragan Mladjenovic" 
>>
>> gcc/ChangeLog:
>>
>> 2019-08-05  Dragan Mladjenovic  
>>
>>  * 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  
>>
>>  * 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


Re: [PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float linux targets.

2019-08-09 Thread Jeff Law
On 8/5/19 4:47 AM, Dragan Mladjenovic wrote:
> From: "Dragan Mladjenovic" 
> 
> gcc/ChangeLog:
> 
> 2019-08-05  Dragan Mladjenovic  
> 
>   * 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  
> 
>   * 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


[PATCH 1/2][MIPS] Emit .note.GNU-stack for soft-float linux targets.

2019-08-05 Thread Dragan Mladjenovic
From: "Dragan Mladjenovic" 

gcc/ChangeLog:

2019-08-05  Dragan Mladjenovic  

* 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  

* 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 ();
+}
 
 /* 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;
 
 #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
 .  */
 
+/* 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
 .  */
 
+/* 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 000..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
 .  */
 
+/* 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-