libxul.mk 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # This Source Code Form is subject to the terms of the Mozilla Public
  2. # License, v. 2.0. If a copy of the MPL was not distributed with this file,
  3. # You can obtain one at http://mozilla.org/MPL/2.0/.
  4. EXTRA_DEPS += $(topsrcdir)/toolkit/library/libxul.mk
  5. ifeq (Linux,$(OS_ARCH))
  6. OS_LDFLAGS += -Wl,-version-script,symverscript
  7. symverscript: $(topsrcdir)/toolkit/library/symverscript.in
  8. $(call py_action,preprocessor, \
  9. -DVERSION='xul$(MOZILLA_SYMBOLVERSION)' $< -o $@)
  10. EXTRA_DEPS += symverscript
  11. endif
  12. # Generate GDB pretty printer-autoload files on Linux and Solaris. OSX's GDB is
  13. # too old to support Python pretty-printers; if this changes, we could make
  14. # this 'ifdef GNU_CC'.
  15. ifeq (,$(filter-out SunOS Linux,$(OS_ARCH)))
  16. # Create a GDB Python auto-load file alongside the libxul shared library in
  17. # the build directory.
  18. PP_TARGETS += LIBXUL_AUTOLOAD
  19. LIBXUL_AUTOLOAD = $(topsrcdir)/toolkit/library/libxul.so-gdb.py.in
  20. LIBXUL_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(topsrcdir))
  21. endif
  22. ifeq ($(OS_ARCH),SunOS)
  23. OS_LDFLAGS += -Wl,-z,defs
  24. endif
  25. # BFD ld doesn't create multiple PT_LOADs as usual when an unknown section
  26. # exists. Using an implicit linker script to make it fold that section in
  27. # .data.rel.ro makes it create multiple PT_LOADs. That implicit linker
  28. # script however makes gold misbehave, first because it doesn't like that
  29. # the linker script is given after crtbegin.o, and even past that, replaces
  30. # the default section rules with those from the script instead of
  31. # supplementing them. Which leads to a lib with a huge load of sections.
  32. ifneq (OpenBSD,$(OS_TARGET))
  33. ifneq (WINNT,$(OS_TARGET))
  34. ifdef LD_IS_BFD
  35. OS_LDFLAGS += $(topsrcdir)/toolkit/library/StaticXULComponents.ld
  36. endif
  37. endif
  38. endif
  39. ifdef _MSC_VER
  40. get_first_and_last = dumpbin -exports $1 | grep _NSModule@@ | sort -k 3 | sed -n 's/^.*?\([^@]*\)@@.*$$/\1/;1p;$$p'
  41. else
  42. get_first_and_last = $(TOOLCHAIN_PREFIX)nm -g $1 | grep _NSModule$$ | grep -vw refptr | sort | sed -n 's/^.* _*\([^ ]*\)$$/\1/;1p;$$p'
  43. endif
  44. 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
  45. ifeq (,$(filter-out SunOS Linux,$(OS_ARCH)))
  46. 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
  47. endif