Makefile.in 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. CFLAGS-rtld += -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include -I$(top_srcdir)ldso/ldso
  14. CFLAGS-rtld += -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\"
  15. # Not really much point in including debugging info, since gdb
  16. # can't really debug ldso, since gdb requires help from ldso to
  17. # debug things....
  18. # On arm, gcc-4.3.x onwards -Os emits calls to libgcc, which calls _div0,
  19. # which tries to call raise(). And raise comes from libc so a catch 22.
  20. # Using -O2 instead. We could have use -fno-early-inlining with -Os too.
  21. CFLAGS-$(DODEBUG)-ldso/ldso := -O2 -g
  22. CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\"
  23. LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1
  24. ifneq ($(SUPPORT_LD_DEBUG),y)
  25. LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS)
  26. else
  27. LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
  28. endif
  29. LDFLAGS-$(UCLIBC_LDSO_NAME).so += -Wl,-e,$(SYMBOL_PREFIX)_start -Wl,-z,now -Wl,-Bsymbolic \
  30. -Wl,--export-dynamic $(CFLAG_-Wl--sort-common) -Wl,--discard-locals \
  31. $(CFLAG_-Wl--discard-all) -Wl,--no-undefined
  32. ldso_FULL_NAME := $(UCLIBC_LDSO_NAME)-$(VERSION).so
  33. $(UCLIBC_LDSO_NAME)_DIR := $(top_srcdir)ldso/ldso
  34. $(UCLIBC_LDSO_NAME)_OUT := $(top_builddir)ldso/ldso
  35. $(UCLIBC_LDSO_NAME)_CSRC := $($(UCLIBC_LDSO_NAME)_DIR)/ldso.c
  36. # prerequesites
  37. $($(UCLIBC_LDSO_NAME)_OUT)/ldso.o $($(UCLIBC_LDSO_NAME)_OUT)/ldso.oS: \
  38. $($(UCLIBC_LDSO_NAME)_DIR)/dl-debug.c \
  39. $($(UCLIBC_LDSO_NAME)_DIR)/dl-startup.c \
  40. $($(UCLIBC_LDSO_NAME)_DIR)/dl-array.c \
  41. $($(UCLIBC_LDSO_NAME)_DIR)/dl-hash.c \
  42. $($(UCLIBC_LDSO_NAME)_DIR)/dl-elf.c
  43. $(UCLIBC_LDSO_NAME)_COBJ := $(patsubst $($(UCLIBC_LDSO_NAME)_DIR)/%.c,$($(UCLIBC_LDSO_NAME)_OUT)/%.o,$($(UCLIBC_LDSO_NAME)_CSRC))
  44. $(UCLIBC_LDSO_NAME)_SSRC := $(wildcard $($(UCLIBC_LDSO_NAME)_DIR)/$(TARGET_ARCH)/*.S)
  45. $(UCLIBC_LDSO_NAME)_SOBJ := $(patsubst $($(UCLIBC_LDSO_NAME)_DIR)/$(TARGET_ARCH)/%.S,$($(UCLIBC_LDSO_NAME)_OUT)/$(TARGET_ARCH)/%.o,$($(UCLIBC_LDSO_NAME)_SSRC))
  46. $(UCLIBC_LDSO_NAME)_OBJS := $($(UCLIBC_LDSO_NAME)_COBJ) $($(UCLIBC_LDSO_NAME)_SOBJ)
  47. ldso-y := $($(UCLIBC_LDSO_NAME)_OBJS:.o=.oS)
  48. lib-so-y += $(ldso)
  49. objclean-y += CLEAN_ldso/ldso
  50. ifeq ($(LDSO_PRELINK_SUPPORT),y)
  51. # Use a specific linker script for ld.so
  52. LDFLAGS-$(UCLIBC_LDSO_NAME).so += -T $(ldso:.$(ABI_VERSION)=).lds
  53. endif
  54. $(ldso): $(ldso:.$(ABI_VERSION)=)
  55. $(ldso:.$(ABI_VERSION)=): $($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a
  56. ifeq ($(LDSO_PRELINK_SUPPORT),y)
  57. $(call create-lds)
  58. endif
  59. $(call link.so,$(ldso_FULL_NAME),$(ABI_VERSION))
  60. $($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a: $(ldso-y)
  61. $(Q)$(RM) $@
  62. $(do_ar)
  63. CLEAN_ldso/ldso:
  64. $(do_rm) $(addprefix $($(UCLIBC_LDSO_NAME)_OUT)/,$(foreach e, o os oS a,$(foreach d, *. */*.,$(d)$(e))))