On Thu, Dec 27, 2018 at 02:51:35PM +0000, Overbey, Patrick (Sioux Falls) wrote:
> Hi Willy,
> Thanks for your prompt response. I appreciate your help with this matter.
> 
> Here is the ld version on my AIX system. 
> ld: LD 1.65.6.6 (4/1/14)
> 
> I tried changing the linker in the Makefile from gcc to ld, but ran into
> similar undefined symbol errors. I installed binutils which includes gld
> version 2.29.1, but ran into many undefined reference errors (attached). 

OK. By the way, I'm totally shocked by the amount of warnings you're getting
after we've managed to be able to build with -Werror on most platforms!
Anyway, I think we cannot swap gcc to ld this way but you should be able to
pass this to your LDFLAGS instead to let gcc rely on gld (and then don't set
LD). However I can't figure in gcc's man howe to do this. The following will
indicate what LD gcc uses :

    gcc -print-prog-name=ld

I've found that you can set the linker to be bfd-compatible using -fuse-ld=bfd
or gold-compatible by specifying -fuse-ld=gold. In this case gcc will use a
different linker name. E.g. :

  willy@wtap:haproxy$ gcc -print-prog-name=ld 
  ld
  willy@wtap:haproxy$ gcc -print-prog-name=ld -fuse-ld=gold
  ld.gold
  willy@wtap:haproxy$ gcc -print-prog-name=ld -fuse-ld=bfd 
  ld.bfd

So if gld is also accessible as ld.bfd or ld.gold, you have an option here to
make it work, e.g. :

        LDFLAGS="-fuse-ld=gold"

Otherwise it's possible to enforce the search path for the subprograms
using -B or using the GCC_EXEC_PREFIX environment variable. If your linker
is installed next to gcc that might work, but I suspect it could also cause
more headache than it fixes, thus you'll need to have a look at the man page
to experiment.

Willy

Reply via email to