[2/3] ld: correctly handle QNX --lazy-stack without -zstack-size

Message ID 20231013080248.219837-2-chigot@adacore.com
State New
Headers
Series [1/3] ld: allow update of existing QNX stack note |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_check--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Clément Chigot Oct. 13, 2023, 8:02 a.m. UTC
  The warning was skipped if -zstack-size is not provided.

ld/ChangeLog:

        * emultempl/nto.em: Move --lazy-stack warning before missing
        -zstack-size skip.
---
 ld/emultempl/nto.em | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Nick Clifton Oct. 13, 2023, 2:06 p.m. UTC | #1
Hi Clément,

>          * emultempl/nto.em: Move --lazy-stack warning before missing
>          -zstack-size skip.

Approved - please apply.

Cheers
   Nick
  

Patch

diff --git a/ld/emultempl/nto.em b/ld/emultempl/nto.em
index 0d319acc9bf..b1a61338412 100644
--- a/ld/emultempl/nto.em
+++ b/ld/emultempl/nto.em
@@ -128,16 +128,16 @@  nto_add_note_section (void) {
   bfd_size_type h_size;
   bool is_update = false;
 
-  /* Don't create a note if none of the stack parameter have to be modified.  */
-  if (link_info.stacksize <= 0 && (link_info.execstack == link_info.noexecstack))
-    return;
-
   if (nto_lazy_stack && !link_info.stacksize)
     {
       einfo (_("%F%P: error: --lazy-stack must follow -zstack-size=<size>\n"));
       return;
     }
 
+  /* Don't create a note if none of the stack parameter have to be modified.  */
+  if (link_info.stacksize <= 0 && (link_info.execstack == link_info.noexecstack))
+    return;
+
   note_sec = nto_lookup_QNX_note_section(QNT_STACK);
   if (! note_sec)
     return;