aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-12-27 12:59:59 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-12-27 12:59:59 +0000
commit6c2782f025313820f175597673284bac91643ecf (patch)
treef21f7c4585f7b376cd665c2cd4dacacee194258e /include
parentf4b6b84555ba69aee4d9b62eb49ef19ff27d083f (diff)
downloadupstream-6c2782f025313820f175597673284bac91643ecf.tar.gz
upstream-6c2782f025313820f175597673284bac91643ecf.tar.bz2
upstream-6c2782f025313820f175597673284bac91643ecf.zip
build: use gcc-provided ar, nm and ranlib where appropriate
Since GCC 4.7, GCC provides its own wrappers around ar, nm and ranlib, which should be used for builds with link-time optimization. Since GCC 4.9, using them actually necessary for LTO builds using convenience libraries to succeed. There are some packages which try to automatically detect if gcc-{ar,nm,ranlib} exist (one example is my package "fastd" in the package repository, which tries to use LTO). This breaks because the OpenWrt build system explicitly sets the binutils versions of these tools. As it doesn't cause any issues to use gcc-{ar,nm,ranlib} instead of {ar,nm,ranlib} even without LTO, this patch just makes OpenWrt use the GCC-provided versions by default, which fixes the build of such packages with GCC 4.9. (I know that builds fail though when clang is used with -flto and gcc-{ar,nm,ranlib}, but as all OpenWrt toolchains are based on GCC, this isn't a real issue.) Completely cleaning the tree (or at least `make clean toolchain/clean`) is necessary to get a consistent state after the binutils plugins support patch and this one (as trying to use gcc-{ar,nm,ranlib} with a binutils built without plugin support will definitely lead to a build failure). Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43784 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'include')
-rw-r--r--include/cmake.mk6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/cmake.mk b/include/cmake.mk
index 9a5e311c3c..6ab628ee2e 100644
--- a/include/cmake.mk
+++ b/include/cmake.mk
@@ -27,8 +27,9 @@ else
CMAKE_CXX_COMPILER:=$(CCACHE)
CMAKE_CXX_COMPILER_ARG1:=$(TARGET_CXX_NOCACHE)
endif
-CMAKE_AR:=$(call cmake_tool,$(TARGET_CROSS)ar)
-CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_CROSS)ranlib)
+CMAKE_AR:=$(call cmake_tool,$(TARGET_AR))
+CMAKE_NM:=$(call cmake_tool,$(TARGET_NM))
+CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB))
define Build/Configure/Default
(cd $(PKG_BUILD_DIR); \
@@ -50,6 +51,7 @@ define Build/Configure/Default
-DCMAKE_MODULE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
-DCMAKE_SHARED_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
-DCMAKE_AR="$(CMAKE_AR)" \
+ -DCMAKE_NM="$(CMAKE_NM)" \
-DCMAKE_RANLIB="$(CMAKE_RANLIB)" \
-DCMAKE_FIND_ROOT_PATH="$(STAGING_DIR);$(TOOLCHAIN_DIR)" \
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \