Makefile.in 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. subdirs += ldso/ldso/$(TARGET_ARCH)
  8. CFLAGS-rtld := -DNOT_IN_libc -DIS_IN_rtld $(SSP_DISABLE_FLAGS)
  9. ifneq ($(TARGET_ARCH),arc)
  10. # This stuff will not work with -fomit-frame-pointer
  11. CFLAGS-rtld += -fno-omit-frame-pointer
  12. endif
  13. ifeq ($(DODEBUG),y)
  14. ifeq ($(TARGET_ARCH),arm)
  15. # This stuff will not work with -funwind-tables / -fasynchronous-unwind-tables
  16. CFLAGS-rtld += -fno-unwind-tables -fno-asynchronous-unwind-tables
  17. endif
  18. endif
  19. CFLAGS-rtld += -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include -I$(top_srcdir)ldso/ldso
  20. CFLAGS-rtld += -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\"
  21. # Not really much point in including debugging info, since gdb
  22. # can't really debug ldso, since gdb requires help from ldso to
  23. # debug things....
  24. # On arm, gcc-4.3.x onwards -Os emits calls to libgcc, which calls _div0,
  25. # which tries to call raise(). And raise comes from libc so a catch 22.
  26. # Using -O2 instead. We could have use -fno-early-inlining with -Os too.
  27. CFLAGS-$(DODEBUG)-ldso/ldso := -O2 -g
  28. CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\"
  29. ifeq ($(TARGET_ARCH),arc)
  30. CFLAGS-ldso.c += -mno-long-calls
  31. endif
  32. LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1
  33. ifneq ($(SUPPORT_LD_DEBUG),y)
  34. LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS)
  35. else
  36. LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
  37. endif
  38. LDFLAGS-$(UCLIBC_LDSO_NAME).so += -Wl,-e,$(SYMBOL_PREFIX)_start \
  39. -Wl,-z,now -Wl,-Bsymbolic \
  40. -Wl,--export-dynamic $(CFLAG_-Wl--sort-common) -Wl,--discard-locals \
  41. $(CFLAG_-Wl--discard-all) -Wl,--no-undefined
  42. LDFLAGS-$(LDSO_PRELINK_SUPPORT)-$(UCLIBC_LDSO_NAME).so += -Wl,-defsym=$(SYMBOL_PREFIX)_begin=0
  43. ldso_FULL_NAME := $(UCLIBC_LDSO_NAME)-$(VERSION).so
  44. $(UCLIBC_LDSO_NAME)_DIR := $(top_srcdir)ldso/ldso
  45. $(UCLIBC_LDSO_NAME)_OUT := $(top_builddir)ldso/ldso
  46. $(UCLIBC_LDSO_NAME)_CSRC := $($(UCLIBC_LDSO_NAME)_DIR)/ldso.c
  47. # prerequesites
  48. $($(UCLIBC_LDSO_NAME)_OUT)/ldso.o $($(UCLIBC_LDSO_NAME)_OUT)/ldso.oS: \
  49. $($(UCLIBC_LDSO_NAME)_DIR)/dl-debug.c \
  50. $($(UCLIBC_LDSO_NAME)_DIR)/dl-startup.c \
  51. $($(UCLIBC_LDSO_NAME)_DIR)/dl-array.c \
  52. $($(UCLIBC_LDSO_NAME)_DIR)/dl-hash.c \
  53. $($(UCLIBC_LDSO_NAME)_DIR)/dl-elf.c
  54. $(UCLIBC_LDSO_NAME)_COBJ := $(patsubst $($(UCLIBC_LDSO_NAME)_DIR)/%.c,$($(UCLIBC_LDSO_NAME)_OUT)/%.o,$($(UCLIBC_LDSO_NAME)_CSRC))
  55. $(UCLIBC_LDSO_NAME)_SSRC := $(wildcard $($(UCLIBC_LDSO_NAME)_DIR)/$(TARGET_ARCH)/*.S)
  56. $(UCLIBC_LDSO_NAME)_SOBJ := $(patsubst $($(UCLIBC_LDSO_NAME)_DIR)/$(TARGET_ARCH)/%.S,$($(UCLIBC_LDSO_NAME)_OUT)/$(TARGET_ARCH)/%.o,$($(UCLIBC_LDSO_NAME)_SSRC))
  57. $(UCLIBC_LDSO_NAME)_OBJS := $($(UCLIBC_LDSO_NAME)_COBJ) $($(UCLIBC_LDSO_NAME)_SOBJ)
  58. ldso-y := $($(UCLIBC_LDSO_NAME)_OBJS:.o=.oS)
  59. lib-so-y += $(ldso)
  60. objclean-y += CLEAN_ldso/ldso
  61. $(ldso): $(ldso:.$(ABI_VERSION)=)
  62. $(ldso:.$(ABI_VERSION)=): | $(top_builddir)lib
  63. $(ldso:.$(ABI_VERSION)=): $($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a
  64. $(call link.so,$(ldso_FULL_NAME),$(ABI_VERSION))
  65. # link for backward compatibility
  66. (cd $(top_builddir)lib; ln -sf $(UCLIBC_LDSO_NAME).so.$(ABI_VERSION) $(UCLIBC_LDSO_NAME).so.0 )
  67. ifeq ($(CONFIG_MIPS_NAN_2008),y)
  68. (cd $(top_builddir)lib; ln -sf $(UCLIBC_LDSO_NAME).so.$(ABI_VERSION) $(UCLIBC_LDSO_NAME)-mipsn8.so.0)
  69. endif
  70. $($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a: $(ldso-y)
  71. $(Q)$(RM) $@
  72. $(do_ar)
  73. CLEAN_ldso/ldso:
  74. $(do_rm) $(addprefix $($(UCLIBC_LDSO_NAME)_OUT)/,$(foreach e, o os oS a,$(foreach d, *. */*.,$(d)$(e))))