summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-01-31 01:37:38 +0000
committerEric Andersen <andersen@codepoet.org>2002-01-31 01:37:38 +0000
commite2d432ecf053ec5f69f42263b69daee149d9f345 (patch)
treef0c5a1dd1f0b53b02a8633fe911be3674348b244
parent62d35f17c6463a9de72ad94a81bfb1900b629562 (diff)
make sure all utilities will build even with older toolchains by
using our own local elf.h header rather than the system one. -Erik
-rw-r--r--ldso/util/.cvsignore3
-rw-r--r--ldso/util/Makefile29
-rw-r--r--ldso/util/ldconfig.c2
-rw-r--r--ldso/util/ldd.c2
-rw-r--r--ldso/util/readelf.c2
-rw-r--r--ldso/util/readsoname.c2
6 files changed, 22 insertions, 18 deletions
diff --git a/ldso/util/.cvsignore b/ldso/util/.cvsignore
index d8832730f..987ab3d9f 100644
--- a/ldso/util/.cvsignore
+++ b/ldso/util/.cvsignore
@@ -1,5 +1,6 @@
ldd
ldd.target
-ldconfig
readelf
readelf.target
+ldconfig
+elf.h
diff --git a/ldso/util/Makefile b/ldso/util/Makefile
index d143ba934..3dce67cff 100644
--- a/ldso/util/Makefile
+++ b/ldso/util/Makefile
@@ -24,20 +24,14 @@ TOPDIR=../../
include $(TOPDIR)Rules.mak
TARGET_CC = $(TOPDIR)extra/gcc-uClibc/$(NATIVE_ARCH)-uclibc-gcc
-TARGETS=ldconfig ldd ldd.target readelf readelf.target
+TARGETS=elf_header ldconfig ldd ldd.target readelf readelf.target
all: $(TARGETS)
-readsoname.o: readsoname.c readsoname2.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-ldconfig.o: ldconfig.c
- $(CC) $(CFLAGS) -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
- -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
+elf_header:
+ ln -fs $(TOPDIR)include/elf.h
readelf: readelf.c
- $(NATIVE_CC) $(NATIVE_CFLAGS) readelf.c -o $@
+ $(NATIVE_CC) $(NATIVE_CFLAGS) -I . readelf.c -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
readelf.target: readelf.c
@@ -48,8 +42,17 @@ ifeq ($(strip $(LIBRARY_CACHE)),)
ldconfig:
echo "LIBRARY_CACHE disabled -- not building ldconfig"
else
+readsoname.o: readsoname.c readsoname2.c
+ $(NATIVE_CC) $(NATIVE_CFLAGS) -I . -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
+ldconfig.o: ldconfig.c
+ $(NATIVE_CC) $(NATIVE_CFLAGS) -I . \
+ -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
ldconfig: ldconfig.o readsoname.o
- $(CC) $(CFLAGS) $^ -o $@
+ $(NATIVE_CC) $(NATIVE_CFLAGS) $^ -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
endif
@@ -57,7 +60,7 @@ ldd: ldd.c
$(NATIVE_CC) $(NATIVE_CFLAGS) -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\" \
- -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" \
+ -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" -I . \
ldd.c -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
@@ -70,5 +73,5 @@ ldd.target: ldd.c
$(STRIPTOOL) -x -R .note -R .comment $@
clean:
- rm -f $(TARGETS) *.o *~ core
+ rm -f $(TARGETS) *.o *~ core ./elf.h
diff --git a/ldso/util/ldconfig.c b/ldso/util/ldconfig.c
index 63765a78c..4660bd458 100644
--- a/ldso/util/ldconfig.c
+++ b/ldso/util/ldconfig.c
@@ -33,11 +33,11 @@
#include <dirent.h>
#include <unistd.h>
#include <link.h>
-#include <elf.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <errno.h>
+#include "elf.h"
#include "../config.h"
#include "readsoname.h"
diff --git a/ldso/util/ldd.c b/ldso/util/ldd.c
index aea135e60..470368a3c 100644
--- a/ldso/util/ldd.c
+++ b/ldso/util/ldd.c
@@ -29,7 +29,6 @@
*/
-#include <elf.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -38,6 +37,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include "elf.h"
struct library {
char *name;
diff --git a/ldso/util/readelf.c b/ldso/util/readelf.c
index 4467fc684..903b63148 100644
--- a/ldso/util/readelf.c
+++ b/ldso/util/readelf.c
@@ -29,7 +29,6 @@
*/
-#include <elf.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -38,6 +37,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include "elf.h"
diff --git a/ldso/util/readsoname.c b/ldso/util/readsoname.c
index db772f0ae..2b3f8353f 100644
--- a/ldso/util/readsoname.c
+++ b/ldso/util/readsoname.c
@@ -5,9 +5,9 @@
#include <sys/stat.h>
#include <sys/mman.h>
#include <link.h>
-#include <elf.h>
#include <unistd.h>
#include <sys/types.h>
+#include "elf.h"
#include "../config.h"
#include "readsoname.h"