Makefile.in 3.7 KB

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