Fix the linker script parser so that it will recognise the PT_GNU_RELRO segment type...
authorNick Clifton <nickc@redhat.com>
Wed, 17 Nov 2021 15:59:16 +0000 (15:59 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 17 Nov 2021 15:59:16 +0000 (15:59 +0000)
PR 28452
bfd * elf.c (assign_file_positions_for_non_load_sections): Replace
assertion with a warning message.

ld * ldgram.y: Add support for PT_GNU_RELRO and PT_GNU_PROPERTY.
* ldgram.c: Regenerate.

bfd/ChangeLog
bfd/elf.c
ld/ChangeLog
ld/ldgram.y

index d539dbbf572d58a21addc379a62415c2b84af104..35b659b4ef90410901d55d316d4b75d8f4083399 100644 (file)
@@ -1,3 +1,9 @@
+2021-11-17  Nick Clifton  <nickc@redhat.com>
+
+       PR 28452
+       * elf.c (assign_file_positions_for_non_load_sections): Replace
+       assertion with a warning message.
+
 2021-10-19  Nick Clifton  <nickc@redhat.com>
 
        * linker.c (_bfd_generic_link_add_one_symbol): Test for a NULL
index 79231e242bd8fa9935420c4aa7741d0133626a48..cfdb94922f320a69db6262c9eb9b026ba82cff9a 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6261,10 +6261,15 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
                    }
                }
            }
-         if (link_info != NULL)
-           BFD_ASSERT (ok);
+
          if (!ok)
-           memset (p, 0, sizeof *p);
+           {
+             if (link_info != NULL)
+               _bfd_error_handler
+                 (_("%pB: warning: unable to allocate any sections to PT_GNU_RELRO segment"),
+                  abfd);
+             memset (p, 0, sizeof *p);
+           }
        }
       else if (p->p_type == PT_GNU_STACK)
        {
index c23af57d1cb467cc353038a749ec8f29d3b8e634..d68b8203c0b091eec1fe15933f54acd92cf9aebc 100644 (file)
@@ -1,3 +1,9 @@
+2021-11-17  Nick Clifton  <nickc@redhat.com>
+
+       PR 28452
+       * ldgram.y: Add support for PT_GNU_RELRO and PT_GNU_PROPERTY.
+       * ldgram.c: Regenerate.
+
 2021-11-15  Roland McGrath  <mcgrathr@google.com>
 
        * testsuite/ld-aarch64/dt_textrel.d: Pass explicit -z notext in
index c8396bbfd5b9e19b86bf61c0b632fb748a270b30..2eb989df77a295de538d59d845f4407f076ea909 100644 (file)
@@ -1262,6 +1262,10 @@ phdr_type:
                            $$ = exp_intop (0x6474e550);
                          else if (strcmp (s, "PT_GNU_STACK") == 0)
                            $$ = exp_intop (0x6474e551);
+                         else if (strcmp (s, "PT_GNU_RELRO") == 0)
+                           $$ = exp_intop (0x6474e552);
+                         else if (strcmp (s, "PT_GNU_PROPERTY") == 0)
+                           $$ = exp_intop (0x6474e553);
                          else
                            {
                              einfo (_("\