readelf truncates symbol names in relocation sections
Julian v. Bock
julian@OpenIT.DE
Thu Dec 20 03:25:00 GMT 2001
More information about the Binutils mailing list
Thu Dec 20 03:25:00 GMT 2001
- Previous message (by thread): readelf truncates symbol names in relocation sections
- Next message (by thread): readelf truncates symbol names in relocation sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi >>>>> "Julian" == Julian v Bock <julian@OpenIT.DE> writes: Julian> Just recognized that the CVS version already includes the Julian> --wide switch. I am going to truncate the symbol names Julian> accordingly. I have prepared a new patch. All symbol names (not just the symbols from relocation sections) are truncated to 25 characters unless the --wide switch is used. Julian diff -ruN binutils/binutils/ChangeLog binutils.new/binutils/ChangeLog --- binutils/binutils/ChangeLog Mon Dec 10 13:27:17 2001 +++ binutils.new/binutils/ChangeLog Thu Dec 20 01:28:04 2001 @@ -1,3 +1,11 @@ +2001-12-20 Julian v. Bock <julian@wongr.net> + + * readelf.c (print_symbol): New function: Print a formatted symbol + name. + (dump_relocations): Use print_symbol() to print symbol names. + (process_symbol_table): Likewise. + (process_mips_specific): Likewise. + 2001-12-10 Jakub Jelinek <jakub@redhat.com> * objcopy.c (setup_section): Copy entsize. diff -ruN binutils/binutils/readelf.c binutils.new/binutils/readelf.c --- binutils/binutils/readelf.c Mon Dec 10 13:27:17 2001 +++ binutils.new/binutils/readelf.c Thu Dec 20 01:06:29 2001 @@ -152,6 +152,7 @@ /* Forward declarations for dumb compilers. */ static void print_vma PARAMS ((bfd_vma, print_mode)); +static void print_symbol PARAMS ((char *)); static bfd_vma (* byte_get) PARAMS ((unsigned char *, int)); static bfd_vma byte_get_little_endian PARAMS ((unsigned char *, int)); static bfd_vma byte_get_big_endian PARAMS ((unsigned char *, int)); @@ -494,6 +495,14 @@ #endif } +static void +print_symbol (symbol) + char * symbol; +{ + char * fmt = do_wide ? "%s" : "%-.25s"; + printf (fmt, symbol); +} + static bfd_vma byte_get_big_endian (field, size) unsigned char * field; @@ -1041,12 +1050,11 @@ printf (" "); if (psym->st_name == 0) - printf ("%-25.25s", - SECTION_NAME (section_headers + psym->st_shndx)); + print_symbol (SECTION_NAME (section_headers + psym->st_shndx)); else if (strtab == NULL) printf (_("<string table index %3ld>"), psym->st_name); else - printf ("%-25.25s", strtab + psym->st_name); + print_symbol (strtab + psym->st_name); if (is_rela) printf (" + %lx", (unsigned long) relas [i].r_addend); @@ -5192,8 +5200,9 @@ printf (" %6s", get_symbol_type (ELF_ST_TYPE (psym->st_info))); printf (" %6s", get_symbol_binding (ELF_ST_BIND (psym->st_info))); printf (" %3s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other))); - printf (" %3.3s", get_symbol_index_type (psym->st_shndx)); - printf (" %s\n", dynamic_strings + psym->st_name); + printf (" %3.3s ", get_symbol_index_type (psym->st_shndx)); + print_symbol (dynamic_strings + psym->st_name); + printf ("\n"); } } } @@ -5252,8 +5261,8 @@ printf (" %-7s", get_symbol_type (ELF_ST_TYPE (psym->st_info))); printf (" %-6s", get_symbol_binding (ELF_ST_BIND (psym->st_info))); printf (" %-3s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other))); - printf (" %4s", get_symbol_index_type (psym->st_shndx)); - printf (" %s", strtab + psym->st_name); + printf (" %4s ", get_symbol_index_type (psym->st_shndx)); + print_symbol (strtab + psym->st_name); if (section->sh_type == SHT_DYNSYM && version_info [DT_VERSIONTAGIDX (DT_VERSYM)] != 0) @@ -8902,7 +8911,9 @@ printf ("%5lu: %8lu ", (unsigned long) cnt, iconf[cnt]); print_vma (psym->st_value, FULL_HEX); - printf (" %s\n", dynamic_strings + psym->st_name); + printf (" "); + print_symbol (dynamic_strings + psym->st_name); + printf ("\n"); } free (iconf);
- Previous message (by thread): readelf truncates symbol names in relocation sections
- Next message (by thread): readelf truncates symbol names in relocation sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list