Teach readelf and objdump about the PT_OPENBSD_BOOTDATA section value.
authorguenther <guenther@openbsd.org>
Wed, 10 Aug 2016 20:46:08 +0000 (20:46 +0000)
committerguenther <guenther@openbsd.org>
Wed, 10 Aug 2016 20:46:08 +0000 (20:46 +0000)
Teach ld to access that and PT_GNU_RELRO in linker scripts.

ok deraadt@

gnu/usr.bin/binutils-2.17/bfd/elf.c
gnu/usr.bin/binutils-2.17/binutils/readelf.c
gnu/usr.bin/binutils-2.17/include/elf/common.h
gnu/usr.bin/binutils-2.17/ld/ldgram.y

index c74b850..eed6dd0 100644 (file)
@@ -1087,6 +1087,7 @@ get_segment_type (unsigned int p_type)
     case PT_GNU_RELRO: pt = "RELRO"; break;
     case PT_OPENBSD_RANDOMIZE: pt = "OPENBSD_RANDOMIZE"; break;
     case PT_OPENBSD_WXNEEDED: pt = "OPENBSD_WXNEEDED"; break;
+    case PT_OPENBSD_BOOTDATA: pt = "OPENBSD_BOOTDATA"; break;
     default: pt = NULL; break;
     }
   return pt;
index fe8b520..85a7c18 100644 (file)
@@ -2390,6 +2390,8 @@ get_segment_type (unsigned long p_type)
                        return "OPENBSD_RANDOMIZE";
     case PT_OPENBSD_WXNEEDED:
                        return "OPENBSD_WXNEEDED";
+    case PT_OPENBSD_BOOTDATA:
+                       return "OPENBSD_BOOTDATA";
 
     default:
       if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC))
index da0a9df..8f12f47 100644 (file)
 
 #define PT_OPENBSD_RANDOMIZE   0x65a3dbe6 /* Fill with random data. */
 #define PT_OPENBSD_WXNEEDED    0x65a3dbe7 /* Program does W^X violations */
+#define PT_OPENBSD_BOOTDATA    0x65a41be6 /* Section for boot arguments */
 
 /* Program segment permissions, in program header p_flags field.  */
 
index 4320558..33ccd4d 100644 (file)
@@ -1089,10 +1089,14 @@ 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_OPENBSD_RANDOMIZE") == 0)
                            $$ = exp_intop (0x65a3dbe6);
                          else if (strcmp (s, "PT_OPENBSD_WXNEEDED") == 0)
                            $$ = exp_intop (0x65a3dbe7);
+                         else if (strcmp (s, "PT_OPENBSD_BOOTDATA") == 0)
+                           $$ = exp_intop (0x65a41be6);
                          else
                            {
                              einfo (_("\