# 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/.

include $(topsrcdir)/config/config.mk

HOST_LDFLAGS += $(LLVM_LDFLAGS)

ifeq ($(HOST_OS_ARCH),Darwin)
# We need to make sure that we use the symbols coming from the clang
# binary. In order to do this, we need to pass -flat_namespace and
# -undefined suppress to the linker. This makes sure that we link the
# symbols into the flat namespace provided by clang, and thus get
# access to all of the symbols which are undefined in our dylib as we
# are building it right now, and also that we don't fail the build
# due to undefined symbols (which will be provided by clang).
HOST_LDFLAGS += -Wl,-flat_namespace -Wl,-undefined,suppress
endif

ifeq ($(HOST_OS_ARCH),WINNT)
# clang-plugin.dll needs to be deterministic for sccache hashes
HOST_LDFLAGS += -brepro
else
HOST_LDFLAGS += -shared
endif
