Page MenuHomeFreeBSD

D32464.id96771.diff
No OneTemporary

D32464.id96771.diff

diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c
--- a/libexec/rtld-elf/arm/reloc.c
+++ b/libexec/rtld-elf/arm/reloc.c
@@ -16,7 +16,7 @@
#include "debug.h"
#include "rtld.h"
-#include "paths.h"
+#include "rtld_paths.h"
#ifdef __ARM_FP
/*
diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c
--- a/libexec/rtld-elf/libmap.c
+++ b/libexec/rtld-elf/libmap.c
@@ -16,7 +16,7 @@
#include "debug.h"
#include "rtld.h"
#include "libmap.h"
-#include "paths.h"
+#include "rtld_paths.h"
#include "rtld_libc.h"
TAILQ_HEAD(lm_list, lm);
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -63,7 +63,7 @@
#include "debug.h"
#include "rtld.h"
#include "libmap.h"
-#include "paths.h"
+#include "rtld_paths.h"
#include "rtld_tls.h"
#include "rtld_printf.h"
#include "rtld_malloc.h"
diff --git a/libexec/rtld-elf/rtld_malloc.c b/libexec/rtld-elf/rtld_malloc.c
--- a/libexec/rtld-elf/rtld_malloc.c
+++ b/libexec/rtld-elf/rtld_malloc.c
@@ -55,7 +55,7 @@
#include <unistd.h>
#include "rtld.h"
#include "rtld_printf.h"
-#include "paths.h"
+#include "rtld_paths.h"
/*
* Pre-allocate mmap'ed pages
diff --git a/libexec/rtld-elf/paths.h b/libexec/rtld-elf/rtld_paths.h
rename from libexec/rtld-elf/paths.h
rename to libexec/rtld-elf/rtld_paths.h
--- a/libexec/rtld-elf/paths.h
+++ b/libexec/rtld-elf/rtld_paths.h
@@ -26,15 +26,19 @@
* $FreeBSD$
*/
-#ifndef PATHS_H
-#define PATHS_H
+#ifndef _RTLD_PATHS_H
+#define _RTLD_PATHS_H
#undef _PATH_ELF_HINTS
+#ifndef _COMPAT32_BASENAME_RTLD
+#define _COMPAT32_BASENAME_RTLD "ld-elf32.so.1"
+#endif
+
#ifdef COMPAT_32BIT
#define _PATH_ELF_HINTS "/var/run/ld-elf32.so.hints"
#define _PATH_LIBMAP_CONF "/etc/libmap32.conf"
-#define _BASENAME_RTLD "ld-elf32.so.1"
+#define _BASENAME_RTLD _COMPAT32_BASENAME_RTLD
#define STANDARD_LIBRARY_PATH "/lib32:/usr/lib32"
#define LD_ "LD_32_"
#endif
@@ -55,6 +59,10 @@
#define _PATH_RTLD "/libexec/" _BASENAME_RTLD
#endif
+#ifndef _COMPAT32_PATH_RTLD
+#define _COMPAT32_PATH_RTLD "/libexec/" _COMPAT32_BASENAME_RTLD
+#endif
+
#ifndef STANDARD_LIBRARY_PATH
#define STANDARD_LIBRARY_PATH "/lib/casper:/lib:/usr/lib"
#endif
@@ -69,10 +77,12 @@
#define SOFT_STANDARD_LIBRARY_PATH "/usr/libsoft"
#define LD_SOFT_ "LD_SOFT_"
+#ifdef IN_RTLD
extern const char *ld_elf_hints_default;
extern const char *ld_path_libmap_conf;
extern const char *ld_path_rtld;
extern const char *ld_standard_library_path;
extern const char *ld_env_prefix;
+#endif
-#endif /* PATHS_H */
+#endif /* _RTLD_PATHS_H */
diff --git a/usr.bin/ldd/Makefile b/usr.bin/ldd/Makefile
--- a/usr.bin/ldd/Makefile
+++ b/usr.bin/ldd/Makefile
@@ -3,6 +3,7 @@
PROG?= ldd
SRCS= ldd.c
+CFLAGS+= -I${SRCTOP}/libexec/rtld-elf
LIBADD= elf
.include <bsd.prog.mk>
diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c
--- a/usr.bin/ldd/ldd.c
+++ b/usr.bin/ldd/ldd.c
@@ -46,6 +46,7 @@
#include <fcntl.h>
#include <gelf.h>
#include <libelf.h>
+#include <rtld_paths.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -134,7 +135,8 @@
main(int argc, char *argv[])
{
char *fmt1, *fmt2;
- int rval, c, aflag;
+ const char *rtld;
+ int aflag, c, fd, rval, status, is_shlib, rv, type;
aflag = 0;
fmt1 = fmt2 = NULL;
@@ -167,8 +169,6 @@
rval = 0;
for (; argc > 0; argc--, argv++) {
- int fd, status, is_shlib, rv, type;
-
if ((fd = open(*argv, O_RDONLY, 0)) < 0) {
warn("%s", *argv);
rval |= 1;
@@ -236,15 +236,23 @@
if (is_shlib == 0) {
execl(*argv, *argv, (char *)NULL);
warn("%s", *argv);
- } else {
+ } else if (fmt1 == NULL && fmt2 == NULL) {
dlopen(*argv, RTLD_TRACE);
warnx("%s: %s", *argv, dlerror());
+ } else {
+ rtld = _PATH_RTLD;
+#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED)
+ if (type == TYPE_ELF32)
+ rtld = _COMPAT32_PATH_RTLD;
+#endif
+ execl(rtld, rtld, "-d", "--",
+ *argv, (char *)NULL);
}
_exit(1);
}
}
- return rval;
+ return (rval);
}
static void

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 23, 1:25 AM (1 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28948030
Default Alt Text
D32464.id96771.diff (3 KB)

Event Timeline