Bug 1411712 - Move ldflags munging by the clang-plugin to moz.build draft
authorChris Manchester <cmanchester@mozilla.com>
Thu, 02 Nov 2017 14:14:59 -0700
changeset 692250 b16038af4f242f4623b5e8d89b359874c1b53cd2
parent 692249 e7c6be870aad899540e61711df1aa0fdf2a75ab4
child 692251 c88d767e07bf88af28f9c9d9c9790a18e811da90
push id87463
push userbmo:cmanchester@mozilla.com
push dateThu, 02 Nov 2017 21:50:29 +0000
bugs1411712
milestone58.0a1
Bug 1411712 - Move ldflags munging by the clang-plugin to moz.build MozReview-Commit-ID: JTZlXscUvlX
build/clang-plugin/Makefile.in
build/clang-plugin/moz.build
--- 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'] = []