[Toybox] [PATCH] toybox: Make readelf aware of NT_ANDROID_TYPE_PAD_SEGMENT

Kalesh Singh kaleshsingh at google.com
Wed Feb 7 13:23:53 PST 2024


Android includes a new note in of type NT_ANDROID_TYPE_PAD_SEGMENT [1],
make readelf -n able to decode notes for this type.

[1] https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/arch-common/bionic/crt_pad_segment.S
Signed-off-by: Kalesh Singh <kaleshsingh at google.com>
---
 toys/other/readelf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/toys/other/readelf.c b/toys/other/readelf.c
index 15e5e7d7..19387360 100644
--- a/toys/other/readelf.c
+++ b/toys/other/readelf.c
@@ -424,6 +424,8 @@ static void show_notes(unsigned long offset, unsigned long size)
       if (type == 1) {
         printf("NT_VERSION\tAPI level %u", elf_int(&p)), j=1;
         if (descsz>=132) printf(", NDK %.64s (%.64s)", p, p+64);
+      } else if (type == 5) {
+        printf("NT_PAD_SEGMENT\tpad_segment=%u", elf_int(&p)), j=1;
       } else p -= 8;
     } else if (notematch(namesz, &p, "CORE")) {
       if (*(desc = nt_type_core(type)) != '0') printf("%s", desc), j=1;
-- 
2.43.0.594.gd9cf4e227d-goog



More information about the Toybox mailing list