Results of the FreeBSD Ports build with CC=clang

> -O4: You could patch the packages, although I'm slightly hesitant

to
> > suggest that... anyone have any better suggestions?
>
> This is tricky. I wonder if there is some magic that the clang driver
> can do for -O4 when the linker doesn't support LTO?

Forgive my ignorance, but wouldn't it be better to get LTO to work on FreeBSD? I realize this may be a FreeBSD-specific question, and I'll move the discussion there if needed. If I understand correctly:

* the linker needs to know about and be able to use libLTO
* Clang currently uses GNU ld on FreeBSD
* GNU ld rules out -O4 since it doesn't support LTO

Would llvm-ld be sufficient as a linker, or is it missing other features needed by FreeBSD? What would it take to get LTO support on FreeBSD?

Kind regards,
Erik

llvm-ld is insufficient because it doesn't interact correctly with
conventional nm/ar/etc. gold ( http://llvm.org/docs/GoldPlugin.html )
should work on FreeBSD, though.

-Eli

Gold svn as of two weeks ago didn't build on FreeBSD - I don't know of anyone who has built it on a non-Linux platform. The GPLv3 means that it is unlikely to ever make it into the FreeBSD base system. Maybe someone will write a BSDL linker soon...

David

llvm-ld is insufficient because it doesn't interact correctly with
conventional nm/ar/etc. gold ( http://llvm.org/docs/GoldPlugin.html )
should work on FreeBSD, though.

Gold svn as of two weeks ago didn't build on FreeBSD - I don't know of
anyone who has built it on a non-Linux platform.

Hmm, really? I don't have a FreeBSD box, but building a version of
gold targeting FreeBSD seems to work just fine.

The GPLv3 means that it is
unlikely to ever make it into the FreeBSD base system.

Doesn't FreeBSD use binutils anyway at the moment?

-Eli

llvm-ld is insufficient because it doesn't interact correctly with
conventional nm/ar/etc. gold ( http://llvm.org/docs/GoldPlugin.html )
should work on FreeBSD, though.

Gold svn as of two weeks ago didn't build on FreeBSD - I don't know of
anyone who has built it on a non-Linux platform.

Hmm, really? I don't have a FreeBSD box, but building a version of
gold targeting FreeBSD seems to work just fine.

I've not tried for a couple of weeks, but it failed very early on in the build process last time I tried.

The GPLv3 means that it is
unlikely to ever make it into the FreeBSD base system.

Doesn't FreeBSD use binutils anyway at the moment?

Yes, but it's the last GPLv2 version and there are no plans to upgrade that I am aware of. There are (so far, at least) no GPLv3 components in the FreeBSD base system.

David

I've not tried for a couple of weeks, but it failed very early on in
the build process last time I tried.

I tried building on a FreeBSD box using the procedure from the GoldPlugin wiki page, but it fails with the following:

/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../src/bfd -I. -I. -I../../src/bfd -I../../src/bfd/../include -DBINDIR='"/usr/local/bin"' -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c -o archive.lo ../../src/bfd/archive.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../src/bfd -I. -I. -I../../src/bfd -I../../src/bfd/../include -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../src/bfd/archive.c -o archive.o
In file included from ../../src/bfd/archive.c:132:
../../src/bfd/sysdep.h:173:21: error: libintl.h: No such file or directory
cc1: warnings being treated as errors
../../src/bfd/archive.c: In function '_bfd_write_archive_contents':
../../src/bfd/archive.c:2056: warning: implicit declaration of function 'dgettext'
../../src/bfd/archive.c:2056: warning: incompatible implicit declaration of built-in function 'dgettext'
../../src/bfd/archive.c: In function '_bfd_archive_bsd_update_armap_timestamp':
../../src/bfd/archive.c:2342: warning: incompatible implicit declaration of built-in function 'dgettext'
../../src/bfd/archive.c:2366: warning: incompatible implicit declaration of built-in function 'dgettext'
*** Error code 1

Stop in /freebsd-src/binutils/build/bfd.
*** Error code 1

Stop in /freebsd-src/binutils/build/bfd.
*** Error code 1

Stop in /freebsd-src/binutils/build/bfd.
*** Error code 1

Stop in /freebsd-src/binutils/build.

I'm not very familiar with make/GCC error, so I haven't been able to proceed.

The GPLv3 means that it is
unlikely to ever make it into the FreeBSD base system.

Doesn't FreeBSD use binutils anyway at the moment?

Yes, but it's the last GPLv2 version and there are no plans to upgrade
that I am aware of. There are (so far, at least) no GPLv3 components
in the FreeBSD base system.

This is true; I believe binutils is at 2.17 which is the latest GPLv2 version, and current policy is that the FreeBSD repo must stay clear of GPLv3.

Mvh Erik

There was an effort to create a BSDL replacement for binutils (http://elftoolchain.wiki.sourceforge.net/) but progress is slow, if not stagnated.

Erik

Hi Erik,

Although I could use it for my own testing, gold is undesirable on FreeBSD because it's GPLv3. Eli, do you know what the exact problems are with llvm-ld? Maybe I can gather enough interest to fix the issues.

Thanks,
Erik

Sorry, I haven't looked into the details.

-Eli