aboutsummaryrefslogtreecommitdiff
path: root/ldso/ldso/Makefile.in
blob: 8152642917642d8bbdd5db0984a8564316fb55eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Makefile for uClibc
#
# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#

subdirs += ldso/ldso/$(TARGET_ARCH)

CFLAGS-rtld := -DNOT_IN_libc -DIS_IN_rtld $(SSP_DISABLE_FLAGS)

ifneq ($(TARGET_ARCH),arc)
# This stuff will not work with -fomit-frame-pointer
CFLAGS-rtld += -fno-omit-frame-pointer
endif

CFLAGS-rtld += -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include -I$(top_srcdir)ldso/ldso
CFLAGS-rtld += -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\"

# Not really much point in including debugging info, since gdb
# can't really debug ldso, since gdb requires help from ldso to
# debug things....
# On arm, gcc-4.3.x onwards -Os emits calls to libgcc, which calls _div0,
# which tries to call raise(). And raise comes from libc so a catch 22.
# Using -O2 instead. We could have use -fno-early-inlining with -Os too.
CFLAGS-$(DODEBUG)-ldso/ldso := -O2 -g

CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\"

LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1
ifneq ($(SUPPORT_LD_DEBUG),y)
LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS)
else
LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
endif
LDFLAGS-$(UCLIBC_LDSO_NAME).so += -Wl,-e,$(SYMBOL_PREFIX)_start -Wl,-z,now -Wl,-Bsymbolic \
	-Wl,--export-dynamic $(CFLAG_-Wl--sort-common) -Wl,--discard-locals \
	$(CFLAG_-Wl--discard-all) -Wl,--no-undefined

ldso_FULL_NAME := $(UCLIBC_LDSO_NAME)-$(VERSION).so

$(UCLIBC_LDSO_NAME)_DIR := $(top_srcdir)ldso/ldso
$(UCLIBC_LDSO_NAME)_OUT := $(top_builddir)ldso/ldso

$(UCLIBC_LDSO_NAME)_CSRC := $($(UCLIBC_LDSO_NAME)_DIR)/ldso.c
# prerequesites
$($(UCLIBC_LDSO_NAME)_OUT)/ldso.o $($(UCLIBC_LDSO_NAME)_OUT)/ldso.oS: \
	$($(UCLIBC_LDSO_NAME)_DIR)/dl-debug.c \
	$($(UCLIBC_LDSO_NAME)_DIR)/dl-startup.c \
	$($(UCLIBC_LDSO_NAME)_DIR)/dl-array.c \
	$($(UCLIBC_LDSO_NAME)_DIR)/dl-hash.c \
	$($(UCLIBC_LDSO_NAME)_DIR)/dl-elf.c
$(UCLIBC_LDSO_NAME)_COBJ := $(patsubst $($(UCLIBC_LDSO_NAME)_DIR)/%.c,$($(UCLIBC_LDSO_NAME)_OUT)/%.o,$($(UCLIBC_LDSO_NAME)_CSRC))

$(UCLIBC_LDSO_NAME)_SSRC := $(wildcard $($(UCLIBC_LDSO_NAME)_DIR)/$(TARGET_ARCH)/*.S)
$(UCLIBC_LDSO_NAME)_SOBJ := $(patsubst $($(UCLIBC_LDSO_NAME)_DIR)/$(TARGET_ARCH)/%.S,$($(UCLIBC_LDSO_NAME)_OUT)/$(TARGET_ARCH)/%.o,$($(UCLIBC_LDSO_NAME)_SSRC))

$(UCLIBC_LDSO_NAME)_OBJS := $($(UCLIBC_LDSO_NAME)_COBJ) $($(UCLIBC_LDSO_NAME)_SOBJ)

ldso-y := $($(UCLIBC_LDSO_NAME)_OBJS:.o=.oS)

lib-so-y += $(ldso)
objclean-y += CLEAN_ldso/ldso

ifeq ($(LDSO_PRELINK_SUPPORT),y)
# Use a specific linker script for ld.so
LDFLAGS-$(UCLIBC_LDSO_NAME).so += -T $(ldso:.$(ABI_VERSION)=).lds
endif

$(ldso): $(ldso:.$(ABI_VERSION)=)
$(ldso:.$(ABI_VERSION)=): | $(top_builddir)lib
$(ldso:.$(ABI_VERSION)=): $($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a
ifeq ($(LDSO_PRELINK_SUPPORT),y)
	$(call create-lds)
endif
	$(call link.so,$(ldso_FULL_NAME),$(ABI_VERSION))

$($(UCLIBC_LDSO_NAME)_OUT)/$(UCLIBC_LDSO_NAME)_so.a: $(ldso-y)
	$(Q)$(RM) $@
	$(do_ar)

CLEAN_ldso/ldso:
	$(do_rm) $(addprefix $($(UCLIBC_LDSO_NAME)_OUT)/,$(foreach e, o os oS a,$(foreach d, *. */*.,$(d)$(e))))