diff options
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 11 | ||||
-rw-r--r-- | binutils/NEWS | 2 | ||||
-rw-r--r-- | binutils/readelf.c | 17 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/mbind1.s | 33 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objcopy.exp | 1 |
5 files changed, 61 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 5d81b35..d347336 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,14 @@ +2017-04-04 H.J. Lu <hongjiu.lu@intel.com> + + * NEWS: Mention support for ELF SHF_GNU_MBIND and + PT_GNU_MBIND_XXX. + * readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX. + (get_elf_section_flags): Handle SHF_GNU_MBIND. + (process_section_headers): Likewise. + * testsuite/binutils-all/mbind1.s: New file. + * testsuite/binutils-all/objcopy.exp: Run readelf test on + mbind1.s. + 2017-04-03 Nick Clifton <nickc@redhat.com> PR binutils/21345 diff --git a/binutils/NEWS b/binutils/NEWS index d9d65c7..c03539d 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -1,5 +1,7 @@ -*- text -*- +* Add support for ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX. + * Add support for the wasm32 ELF conversion of the WebAssembly file format. * Add --inlines option to objdump, which extends the --line-numbers option diff --git a/binutils/readelf.c b/binutils/readelf.c index b573921..d2b8dd4 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -3825,7 +3825,12 @@ get_segment_type (unsigned long p_type) case PT_GNU_RELRO: return "GNU_RELRO"; default: - if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC)) + if (p_type >= PT_GNU_MBIND_LO && p_type <= PT_GNU_MBIND_HI) + { + sprintf (buff, "GNU_MBIND+%#lx", + p_type - PT_GNU_MBIND_LO); + } + else if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC)) { const char * result; @@ -5544,7 +5549,9 @@ get_elf_section_flags (bfd_vma sh_flags) /* ARM specific. */ /* 21 */ { STRING_COMMA_LEN ("ENTRYSECT") }, /* 22 */ { STRING_COMMA_LEN ("ARM_PURECODE") }, - /* 23 */ { STRING_COMMA_LEN ("COMDEF") } + /* 23 */ { STRING_COMMA_LEN ("COMDEF") }, + /* GNU specific. */ + /* 24 */ { STRING_COMMA_LEN ("GNU_MBIND") }, }; if (do_section_details) @@ -5577,6 +5584,7 @@ get_elf_section_flags (bfd_vma sh_flags) case SHF_TLS: sindex = 9; break; case SHF_EXCLUDE: sindex = 18; break; case SHF_COMPRESSED: sindex = 20; break; + case SHF_GNU_MBIND: sindex = 24; break; default: sindex = -1; @@ -5670,6 +5678,7 @@ get_elf_section_flags (bfd_vma sh_flags) case SHF_TLS: *p = 'T'; break; case SHF_EXCLUDE: *p = 'E'; break; case SHF_COMPRESSED: *p = 'C'; break; + case SHF_GNU_MBIND: *p = 'D'; break; default: if ((elf_header.e_machine == EM_X86_64 @@ -6198,7 +6207,9 @@ process_section_headers (FILE * file) if (section->sh_info < 1 || section->sh_info >= elf_header.e_shnum) warn (_("[%2u]: Expected link to another section in info field"), i); } - else if (section->sh_type < SHT_LOOS && section->sh_info != 0) + else if (section->sh_type < SHT_LOOS + && (section->sh_flags & SHF_GNU_MBIND) == 0 + && section->sh_info != 0) warn (_("[%2u]: Unexpected value (%u) in info field.\n"), i, section->sh_info); break; diff --git a/binutils/testsuite/binutils-all/mbind1.s b/binutils/testsuite/binutils-all/mbind1.s new file mode 100644 index 0000000..41faad4 --- /dev/null +++ b/binutils/testsuite/binutils-all/mbind1.s @@ -0,0 +1,33 @@ + .section .mbind.data,"adw",%progbits + .byte 1 + + .section .mbind.data,"adw",%progbits,0x3 + .byte 2 + + .section .mbind.text,"adx",%progbits + .byte 3 + + .section .mbind.text,"adx",%progbits,0x3 + .byte 4 + + .section .mbind.bss,"adw",%nobits + .zero 5 + + .section .mbind.bss,"adw",%nobits,0x3 + .zero 6 + + .section .mbind.rodata,"adG",%progbits,.foo_group,comdat,0x2 + .byte 7 + + .section .mbind.data,"adGw",%progbits,.foo_group,comdat + .byte 8 + + .section .mbind.data,"adGw",%progbits,.foo_group,comdat,0x3 + .byte 9 + + # Check that .pushsection works as well. + .pushsection .mbind.text,"adGx",%progbits,.foo_group,comdat,0x3 + .byte 10 + + .popsection + .byte 11 diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index 7ecc0d5..6d57837 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -1049,6 +1049,7 @@ if [is_elf_format] { objcopy_test_readelf "ELF group" group-2.s objcopy_test_readelf "ELF group" group-3.s objcopy_test_readelf "ELF group" group-4.s + objcopy_test_readelf "GNU_MBIND section" mbind1.s run_dump_test "group-5" run_dump_test "group-6" run_dump_test "copy-1" |