FreeBSD Bugzilla – Attachment 194204 Details for
Bug 228290
[patch] elfdump -n does not recognise notes sections
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
More desriptive elfdump patch
elfdump.patch (text/plain), 2.22 KB, created by
Dan McGregor
on 2018-06-12 18:37:10 UTC
(
hide
)
Description:
More desriptive elfdump patch
Filename:
MIME Type:
Creator:
Dan McGregor
Created:
2018-06-12 18:37:10 UTC
Size:
2.22 KB
patch
obsolete
>From 15b94f4dab9537cf8ab527fed8331bf56de42454 Mon Sep 17 00:00:00 2001 >From: Dan McGregor <dan.mcgregor@usask.ca> >Date: Tue, 29 May 2018 16:12:06 -0600 >Subject: [PATCH] Be more descriptive with ELF notes > >Display the note type as well as its data with elfdump -n >--- > usr.bin/elfdump/elfdump.c | 21 ++++++++++++++++----- > 1 file changed, 16 insertions(+), 5 deletions(-) > >diff --git a/usr.bin/elfdump/elfdump.c b/usr.bin/elfdump/elfdump.c >index e4240663786d..406f686696d4 100644 >--- a/usr.bin/elfdump/elfdump.c >+++ b/usr.bin/elfdump/elfdump.c >@@ -316,6 +316,10 @@ static const char *p_flags[] = { > "PF_X|PF_W|PF_R" > }; > >+static const char *nt_types[] = { >+ "", "NT_FREEBSD_ABI_TAG", "NT_FREEBSD_NOINIT_TAG", "NT_FREEBSD_ARCH_TAG" >+}; >+ > /* http://www.sco.com/developers/gabi/latest/ch4.sheader.html#sh_type */ > static const char * > sh_types(uint64_t machine, uint64_t sht) { >@@ -659,7 +663,8 @@ main(int ac, char **av) > case SHT_NOTE: > name = elf_get_word(e, v, SH_NAME); > if (flags & ED_NOTE && >- strcmp(shstrtab + name, ".note.tag") == 0) >+ (strcmp(shstrtab + name, ".note.tag") == 0 || >+ strcmp(shstrtab + name, ".note.ABI-tag") == 0)) > elf_print_note(e, v); > break; > case SHT_DYNSYM: >@@ -1052,19 +1057,25 @@ elf_print_note(Elf32_Ehdr *e, void *sh) > u_int32_t namesz; > u_int32_t descsz; > u_int32_t desc; >+ u_int32_t type; > char *n, *s; >+ const char *nt_type; > > offset = elf_get_off(e, sh, SH_OFFSET); > size = elf_get_size(e, sh, SH_SIZE); > name = elf_get_word(e, sh, SH_NAME); > n = (char *)e + offset; > fprintf(out, "\nnote (%s):\n", shstrtab + name); >- while (n < ((char *)e + offset + size)) { >+ while (n < ((char *)e + offset + size)) { > namesz = elf_get_word(e, n, N_NAMESZ); > descsz = elf_get_word(e, n, N_DESCSZ); >- s = n + sizeof(Elf_Note); >- desc = elf_get_word(e, n + sizeof(Elf_Note) + namesz, 0); >- fprintf(out, "\t%s %d\n", s, desc); >+ type = elf_get_word(e, n, N_TYPE); >+ nt_type = nt_types[type]; >+ if (type < NT_FREEBSD_ABI_TAG || type > NT_FREEBSD_ARCH_TAG) >+ nt_type = "Unknown type"; >+ s = n + sizeof(Elf_Note); >+ desc = elf_get_word(e, n + sizeof(Elf_Note) + namesz, 0); >+ fprintf(out, "\t%s %d (%s)\n", s, desc, nt_type); > n += sizeof(Elf_Note) + namesz + descsz; > } > } >-- >2.18.0-rc >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 228290
:
193451
| 194204