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

2020-01-30 Thread Dragan Mladjenovic

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  

  * 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


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

2020-01-29 Thread Dragan Mladjenovic

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  

   * 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




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

2020-01-29 Thread Tobias Burnus

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  

  * 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.
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 

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

2020-01-23 Thread Jeff Law
On Thu, 2020-01-23 at 10:58 +, Dragan Mladjenovic wrote:
> On 07.12.2019. 19:33, Jeff Law wrote:
> > On Thu, 2019-11-07 at 17: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  
> > > > > > > 
> > > > > > >  * 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
> > > > > 
> > > > > 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
> 
> 



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

2020-01-23 Thread Dragan Mladjenovic
On 07.12.2019. 19:33, Jeff Law wrote:
> On Thu, 2019-11-07 at 17: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  
>>
>>  * 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
 
 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




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

2019-12-07 Thread Jeff Law
On Thu, 2019-11-07 at 17: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  
> > > > > 
> > > > > * 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
> > > 
> > > 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




[PING] Re: [PATCH 2/2][MIPS][RFC] Emit .note.GNU-stack for hard-float linux targets.

2019-11-27 Thread Dragan Mladjenovic
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  
>
> * 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
>>>  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.


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

2019-11-07 Thread Dragan Mladjenovic
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  

 * 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
>>  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



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

2019-11-01 Thread Dragan Mladjenovic
On 10.08.2019. 00:15, Joseph Myers wrote:
> On Fri, 9 Aug 2019, Jeff Law wrote:
>
>>> 2019-08-05  Dragan Mladjenovic  
>>>
>>> * 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
>  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


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

2019-08-09 Thread Joseph Myers
On Fri, 9 Aug 2019, Jeff Law wrote:

> > 2019-08-05  Dragan Mladjenovic  
> > 
> > * 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 
 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
jos...@codesourcery.com


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

2019-08-09 Thread Maciej W. Rozycki
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


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

2019-08-09 Thread Jeff Law
On 8/5/19 4:49 AM, Dragan Mladjenovic wrote:
> From: "Dragan Mladjenovic" 
> 
> libgcc/ChangeLog:
> 
> 2019-08-05  Dragan Mladjenovic  
> 
>   * config/mips/gnustack.h: Check for TARGET_LIBC_GNUSTACK also.
> 
> gcc/ChangeLog:
> 
> 2019-08-05  Dragan Mladjenovic  
> 
>   * 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


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

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

libgcc/ChangeLog:

2019-08-05  Dragan Mladjenovic  

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

gcc/ChangeLog:

2019-08-05  Dragan Mladjenovic  

* 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