Subject: Re: ELF and m68k
To: Todd Vierling <tv@wasabisystems.com>
From: Steve Woodford <scw@netbsd.org>
List: tech-toolchain
Date: 12/05/2000 14:29:13
On Tue, 5 Dec 2000, Todd Vierling wrote:

> Hm.  A test against binutils 2.10.1 might be in order.  This does sound
> odd....

Actually, it turns out it's the compiler. Consider this:

	int foo;

Compiles to:

	#NO_APP
	gcc2_compiled.:
	__gnu_compiled_c:
	.comm foo,8

The reason for this is because "BIGGEST_ALIGNMENT" is set to 64 (bits) in
config/m68k/netbsd-elf.h, instead of having some smarts to output properly
aligned and sized objects in the BSS.

A comment indicates this is due to SVR4 issues, which requires doubles
(for example) to be 8 byte aligned... As it stands, the ASM_OUTPUT macros
for netbsd m68k elf will round *everything* in the BSS up to a multiple of
8 bytes.

The linker produces the warning only in a few cases, where the variable is
declared uninitialised in one source/header file and declared initialised
in another. So the same variable is in the data section of one object file 
with the *correct* size, but in the BSS of another with the *rounded up*
size. If the variable was declared `extern' in the 2nd file, this warning
goes away (since the size of an `undefined external' is zero).

> : 2) gnu/dist/ld/emulparams/m68kelf.sh defines TEXT_START_ADDR as 0x80000000.
> 
> Check the m68k ELF ABI supplement first.

If I had one, I would. ;-)

Cheers, Steve