Mon Dec 14 06:57:17 2009 UTC ()
merge from -current:
>rename LD32DIR to MLIBDIR.

>- adjust the logic for compat ldd: add an elf32_compat module and arrange
>  for mips64 to build this with MLIBDIR set to o32
>- make mips64 ldd call elf32_compat_ldd as well
>- make mips64 elf64 set MLIBDIR to 64
>- don't need ld.elf_so's Makefile.ld32 files anymore (they are going away
>  soon anyway)
>
>tested on amd64 and sparc64, and an earlier version tested on mips64.

>if BSD_MK_COMPAT_FILE is defined, .include it.

>simplify the logic for compat ld.elf_so and move it here.  we now can
>find the libc objdir for multiple compat ld.elf_so's, too.


(mrg)
diff -r1.87 -r1.87.8.1 src/libexec/ld.elf_so/Makefile
diff -r1.11.2.1 -r1.11.2.1.4.1 src/libexec/ld.elf_so/arch/i386/Makefile.inc
diff -r1.1.2.2 -r0 src/libexec/ld.elf_so/arch/i386/Makefile.ld32
diff -r1.15.32.4 -r1.15.32.5 src/libexec/ld.elf_so/arch/mips/Makefile.inc
diff -r1.11.2.1 -r1.11.2.1.4.1 src/libexec/ld.elf_so/arch/sparc/Makefile.inc
diff -r1.1.2.2 -r0 src/libexec/ld.elf_so/arch/sparc/Makefile.ld32

cvs diff -r1.87 -r1.87.8.1 src/libexec/ld.elf_so/Makefile (expand / switch to unified diff)

--- src/libexec/ld.elf_so/Makefile 2008/10/26 07:11:54 1.87
+++ src/libexec/ld.elf_so/Makefile 2009/12/14 06:57:16 1.87.8.1
@@ -1,14 +1,19 @@ @@ -1,14 +1,19 @@
1# $NetBSD: Makefile,v 1.87 2008/10/26 07:11:54 mrg Exp $ 1# $NetBSD: Makefile,v 1.87.8.1 2009/12/14 06:57:16 mrg Exp $
 2
 3# This needs to be before bsd.init.mk
 4.if defined(BSD_MK_COMPAT_FILE)
 5.include <${BSD_MK_COMPAT_FILE}>
 6.endif
2 7
3# We are not building this with PIE 8# We are not building this with PIE
4PIE_CFLAGS= 9PIE_CFLAGS=
5PIE_LDFLAGS= 10PIE_LDFLAGS=
6.include <bsd.init.mk> # for OBJECT_FMT definition 11.include <bsd.init.mk> # for OBJECT_FMT definition
7.include <bsd.shlib.mk> # for SHLINKINSTALLDIR definition 12.include <bsd.shlib.mk> # for SHLINKINSTALLDIR definition
8 13
9.if defined(LDELFSO_MACHINE_CPU) && !empty(LDELFSO_MACHINE_CPU) && \ 14.if defined(LDELFSO_MACHINE_CPU) && !empty(LDELFSO_MACHINE_CPU) && \
10 exists(${.CURDIR}/arch/${LDELFSO_MACHINE_CPU}) 15 exists(${.CURDIR}/arch/${LDELFSO_MACHINE_CPU})
11ARCHSUBDIR= ${LDELFSO_MACHINE_CPU} 16ARCHSUBDIR= ${LDELFSO_MACHINE_CPU}
12.else 17.else
13ARCHSUBDIR= ${MACHINE_CPU} 18ARCHSUBDIR= ${MACHINE_CPU}
14.endif 19.endif
@@ -18,44 +23,45 @@ M= ${.CURDIR}/arch/${ARCHSUBDIR} @@ -18,44 +23,45 @@ M= ${.CURDIR}/arch/${ARCHSUBDIR}
18 (${MACHINE_CPU} == "arm") || \ 23 (${MACHINE_CPU} == "arm") || \
19 (${MACHINE_ARCH} == "hppa") || \ 24 (${MACHINE_ARCH} == "hppa") || \
20 (${MACHINE_ARCH} == "i386") || \ 25 (${MACHINE_ARCH} == "i386") || \
21 (${MACHINE_ARCH} == "m68k") || \ 26 (${MACHINE_ARCH} == "m68k") || \
22 (${MACHINE_CPU} == "mips") || \ 27 (${MACHINE_CPU} == "mips") || \
23 (${MACHINE_ARCH} == "powerpc") || \ 28 (${MACHINE_ARCH} == "powerpc") || \
24 (${MACHINE_CPU} == "sh3") || \ 29 (${MACHINE_CPU} == "sh3") || \
25 (${MACHINE_ARCH} == "sparc") || \ 30 (${MACHINE_ARCH} == "sparc") || \
26 (${MACHINE_ARCH} == "sparc64") || \ 31 (${MACHINE_ARCH} == "sparc64") || \
27 (${MACHINE_ARCH} == "x86_64") || \ 32 (${MACHINE_ARCH} == "x86_64") || \
28 (${MACHINE_ARCH} == "vax")) && \ 33 (${MACHINE_ARCH} == "vax")) && \
29 ${OBJECT_FMT} == "ELF" && ${MKPIC} != "no" 34 ${OBJECT_FMT} == "ELF" && ${MKPIC} != "no"
30 35
31PROG?= ld.elf_so 
32 
33LDFLAGS+= -shared -symbolic -nostartfiles 36LDFLAGS+= -shared -symbolic -nostartfiles
34LDFLAGS+= -Wl,-static 37LDFLAGS+= -Wl,-static
35 38
36# Adds SRCS, CPPFLAGS, LDFLAGS, etc. Must go first so MD startup source 39# Adds SRCS, CPPFLAGS, LDFLAGS, etc. Must go first so MD startup source
37# is first. 40# is first.
38.if exists($M/Makefile.inc) 41.if exists($M/Makefile.inc)
39.include "$M/Makefile.inc" 42.include "$M/Makefile.inc"
40.endif 43.endif
41 44
42# Support src/compat/libexec/ld.elf_so. 45# Support compat ld.elf_so.
43.if defined(LD32DIR) 46.if defined(MLIBDIR)
44CLIBOBJ!= cd ${NETBSDSRCDIR}/compat/lib/libc && ${PRINTOBJDIR} 47PROG= ld.elf_so-${MLIBDIR}
 48CPPFLAGS+= -DRTLD_ARCH_SUBDIR=\"${MLIBDIR}\"
45.else 49.else
46CLIBOBJ!= cd ${NETBSDSRCDIR}/lib/libc && ${PRINTOBJDIR} 50PROG= ld.elf_so
47.endif 51.endif
48 52
 53CLIBOBJ!= cd ${NETBSDSRCDIR}/lib/libc && ${PRINTOBJDIR}
 54
49SRCS+= rtld.c reloc.c symbol.c xmalloc.c xprintf.c debug.c \ 55SRCS+= rtld.c reloc.c symbol.c xmalloc.c xprintf.c debug.c \
50 map_object.c load.c search.c headers.c paths.c expand.c 56 map_object.c load.c search.c headers.c paths.c expand.c
51 57
52.if ${USE_FORT} == "yes" 58.if ${USE_FORT} == "yes"
53.PATH.c: ${NETBSDSRCDIR}/lib/libc/misc 59.PATH.c: ${NETBSDSRCDIR}/lib/libc/misc
54SRCS+= stack_protector.c 60SRCS+= stack_protector.c
55.endif 61.endif
56 62
57.PATH.c: ${NETBSDSRCDIR}/lib/libc/stdlib 63.PATH.c: ${NETBSDSRCDIR}/lib/libc/stdlib
58SRCS+= exit.c 64SRCS+= exit.c
59 65
60BINDIR= ${SHLINKINSTALLDIR} 66BINDIR= ${SHLINKINSTALLDIR}
61 67

cvs diff -r1.11.2.1 -r1.11.2.1.4.1 src/libexec/ld.elf_so/arch/i386/Makefile.inc (expand / switch to unified diff)

--- src/libexec/ld.elf_so/arch/i386/Makefile.inc 2009/01/16 22:21:30 1.11.2.1
+++ src/libexec/ld.elf_so/arch/i386/Makefile.inc 2009/12/14 06:57:16 1.11.2.1.4.1
@@ -1,14 +1,10 @@ @@ -1,14 +1,10 @@
1# $NetBSD: Makefile.inc,v 1.11.2.1 2009/01/16 22:21:30 bouyer Exp $ 1# $NetBSD: Makefile.inc,v 1.11.2.1.4.1 2009/12/14 06:57:16 mrg Exp $
2 2
3SRCS+= rtld_start.S mdreloc.c 3SRCS+= rtld_start.S mdreloc.c
4 4
5# XXX Should not be in CPPFLAGS! 5# XXX Should not be in CPPFLAGS!
6CPPFLAGS+= -fpic 6CPPFLAGS+= -fpic
7 7
8CPPFLAGS+= -DELFSIZE=32 8CPPFLAGS+= -DELFSIZE=32
9 9
10LDFLAGS+= -Wl,-e,.rtld_start 10LDFLAGS+= -Wl,-e,.rtld_start
11 
12.if defined(LD32DIR) 
13.include "Makefile.ld32" 
14.endif 

File Deleted: src/libexec/ld.elf_so/arch/i386/Attic/Makefile.ld32

cvs diff -r1.15.32.4 -r1.15.32.5 src/libexec/ld.elf_so/arch/mips/Makefile.inc (expand / switch to unified diff)

--- src/libexec/ld.elf_so/arch/mips/Makefile.inc 2009/09/13 21:21:57 1.15.32.4
+++ src/libexec/ld.elf_so/arch/mips/Makefile.inc 2009/12/14 06:57:16 1.15.32.5
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile.inc,v 1.15.32.4 2009/09/13 21:21:57 matt Exp $ 1# $NetBSD: Makefile.inc,v 1.15.32.5 2009/12/14 06:57:16 mrg Exp $
2 2
3SRCS+= rtld_start.S mips_reloc.c 3SRCS+= rtld_start.S mips_reloc.c
4 4
5# XXX Should not be in CPPFLAGS! 5# XXX Should not be in CPPFLAGS!
6CPUFLAGS+= -G0 6CPUFLAGS+= -G0
7 7
8ABI64?= ${CPUFLAGS:M-mabi=64:M-mabi=o64} 8ABI64?= ${CPUFLAGS:M-mabi=64:M-mabi=o64}
9.if !empty(ABI64) 9.if !empty(ABI64) || (defined(MLIBDIR) && ${MLIBDIR} == 64)
10CPPFLAGS+= -DELFSIZE=64 10CPPFLAGS+= -DELFSIZE=64
11.else 11.else
12CPPFLAGS+= -DELFSIZE=32 12CPPFLAGS+= -DELFSIZE=32
13.endif 13.endif
14CPPFLAGS+= -DRTLD_INHIBIT_COPY_RELOCS 14CPPFLAGS+= -DRTLD_INHIBIT_COPY_RELOCS
15AFLAGS+= -Wa,--fatal-warnings 15AFLAGS+= -Wa,--fatal-warnings
16 16
17LDFLAGS+= -Wl,-e,.rtld_start 17LDFLAGS+= -Wl,-e,.rtld_start

cvs diff -r1.11.2.1 -r1.11.2.1.4.1 src/libexec/ld.elf_so/arch/sparc/Makefile.inc (expand / switch to unified diff)

--- src/libexec/ld.elf_so/arch/sparc/Makefile.inc 2009/01/16 22:21:30 1.11.2.1
+++ src/libexec/ld.elf_so/arch/sparc/Makefile.inc 2009/12/14 06:57:17 1.11.2.1.4.1
@@ -1,14 +1,10 @@ @@ -1,14 +1,10 @@
1# $NetBSD: Makefile.inc,v 1.11.2.1 2009/01/16 22:21:30 bouyer Exp $ 1# $NetBSD: Makefile.inc,v 1.11.2.1.4.1 2009/12/14 06:57:17 mrg Exp $
2 2
3SRCS+= rtld_start.S mdreloc.c 3SRCS+= rtld_start.S mdreloc.c
4 4
5# XXX Should not be in CPPFLAGS! 5# XXX Should not be in CPPFLAGS!
6CPPFLAGS+= -fpic 6CPPFLAGS+= -fpic
7 7
8CPPFLAGS+= -DELFSIZE=32 8CPPFLAGS+= -DELFSIZE=32
9 9
10LDFLAGS+= -Wl,-e,_rtld_start 10LDFLAGS+= -Wl,-e,_rtld_start
11 
12.if defined(LD32DIR) 
13.include "Makefile.ld32" 
14.endif 

File Deleted: src/libexec/ld.elf_so/arch/sparc/Attic/Makefile.ld32