This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Diab C-Compiler-Suite and GNU objcopy problem


Hello,

> objcopy will enter all and only the names of symbols in the strtab.
> If the original strtab contained strings which were not the names of
> any entries in the symtab, those strings will not appear in the new
> strtab.
Okay, I think I wasn't precise enough with that. The new symtab contains
additional entries compared to the symtab before copying. But it _does_ contain
all of the entries of the original file. The only thing that's different, is
that all the entries of type SECTION don't have names. Here is the output of
"readelf -s" of the original file:

Symbol table '.symtab' contains 311 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 FILE    LOCAL  DEFAULT  ABS init.c
     2: 00000050     0 SECTION LOCAL  DEFAULT    3 .text
     3: 00000000     0 SECTION LOCAL  DEFAULT   11 .debug_sfnames
     4: 00000000     0 SECTION LOCAL  DEFAULT   12 .debug
     5: 00000000     0 SECTION LOCAL  DEFAULT   13 .line
     6: 00000000     0 SECTION LOCAL  DEFAULT   14 .debug_srcinfo
     7: 00000000     0 FILE    LOCAL  DEFAULT  ABS mtc_rt.c
...

The copied version gives:
Symbol table '.symtab' contains 317 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 FILE    LOCAL  DEFAULT  ABS init.c
     2: 00000050     0 SECTION LOCAL  DEFAULT    4
     3: 00000000     0 SECTION LOCAL  DEFAULT   13
     4: 00000000     0 SECTION LOCAL  DEFAULT   14
     5: 00000000     0 SECTION LOCAL  DEFAULT   16
     6: 00000000     0 SECTION LOCAL  DEFAULT   18
     7: 00000000     0 FILE    LOCAL  DEFAULT  ABS mtc_rt.c
...

As you can see, the entries for .text, .debug_sfnames, a.s.o. are contained
in both versions of the symtab (their indices in the section header table
changed, but that's all and should make no difference, right?). The strings for
the section-names are contained in the strtab of the sourcefile, but they are
_not_ in the copied file.
>  However, I can not speculate on why the strtab would ever
> contain strings which are not referenced by the symtab.
Neither the original, nor the copy does contain strings that are not
referenced. But the copy also lacks some strings that were referenced by the
original file.

Frank

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]