summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-11-05 21:16:39 +0000
committerdim <dim@FreeBSD.org>2011-11-05 21:16:39 +0000
commit00e85738104d4a5768462c2666d95a8ea2f95b8f (patch)
tree6569faef4365c1e1ba5b948a3ff20ededa111e63
parent2e79cf338b15afc6e2daa659795d26dbcf78b422 (diff)
downloadFreeBSD-src-00e85738104d4a5768462c2666d95a8ea2f95b8f.zip
FreeBSD-src-00e85738104d4a5768462c2666d95a8ea2f95b8f.tar.gz
Make it possible to set CC and CXX (and optionally, AS and LD) in
make.conf(5), while allowing the build32 stage on 64-bit architectures to still override them, so that stage can successfully build 32-bit compatibility libraries. Explanation: 1) The build32 stage sets environment variables CC, CXX, AS and LD for its sub-make, to add 32-bit specific flags (-m32 and such). 2) The sub-make reads sys.mk, encounters CC?= and CXX?= assignments, so does not alter them. 3) After some other stuff, sys.mk reads /etc/make.conf. When you have "CC=xxx" and "CXX=yyy" statements in there, they will *override* the build32-supplied CC/CXX values, nullifying the 32-bit specific flags. 4) Thus all objects get built as 64-bit anyway, and since LD is usually not set in make.conf, it still has the 32-bit flags! 5) Now, whenever something is linked, you will get a "ld: Relocatable linking with relocations from format elf64-x86-64-freebsd (foo.o) to format elf32-i386-freebsd (bar.o) is not supported" error. Fix this by adding "-ECC -ECXX -EAS -ELD" to the build32 sub-make invocation, which forces those environment variables to always override any assignment in makefiles. Thus making it possible to simply set: CC=my-cc CXX=my-c++ in your make.conf, or specify a path, even: CC=/usr/local/bin/other-cc CXX=/usr/local/bin/other-c++ Note this was never a problem on i386, since it has no build32 stage. Silence from: current@ MFC after: 1 week
-rw-r--r--Makefile.inc13
1 files changed, 2 insertions, 1 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 07e4301..2f4f84c 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -313,7 +313,8 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
- -DWITHOUT_HTML -DNO_CTF -DNO_LINT DESTDIR=${LIB32TMP}
+ -DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
+ DESTDIR=${LIB32TMP}
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
.endif
OpenPOWER on IntegriCloud