This is the mail archive of the 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]

Re: faq regarding

Ivan Pulleyn <> wrote:

> Thanks. How can I make LD emit these symbols?

Traditionally it's like this:

	.text :
		etext = .;
	.data :
		data_start = .;
		edata = .;
	.bss :
		bss_start = .;
		end = .;

Your .bss is now as you can see between bss_start and end. (Actually, bss_start
is a more recent invention. Before that, the area between edata and end was
considered your .bss.)

> I need to determine the
> size of the image because I need to know how much to lead from the
> boot media.

Sorry, but you are missing the whole point of .bss. It should *not* be on disk,
and you should not allocate space for it on disk. You only read your .text and
.data from disk, and you either leave the original random memory contents where
.bss is supposed to be, or you zero it. Storing it on disk is just wasting disk
space and load time, what's the point of storing on disk and reading from it an
array of zeros?

> FYI, after reading your mail, I switched the order of .bss and
> .data. This seems to have forced ld to reserve the space for .bss
> within my output image, and I now have the behavior I want. Are there
> any problems with having .bss between .text and .data?

There are no problems except that it's a plain waste. Why do you want this
behavior? .bss is an array of zeros or random garbage, why do you want to store
it on disk and read it from there?

Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)

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