Bug 1411712 - Move ldflags munging by the clang-plugin to moz.build
MozReview-Commit-ID: JTZlXscUvlX
--- a/build/clang-plugin/Makefile.in
+++ b/build/clang-plugin/Makefile.in
@@ -1,33 +1,27 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-# LLVM_CXXFLAGS comes with its own optimization flags.
-MOZ_OPTIMIZE =
-
include $(topsrcdir)/config/config.mk
# In the current moz.build world, we need to override essentially every
# variable to limit ourselves to what we need to build the clang plugin.
ifneq ($(HOST_OS_ARCH),WINNT)
DSO_LDOPTS := -shared
endif
-OS_LDFLAGS := $(LLVM_LDFLAGS) $(CLANG_LDFLAGS)
ifeq ($(HOST_OS_ARCH)_$(OS_ARCH),Linux_Darwin)
# Use the host compiler instead of the target compiler.
CXX := $(HOST_CXX)
# expandlibs doesn't know the distinction between host and target toolchains,
# and on cross linux/darwin builds, the options to give to the linker for file
# lists differ between both, so don't use file lists.
EXPAND_MKSHLIB_ARGS :=
-# Don't pass OSX linker arguments.
-MOZ_FIX_LINK_PATHS :=
endif
# Use the default OS X deployment target to enable using the libc++ headers
# correctly. Note that the binary produced here is a host tool and doesn't need
# to be distributed.
MACOSX_DEPLOYMENT_TARGET :=
# Temporarily relax the requirements for libstdc++ symbol versions on static
--- a/build/clang-plugin/moz.build
+++ b/build/clang-plugin/moz.build
@@ -70,8 +70,17 @@ else:
if CONFIG['LLVM_CXXFLAGS']:
COMPILE_FLAGS['OS_CXXFLAGS'] = CONFIG['LLVM_CXXFLAGS'] + extra_cxxflags
COMPILE_FLAGS['CLANG_PLUGIN'] = []
COMPILE_FLAGS['OPTIMIZE'] = []
COMPILE_FLAGS['DEBUG'] = []
COMPILE_FLAGS['OS_COMPILE_CXXFLAGS'] = []
+
+LINK_FLAGS['OS'] = CONFIG['LLVM_LDFLAGS'] + CONFIG['CLANG_LDFLAGS']
+# The ldflags above override most other categories.
+for var in ('LINKER', 'OPTIMIZE'):
+ LINK_FLAGS[var] = []
+
+if CONFIG['HOST_OS_ARCH'] == 'Linux' and CONFIG['OS_ARCH'] == 'Darwin':
+ # Don't pass OSX linker arguments.
+ LINK_FLAGS['FIX_LINK_PATHS'] = []