2017-05-29 20:54 GMT+03:00 Stuart Henderson <s...@spacehopper.org>: > On 2017/05/29 20:26, Vadim Zhukov wrote: >> The clang and gcc behave differently regarding executing tools. >> While gcc simply runs what he said to, clang tries to be clever >> and always find absolute path for a tool, refusing start otherwise. >> >> The actual problem is starting a linker: ports infrastructure >> expects tools are called by name, not by path, and thus could be >> overriden via stuff in ${WRKDIR}/bin. This functionality is used, >> e.g., to implement USE_WXNEEDED port option. >> >> But clang calls "/usr/bin/ld", not "ld", and thus ${WRKDIR}/bin/ld >> misses a chance to do its magic, and binaries are built without >> OPENBSD_WXNEEDED, and some ports blow up (when compiled using clang). > > One thing we _could_ do is pass -fuse-ld=${WRKDIR}/bin/ld when linking ..
This requires: 1) linker not being called directly; 2) LDFLAGS being passed. I'm not sure if all 50 (or so) USE_WXNEEDED ports behave like this. The reason we have USE_WXNEEDED implemented the current way was to catch such situations, IIUC Yes, we could tweak ${WRKDIR}/bin/{cc,cxx} to force always passing -fuse-ld=${WRKDIR}/bin/ld. That'll require combining gcc4.port.mk and clang.port.mk, though; otherwise they'll become unmaintaineable, because they already have to respect USE_CCACHE. Maybe we'll have a ${PORTSDIR}/mk/compiler.mk that's called from modules.port.mk and implements all the logic we want from different compilers... Until that the dirty hacks in mono, libv8 and whatever else will stay. -- WBR, Vadim Zhukov