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


Hi Nick, hi list,

> > I'm using the diab C-Compiler-Suite 4.4b for compiling and
> > linking. I want to rename the .text sections in my object-files
> > (ELF). I thought of using GNU objcopy 2.12 for this. Afterwards I
> > realized, that all the files shrinked, even if I just copy the files
> > without renaming (i.e. without using the
> > "--rename-section"-flag). Which parts does objcopy remove, while
> > copying the files?
> 
> In general objcopy without specific parameters will not remove
> anything.  What it does do is read in the input file, convert it into
> an internal format, and then write it out again, converting back into
> the external format.
> 
> It would appear that this two way conversion process is shrinking your
> file,

I've figuered this out so far:
1) There were lots of 0's (zeros) in the pre copied file before the
beginning of the first section. Those were removed in the copy.

2) The .shstrtab-section shrinked in size. Now there's only one entry for
.rela.text and .text a.s.o. The pointer for ".text" points to the second dot in
".rela.text". In the pre copied file there's a separate entry for each of
those sections.

3) The strtab-section shrinked in size. Everything beginning with . (dot) is
removed in the copy.

There should be no problem with 1) and 2). But 3) could perhaps cause errors
by the linker. We had no time to figuere this out yet. I will tell you, when
we've tried.

> but without further information we cannot really say what is
> happening.  Some things you might like to look at are:
> 
>         * Does the copied file still produce a working executable ?
I can't tell yet.

>         * Are there differences in the section headers between the
>           pre and post copied files ?  (Use readelf -S to display the
>           headers).
The order of the entries in the section header table changed (shouldn't
cause any trouble). The size of the string tables changed (see above, 2) & 3) ).
This could possibly become a problem. Also the size of the Symtab changed
(see below).

>         * Are the symbol tables the same ?  (readelf -s)
No, they are not. The symtab of the copied file INcreased in size. There are
six additional entries (weird, isn't it?). In many cases the "Name"-column
is empty. This is the case, when the name in the pre copied file begins with a
dot. (see 3) )

Perhaps someone can tell me, why the entries in the strtab are modified by
objcopy. Is this a bug?

Thanks for your help
  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]