🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Lev Vaitzblit Mon, 02 Nov 1992 09:26
binutils-2.0 gld bugs
#51
Author: Lev Vaitzblit
Date: Mon, 02 Nov 1992 09:26
101 lines
3284 bytes
	Hi,

I'd like to report some problems and possible workarounds for gld in
binutils-2.0


I'm running the following software:
	gcc-2.2.2
	gdb-4.6
	gas-1.38
	binutils-beta-1.94, and now binutils-2.0

My environment is set up for cross development as follows:

	host: mips-dec-ultrix
	target: i386-aout-bsd
	gdb-4.6 is configured for remote debugging


binutils-beta-1.94 problems
---------------------------

	Using the linker from binutils-beta-1.94 without any switches
(i.e. bulding a ZMAGIC paged executable, whicjh is the default) does not
work. The reason it does not work is that the symbol table is written into
the text or data section of the file.

	Linking with '-n' switch (i.e. building an N_MAGIC non-paged
executable) works just fine.

binutils-2.0 problems
---------------------

	The linker in binutils-2.0 does not work at all, regardless of whether
one uses the '-n' switch or not.

	Using the '-n' switch causes all sections to be written contiguously,
however the relocation is done as though the text started on a page
boundary.

	Not using the '-n' switch causes the symbol table to be wriiten into 
the text section.


	I managed to get the linker to work for Z_MAGIC executables 
(no '-n' switch) by altering the binutils-2.0/bfd/i386aout.c file as follows:

	remove the following line:
		#define N_TXTOFF 0x20

	add the following line:
		#define TEXT_START_ADDR PAGE_SIZE

	If you perform the above change, you will notice that gdb-4.6
stops working. The GDB may be fixed by altering the

	gdb-4.6/bfd/i386aout.c as follows:
		
	instead of
		#define N_TXTOFF(x) 0x20

	do this:
		#define N_TXTOFF(x) (N_MAGIC(x)==ZMAGIC ? PAGE_SIZE : 0)


Other problems with binutils-2.0 linker
---------------------------------------

	The CTOR_LIST used to begin with a count of constructors.
binutils-2.0 linker does NOT assign this count correctly, the count is 
always 0.

	If you had code that used to rely on the correct count, you may 
determine the number of constructors by using the ___CTOR_LIST__$e label
which is just past the CTOR_LIST array. 
constructor_count = (___CTOR_LIST__$e - ___CTOR_LIST__)/4 - 2
(-2 is for the count and NULL termination of the CTOR_LIST array).



	There is one other potential problem with the linker. The new code
for creating Z_MAGIC executables pads the data section to a page boundary
and then subtracts the number of padded bytes from the size of the BSS
section. This may cause a problem if your version of the OS needs to initialize
the entire BSS section to zeros. Since the new binutils-2.0 code "fools" the
OS about the size of the BSS section, the OS will only partially initialize
bss to zeros.





	Regards,
	Lev.


P.S. Also mailed this note to bothner@cygnus.com
 

		
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads