/bin/ld doesn't set the entry address + FIX
Ian Donaldson
rcodi at yabbie.rmit.oz
Thu Mar 17 11:18:37 AEST 1988
Subject: /bin/ld doesn't set the entry address + FIX
Index: /usr/src/bin/ld.c 4.3BSD
Description:
/bin/ld fails to put the entry address as specified by -T
in the <a.out.h> header.
This bug didn't exist in 4.2bsd ld.
Repeat-By:
"xx.c" is a typical hello-world program
cc -c xx.c
ld -T 123456 /lib/crt0.o xx.o -lc
od -X a.out | head -5
Note that the a_entry field is zero.
On 4.2bsd, it would have been 123456.
On the Vax, the load-address and entry address are both 0 for
UNIX binaries, so the problem doesn't exist unless you are
cross-compiling. I suspect also that the program that
reads vmunix on the VAX while loading the kernel ignores
the a_entry field, assuming 0x80000000.
Fix:
Apply the following patch.
---------------
*** /usr/src/bin/ld.c.orig Tue Oct 13 12:55:00 1987
--- /usr/src/bin/ld.c Thu Mar 17 12:10:02 1988
***************
*** 1125,1131 ****
else
filhdr.a_entry = entrypt->n_value;
} else
! filhdr.a_entry = 0;
filhdr.a_trsize = (rflag ? trsize:0);
filhdr.a_drsize = (rflag ? drsize:0);
tout = &toutb;
--- 1125,1131 ----
else
filhdr.a_entry = entrypt->n_value;
} else
! filhdr.a_entry = textbase;
filhdr.a_trsize = (rflag ? trsize:0);
filhdr.a_drsize = (rflag ? drsize:0);
tout = &toutb;
---------------
Ian D
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list