Aram Havarneanu wrote:
Well, I have a working compiler but the linker doesn't work or I am
not using it right. I took /lib from a 2.11BSD system.
$ uname -a
FreeBSD bsd.localdomain 8.0-RC1 FreeBSD 8.0-RC1 #0: Thu Sep 17
20:45:19 UTC 2009
root@xxxxxxxxxxxxxxxxxxxxxxx:/usr/obj/usr/src/sys/GENERIC i386
$ pdp11-bsd2.11-gcc -v
Using built-in specs.
Target: pdp11-bsd2.11
Configured with: ../gcc-4.1.2/configure --target=pdp11-bsd2.11
--without-headers --with-newlib --enable-languages=c --disable-shared
--enable-version-specific-runtime-libs
Thread model: single
gcc version 4.1.2
Does this really "work" ? The '--without-headers --with-newlib' are
wrong because :
1. the PDP11 2.11BSD system should have its own "custom" headers
2. the PDP11 2.11BSD surely isn't "newlib"
So please leave these away from your configure and rebuild after :
1. copying the 2.11BSD headers into '/usr/local/pdp11-bsd2.11/include'
2. copying the 2.11BSD libraries into '/usr/local/pdp11-bsd2.11/lib'
3. making a symlink '/usr/local/pdp11-bsd2.11/sys-include' to point to
'/usr/local/pdp11-bsd2.11/include'
The $prefix/$target (no '--prefix=' means $prefix='/usr/local') is the
traditional
$tooldir for 'bin', 'include' and 'lib' for the $target stuff. Please
don't ask why
the '3.' is necessary.... It's a "bug/feature" from 1995 or so... :)
$ pdp11-bsd2.11-gcc a.c
/usr/local/lib/gcc/pdp11-bsd2.11/4.1.2/libgcc.a(__main.o):__main.o:(.text+0x86):
undefined reference to `_atexit'
collect2: ld returned 1 exit status
Probably the '--without-headers' caused this.... Please try a '-v' in
your compile & link
$ pdp11-bsd2.11-gcc -static -nostartfiles -nodefaultlibs -nostdlib a.c
/var/tmp//ccgCzTH1.o:/var/tmp//ccgCzTH1.o:(.text+0xa): undefined
reference to `___main'
collect2: ld returned 1 exit status
What on earth is the sanity here? The normal practice is to use the
startups like 'crt0.o' and the
'libc.a' from target C library...
$ pdp11-bsd2.11-ld -static -nodefaultlibs -nostartfiles -nostdlib a.o
a.o:a.o:(.text+0xa): undefined reference to `__main'
Quite an expected result...