On Fri, 31 Oct 2008, Andriy Gapon wrote:

on 30/10/2008 20:46 Peter Jeremy said the following:
On 2008-Oct-30 18:08:35 +0200, Andriy Gapon <[EMAIL PROTECTED]> wrote:
ld --warn-constructors --warn-common -static -T memtest_shared.lds \
       -o memtest_shared head.o reloc.o main.o test.o init.o lib.o
patn.o screen_buffer.o config.o linuxbios.o memsize.o pci.o controller.o
random.o extra.o spd.o error.o dmi.o && \
       ld -shared -Bsymbolic -T memtest_shared.lds -o memtest_shared
head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o
config.o linuxbios.o memsize.o pci.o controller.o random.o extra.o spd.o
error.o dmi.o
head.o(.text+0x7): In function `startup_32':
: undefined reference to `_GLOBAL_OFFSET_TABLE_'
Segmentation fault (core dumped)
gmake: *** [memtest_shared] Error 139

I can't help here.  _GLOBAL_OFFSET_TABLE_ is related to the binutils
PIC support and it appears that the linker doesn't like the code (in
head.S) is explicitly referencing it.

Not only linking fails, but ld even crashes.

I agree this shouldn't happen.

Can anybody suggest anything about this problem?

It looks like stand-alone PIC code on FreeBSD needs some different
incantations to Linux.  My understanding is that several of the
i386 bootstraps are relocatable so you might like to peruse the
code in /usr/src/sys/boot/i386 for ideas.

I wonder if this is something about out port of binutils or is it an
issue in older version of binutils.
I'll try to look at the boot code, thank you for the hint.

FreeBSD's version of binutils is quite old. I've definitely found bugs in it which are fixed in GNU's current version. So you might try building the official GNU binutils and see if that works any better. I don't know if it will fix your error but maybe it at least won't crash.

ld crashing is definitely a bug, and it would be nice if you could file a PR, including the object files. If the GNU version doesn't crash that would be useful information for the PR also, as it might encourage Them to consider importing a newer version.

--

Nate Eldredge
[EMAIL PROTECTED]
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to