Subject: Re: xcoff files
To: Simon Burge <simonb@NetBSD.ORG>
From: Bill Studenmund <>
List: tech-toolchain
Date: 06/25/1999 16:45:12
On Sat, 26 Jun 1999, Simon Burge wrote:

> Bill Studenmund wrote:
> On the pmax I never figured out why "objcopy --target=ecoff-littlemips"
> and elf2coff generated different files.  Take a look at the following to
> confuse you just that extra little bit that you didn't need to be:

This part I can answer!

objcopy won't merge segments together. So you get out as many segments as
you put in. It doesn't matter if the format you're going to makes no sense
of the section, objcopy will spit it out. So the objcopy version has
rodata, reginfo, sbss, and sdata sections, which I doubt ecoff deals with. 

> mona:/tmp 7> objcopy --target=ecoff-littlemips /netbsd /tmp/netbsd.objcopy
> mona:/tmp 8> elf2ecoff /netbsd /tmp/netbsd.elf2ecoff
> mona:/tmp 9> file netbsd*
> 	netbsd.elf2ecoff: MIPSEL-LE COFF executable (impure) - version 2.10
> 	netbsd.objcopy:   MIPSEL-LE COFF executable (paged) not stripped - version 0.0
> mona:/tmp 10> size netbsd* 
> 	text    data    bss     dec     hex     filename
> 	59760   1488128 335300  1883188 1cbc34  netbsd.elf2ecoff
> 	1955237 135176  335312  2425725 25037d  netbsd.objcopy

I think the size difference might be that size totals the elf sections
differently than elf2ecoff arranges them. Also, I bet that elf2ecoff
throws away stuff.

As we use "berkeley format" by default in size.c, check out berkeley_sum()
in src/gnu/dist/binutils/size.c.

Take care,