SGI: Development

How to make gcc use GNU ld?

As the above, how would you configure GCC to use the GNU ld as its linker? I successfully built the binutils 2.16.1 and was curious if it (ld, at least) would work in IRIX 6.5. This is an alternative to using the default linker (which is probably giving me these linking problems). Otherwise I would have to change the command lines for the link stages (in the makefiles?) I did some research and an old message from some mailing list remarked that IRIX ld wants the libraries after the object files, or it won't find the appropriate symbols. Mind you this message was from 1998 so I'm not sure if ld was modified or updated since then.

Anyone who can help me on this? It would be greatly appreciated.


Thanks!

Simon
AFAIK, you have to build gcc with --with-gnu-ld and --with-ld=<path to your gnu ld> to make this work. Never needed this, though, but for GNU as this works fine.

If you want to rewrite the makefiles, it depends, as always. Just search for lines with -L, -l or ${CC} -o <something that looks like an executable>. Usually the message where ld is bailing out in the build process gives you a clue what to search for.
Such bugs and goblins in my life!
(Taken from Hamlet)
You could also try setting the environment variable LD to the gnu linker
:Crimson: :PI: :Indigo: :O2: :Indy: :Indigo2: :Indigo2IMP: :O2000: :Onyx2:
European nekoware mirror, updated twice a day: http://www.mechanics.citg.tudelft.nl/~everdij/nekoware
ftp://mech001.citg.tudelft.nl rsync mech001.citg.tudelft.nl::nekoware
Thanks for the suggestions guys, they kinda worked... as far as configuring it shows up, but the building still uses the IRIX ld. I'm not game enough in modifying makefiles yet, but could the compiler specs file be modified to accomodate the linker? I could look up one in a RS/6000 Debian machine I have. Unless there's architecture-specific details in there, there shouldn't be too much difference? At the moment I'm building my own GCC with the ld switches, that should work...

EDIT: The GCC build gave me this:

ld: cannot find -liconv



Thanks,

Simon
Hi everybody! Well, fast forward a couple of months...

I eventually got around in making a cross compiler on my RS/6000 Linux machine, and now everything's nearly working except:

GCC 4.1.0 cross PPC -> mips-sgi-irix6.5 C works. I tried C++ but it was missing a few headers... iostream being one of them :P But I only need the cross C compiler for a Canadian cross compile to mips-sgi-irix6.5 right?

I tried a Canadian cross compile of 4.1.0 but it had some error when it came to gmake install; the building worked though.

Code: Select all

/usr/bin/install -c /src/gcc-4.1.0/gcc/fixproto
/usr/gcc4/libexec/gcc/mips-sgi-irix6.5/4.1.0/install-tools/fixproto ;
/usr/bin/install -c build/fix-header
/usr/gcc4/libexec/gcc/mips-sgi-irix6.5/4.1.0/install-tools/fix-header ;
else :; fi
/usr/bin/install: target
`/usr/gcc4/libexec/gcc/mips-sgi-irix6.5/4.1.0/install-tools/mkinstalldirs' is
not a directory
/usr/bin/install: cannot stat `build/fix-header': No such file or directory
gmake[1]: *** [install-mkheaders] Error 1

I tried a cross compile of 3.4.6 (C only, using the 4.1.0 cross compiler) and got that to compile and install successfully. When it came to compiling a C Hello World program throws this:

Code: Select all

collect2: ld terminated with signal 11 [Segmentation fault], core dumped
ld: BFD assertion fail /src/binutils/bfd/elfxx-mips.c:5705

That was with the binutils built with Nekoware GCC 3.4.0 and SGI native linker. Thinking that that was the problem, I cross compiled the binutils successfully but it returned with the same error. Setting it aside again, I ask a question: does anyone know what is actually wrong? Yes, I realised it was the binutils source itself, so here's the offending reference:

Code: Select all

5703:       _bfd_mips_elf_finish_dynamic_symbol.  */
5704:       s = bfd_get_section_by_name (abfd, ".rld_map");
5705:     BFD_ASSERT (s != NULL);
5706:
5707:     name = SGI_COMPAT (abfd) ? "__rld_map" : "__RLD_MAP";
5708:     bh = NULL;

Should I send a bug report to the binutils people? Mailing lists? I am using the latest version of the binutils, 2.16.1.


Simon