aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog16
-rw-r--r--binutils/readelf.c18
-rw-r--r--binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d2
-rw-r--r--binutils/testsuite/binutils-all/mips/global-local-symtab-sort-o32t.d2
-rw-r--r--binutils/testsuite/binutils-all/readelf.s-642
-rw-r--r--binutils/testsuite/binutils-all/readelf.ss-64-unused6
-rw-r--r--binutils/testsuite/binutils-all/readelf.ss-tmips32
-rw-r--r--binutils/testsuite/binutils-all/readelf.ss-unused6
8 files changed, 57 insertions, 27 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index d1d87cc..033dd58 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,19 @@
+2021-04-21 Nick Clifton <nickc@redhat.com>
+
+ * testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d:
+ Adjust expected output to allow for named section symbols.
+ * testsuite/binutils-all/mips/global-local-symtab-sort-o32t.d:
+ Likewise.
+ * testsuite/binutils-all/readelf.s-64: Likewise.
+ * testsuite/binutils-all/readelf.ss-64-unused: Likewise.
+ * testsuite/binutils-all/readelf.ss-tmips: Likewise.
+ * testsuite/binutils-all/readelf.ss-unused: Likewise.
+
+2021-04-21 Luo Longjun <luolongjun@huawei.com>
+
+ * readelf.c (print_dynamic_symbol): Print the section name for
+ section symbols without a name of their own.
+
2021-04-20 Andreas Krebbel <krebbel@linux.ibm.com>
* MAINTAINERS: Remove Martin Schwidefsky as s390 maintainer and
diff --git a/binutils/readelf.c b/binutils/readelf.c
index b404ca7..c8a76de 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12381,6 +12381,8 @@ print_dynamic_symbol (Filedata *filedata, unsigned long si,
const char *version_string;
enum versioned_symbol_info sym_info;
unsigned short vna_other;
+ bool is_valid;
+ const char * sstr;
Elf_Internal_Sym *psym = symtab + si;
printf ("%6ld: ", si);
@@ -12404,8 +12406,20 @@ print_dynamic_symbol (Filedata *filedata, unsigned long si,
}
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
- bool is_valid = VALID_SYMBOL_NAME (strtab, strtab_size, psym->st_name);
- const char * sstr = is_valid ? strtab + psym->st_name : _("<corrupt>");
+ if (ELF_ST_TYPE (psym->st_info) == STT_SECTION
+ && psym->st_shndx < filedata->file_header.e_shnum
+ && psym->st_name == 0)
+ {
+ is_valid = SECTION_NAME_VALID (filedata->section_headers + psym->st_shndx);
+ sstr = is_valid ?
+ SECTION_NAME_PRINT (filedata->section_headers + psym->st_shndx)
+ : _("<corrupt>");
+ }
+ else
+ {
+ is_valid = VALID_SYMBOL_NAME (strtab, strtab_size, psym->st_name);
+ sstr = is_valid ? strtab + psym->st_name : _("<corrupt>");
+ }
version_string
= get_symbol_version_string (filedata,
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d
index e38f789..53d04b4 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d
@@ -9,6 +9,6 @@
Symbol table '\.symtab' contains 4 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1
+ 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1.*
2: 0000000000000004 4 OBJECT LOCAL DEFAULT 1 bar
3: 0000000000000000 4 OBJECT GLOBAL DEFAULT 1 foo
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-o32t.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-o32t.d
index d97322f..47978a5 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-o32t.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-o32t.d
@@ -9,6 +9,6 @@
Symbol table '\.symtab' contains 4 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 00000000 0 SECTION LOCAL DEFAULT 1
+ 1: 00000000 0 SECTION LOCAL DEFAULT 1.*
2: 00000004 4 OBJECT LOCAL DEFAULT 1 bar
3: 00000000 4 OBJECT GLOBAL DEFAULT 1 foo
diff --git a/binutils/testsuite/binutils-all/readelf.s-64 b/binutils/testsuite/binutils-all/readelf.s-64
index 5582d77..92ec05f 100644
--- a/binutils/testsuite/binutils-all/readelf.s-64
+++ b/binutils/testsuite/binutils-all/readelf.s-64
@@ -11,7 +11,7 @@ Section Headers:
+000000000000001. +000000000000001. +I +. +1 +8
+\[ 3\] .data +PROGBITS +0000000000000000 +000000(48|50)
+000000000000000[48] +0000000000000000 +WA +0 +0 +.*
- +\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58)
+ +\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58|68)
+0000000000000000 +0000000000000000 +WA +0 +0 +.*
# x86 targets may put .note.gnu.property here.
#...
diff --git a/binutils/testsuite/binutils-all/readelf.ss-64-unused b/binutils/testsuite/binutils-all/readelf.ss-64-unused
index bd10cab..f48a4b2 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-64-unused
+++ b/binutils/testsuite/binutils-all/readelf.ss-64-unused
@@ -2,9 +2,9 @@
Symbol table '.symtab' contains .* entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+0: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +UND
- +1: 0000000000000000 +0 +SECTION +LOCAL +DEFAULT +1
- +2: 0000000000000000 +0 +SECTION +LOCAL +DEFAULT +3
- +3: 0000000000000000 +0 +SECTION +LOCAL +DEFAULT +4
+ +1: 0000000000000000 +0 +SECTION +LOCAL +DEFAULT +1.*
+ +2: 0000000000000000 +0 +SECTION +LOCAL +DEFAULT +3.*
+ +3: 0000000000000000 +0 +SECTION +LOCAL +DEFAULT +4.*
+4: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
# aarch64-elf targets add the $d mapping symbol here...
#...
diff --git a/binutils/testsuite/binutils-all/readelf.ss-tmips b/binutils/testsuite/binutils-all/readelf.ss-tmips
index 4fd7fe0..87ec138 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-tmips
+++ b/binutils/testsuite/binutils-all/readelf.ss-tmips
@@ -1,19 +1,19 @@
Symbol table '.symtab' contains 16 entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
- +0: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +UND
- +1: 00000000 +0 +SECTION +LOCAL +DEFAULT +1
- +2: 00000000 +0 +SECTION +LOCAL +DEFAULT +3
- +3: 00000000 +0 +SECTION +LOCAL +DEFAULT +4
- +4: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
- +5: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol
- +6: 00000000 +0 +SECTION +LOCAL +DEFAULT +5
- +7: 00000000 +0 +SECTION +LOCAL +DEFAULT +6
- +8: 00000000 +0 +SECTION +LOCAL +DEFAULT +7
- +9: 00000000 +0 +SECTION +LOCAL +DEFAULT +8
- +10: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
- +11: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
- +12: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +3 data_symbol
- +13: 00000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol
- +14: 00000008 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol2
- +15: 0000000c +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol3
+ +0: 0+000000 +0 +NOTYPE +LOCAL +DEFAULT +UND
+ +1: 0+000000 +0 +SECTION +LOCAL +DEFAULT +1.*
+ +2: 0+000000 +0 +SECTION +LOCAL +DEFAULT +3.*
+ +3: 0+000000 +0 +SECTION +LOCAL +DEFAULT +4.*
+ +4: 0+000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
+ +5: 0+000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol
+ +6: 0+000000 +0 +SECTION +LOCAL +DEFAULT +5.*
+ +7: 0+000000 +0 +SECTION +LOCAL +DEFAULT +6.*
+ +8: 0+000000 +0 +SECTION +LOCAL +DEFAULT +7.*
+ +9: 0+000000 +0 +SECTION +LOCAL +DEFAULT +8.*
+ +10: 0+000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
+ +11: 0+000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
+ +12: 0+000000 +0 +NOTYPE +GLOBAL +DEFAULT +3 data_symbol
+ +13: 0+000004 +4 +(COMMON|OBJECT) +GLOBAL +DEFAULT +(PRC|COM) common_symbol
+ +14: 0+000008 +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol2
+ +15: 0+00000c +0 +NOTYPE +GLOBAL +DEFAULT +. text_symbol3
diff --git a/binutils/testsuite/binutils-all/readelf.ss-unused b/binutils/testsuite/binutils-all/readelf.ss-unused
index acc6d93..3107af9 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-unused
+++ b/binutils/testsuite/binutils-all/readelf.ss-unused
@@ -2,9 +2,9 @@
Symbol table '.symtab' contains .* entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
+0: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +UND
- +1: 00000000 +0 +SECTION +LOCAL +DEFAULT +1
- +2: 00000000 +0 +SECTION +LOCAL +DEFAULT +[34]
- +3: 00000000 +0 +SECTION +LOCAL +DEFAULT +[45]
+ +1: 00000000 +0 +SECTION +LOCAL +DEFAULT +1.*
+ +2: 00000000 +0 +SECTION +LOCAL +DEFAULT +[34].*
+ +3: 00000000 +0 +SECTION +LOCAL +DEFAULT +[45].*
+4: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +1 static_text_symbol
# ARM targets add the $d mapping symbol here...
# NDS32 targets add the $d2 mapping symbol here...