]> sourceware.org Git - glibc.git/blame - elf/Makefile
Tue Jun 11 15:09:15 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[glibc.git] / elf / Makefile
CommitLineData
d66e34cd
RM
1# Makefile for elf subdirectory of GNU C Library.
2
a641835a 3# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
01cc0be6
RM
4# This file is part of the GNU C Library.
5
6# The GNU C Library is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Library General Public License as
8# published by the Free Software Foundation; either version 2 of the
9# License, or (at your option) any later version.
10
11# The GNU C Library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# Library General Public License for more details.
15
16# You should have received a copy of the GNU Library General Public
17# License along with the GNU C Library; see the file COPYING.LIB. If
18# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19# Cambridge, MA 02139, USA.
20
d66e34cd
RM
21subdir := elf
22
567c63af 23headers = elf.h elfclass.h link.h dlfcn.h
ba79d61b
RM
24routines = init-first $(dl-routines) \
25 dl-open dl-close dl-symbol dl-support
266180eb
RM
26
27# The core dynamic linking functions are in libc for the static and
28# profiled libraries.
29dl-routines = $(addprefix dl-,load lookup object reloc deps \
30 runtime error init fini)
31# But they are absent from the shared libc, because that code is in ld.so.
32elide-routines.so = $(dl-routines) dl-support
33
34# ld.so uses those routines, plus some special stuff for being the program
35# interpreter and operating independent of libc.
36rtld-routines := rtld $(dl-routines) dl-sysdep dl-minimal
37distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
38 soinit.c sofini.c ldd.sh.in linux-compat.c
d66e34cd 39
266180eb 40extra-libs = libdl
a2b934be 41libdl-routines := dlopen dlclose dlsym dlerror dladdr
d66e34cd 42
01cc0be6 43
bfc04a9f
RM
44all: # Make this the default target; it will be defined in Rules.
45
d66e34cd
RM
46include ../Makeconfig
47
48ifeq (yes,$(build-shared))
0324daa0 49extra-objs = $(rtld-routines:=.so) soinit.so sofini.so
db2286f6 50generated = librtld.so dl-allobjs.so
094bacdb 51install-others = $(slibdir)/$(rtld-installed-name)
b122c703 52install-bin = ldd
86d2c878 53
266180eb 54# Make sure these things are built in the `make lib' pass so they can be used
1796d83f 55# to run programs during the `make others' pass.
14d898ae 56lib-noranlib: $(objpfx)ld.so $(addprefix $(objpfx),$(extra-objs))
1796d83f 57
ba79d61b 58ifneq (,$(filter linux% linux,$(config-os)))
86d2c878 59extra-objs += linux-compat.so
094bacdb 60install-others += $(slibdir)/ld-linux.so.1
14d898ae 61lib-noranlib: $(objpfx)ld-linux.so.1
86d2c878 62endif
d66e34cd 63endif
01cc0be6
RM
64
65include ../Rules
d66e34cd 66
86d2c878 67
db2286f6
RM
68# Command to link into a larger single relocatable object.
69reloc-link = $(LINK.o) -nostdlib -nostartfiles -r -o $@
70
71$(objpfx)dl-allobjs.so: $(rtld-routines:%=$(objpfx)%.so)
72 $(reloc-link) $^
73
86d2c878
RM
74# Link together the dynamic linker into a single relocatable object.
75# We use this to produce both the ABI-compliant and Linux-compatible
76# dynamic linker shared objects below.
db2286f6 77$(objpfx)librtld.so: $(objpfx)dl-allobjs.so \
86d2c878 78 $(patsubst %,$(common-objpfx)lib%_pic.a,\
ba79d61b 79 c $(LDLIBS-c.so:-l%=%))
db2286f6 80 $(reloc-link) '-Wl,-(' $^ -lgcc '-Wl,-)'
d66e34cd 81
e3845371
RM
82$(objpfx)ld.so: $(objpfx)librtld.so
83 $(rtld-link) -Wl,-soname=$(rtld-installed-name)
84$(objpfx)ld-linux.so.1: $(objpfx)librtld.so
85 $(rtld-link) -Wl,-soname=ld-linux.so.1
86
87define rtld-link
88$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
89 -Wl,-rpath=$(default-rpath) $^
90endef
86d2c878 91
266180eb
RM
92# The dl code in the static libc needs a default library path.
93CFLAGS-dl-support.c = -D'DEFAULT_RPATH="$(default-rpath)"'
94
86d2c878
RM
95# The Linux-compatible dynamic linker shared object is just the same
96# with one object file of compatibility initialization code added.
97$(objpfx)ld-linux.so.1: $(objpfx)linux-compat.so
98
99
266180eb
RM
100# Specify the dependencies of libdl.so; its commands come from the generic
101# rule to build a shared library.
7e0e6f50 102$(objpfx)libdl.so: $(objpfx)libdl_pic.a $(common-objpfx)libc.so $(objpfx)ld.so
b122c703 103
094bacdb
RM
104$(slibdir)/$(rtld-installed-name): $(objpfx)ld.so; $(do-install-program)
105$(slibdir)/ld-linux.so.1: $(objpfx)ld-linux.so.1; $(do-install-program)
b122c703 106
f8adc70c
RM
107$(objpfx)ldd: ldd.sh.in Makefile
108 sed 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' < $< > $@.new
094bacdb 109 chmod 555 $@.new
b122c703 110 mv -f $@.new $@
This page took 0.056195 seconds and 5 git commands to generate.