Files
UXP/toolkit/library/libxul.mk
athenian200 926ee14909 Issue #1824 - Use elfdump on SunOS instead of readelf.
GNU readelf isn't available as consistently as I assumed across SunOS,
and it can be named different things on different illumos distros (some call
it readelf, others call it greadelf, etc), so it's safer to use elfdump.
This is a fairly easy fix, just kind of annoying.
2023-11-14 15:34:12 +08:00

60 lines
2.2 KiB
Makefile

# 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/.
EXTRA_DEPS += $(topsrcdir)/toolkit/library/libxul.mk
ifeq (Linux,$(OS_ARCH))
OS_LDFLAGS += -Wl,-version-script,symverscript
symverscript: $(topsrcdir)/toolkit/library/symverscript.in
$(call py_action,preprocessor, \
-DVERSION='xul$(MOZILLA_SYMBOLVERSION)' $< -o $@)
EXTRA_DEPS += symverscript
endif
ifdef MOZ_WEBRTC
ifeq (WINNT,$(OS_TARGET))
ifndef MOZ_HAS_WINSDK_WITH_D3D
OS_LDFLAGS += \
-LIBPATH:'$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_D3D_CPU_SUFFIX)' \
$(NULL)
endif
endif
endif
# Generate GDB pretty printer-autoload files on Linux and Solaris. OSX's GDB is
# too old to support Python pretty-printers; if this changes, we could make
# this 'ifdef GNU_CC'.
ifeq (,$(filter-out SunOS Linux,$(OS_ARCH)))
# Create a GDB Python auto-load file alongside the libxul shared library in
# the build directory.
PP_TARGETS += LIBXUL_AUTOLOAD
LIBXUL_AUTOLOAD = $(topsrcdir)/toolkit/library/libxul.so-gdb.py.in
LIBXUL_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(topsrcdir))
endif
ifeq ($(OS_ARCH),SunOS)
OS_LDFLAGS += -Wl,-z,defs
endif
ifdef _MSC_VER
get_first_and_last = dumpbin -exports $1 | grep _NSModule@@ | sort -k 3 | sed -n 's/^.*?\([^@]*\)@@.*$$/\1/;1p;$$p'
else
get_first_and_last = $(TOOLCHAIN_PREFIX)nm -g $1 | grep _NSModule$$ | grep -vw refptr | sort | sed -n 's/^.* _*\([^ ]*\)$$/\1/;1p;$$p'
endif
LOCAL_CHECKS = test "$$($(get_first_and_last) | xargs echo)" != "start_kPStaticModules_NSModule end_kPStaticModules_NSModule" && echo "NSModules are not ordered appropriately" && exit 1 || exit 0
ifeq (Linux,$(OS_ARCH))
LOCAL_CHECKS += ; test "$$($(TOOLCHAIN_PREFIX)readelf -l $1 | awk '$1 == "LOAD" { t += 1 } END { print t }')" -le 1 && echo "Only one PT_LOAD segment" && exit 1 || exit 0
endif
# It's safer to use elfdump on SunOS, because that's available on all
# supported versions of Solaris and illumos.
ifeq (SunOS,$(OS_ARCH))
LOCAL_CHECKS += ; test "elfdump -p $1 | awk '$5 == "PT_LOAD" { t += 1 } END { print t }')" -le 1 && echo "Only one PT_LOAD segment" && exit 1 || exit 0
endif