DragonFly submit List (threaded) for 2004-03
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
ld patch
Hoi,
attached patch let's the new binutils work like the old.
Before:
$ gcc -lGLU -L/usr/X11R6/lib
/usr/libexec/binutils214/elf/ld: warning: libstdc++.so.4, needed by /usr/X11R6/lib/libGLU.so, not
found (try using -rpath or -rpath-link)
/usr/lib/crt1.o(.text+0x88): In function `_start':
: undefined reference to `main'
/usr/X11R6/lib/libGLU.so: undefined reference to `operator new[](unsigned)'
/usr/X11R6/lib/libGLU.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/X11R6/lib/libGLU.so: undefined reference to `operator delete(void*)'
/usr/X11R6/lib/libGLU.so: undefined reference to `__gxx_personality_v0'
/usr/X11R6/lib/libGLU.so: undefined reference to `__cxa_pure_virtual'
/usr/X11R6/lib/libGLU.so: undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/X11R6/lib/libGLU.so: undefined reference to `operator delete[](void*)'
/usr/X11R6/lib/libGLU.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
/usr/X11R6/lib/libGLU.so: undefined reference to `operator new(unsigned)'
After:
$ gcc -lGLU -L/usr/X11R6/lib
/usr/lib/crt1.o(.text+0x88): In function `_start':
: undefined reference to `main'
Andy
also here:
http://ftp.fortunaty.net/DragonFly/inofficial/patches/binutils214::ld.patch.bz2
Index: gnu/usr.bin/binutils214/ld/Makefile.i386
===================================================================
RCS file: /home/dcvs/src/gnu/usr.bin/binutils214/ld/Makefile.i386,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile.i386
--- gnu/usr.bin/binutils214/ld/Makefile.i386 1 Feb 2004 08:53:04 -0000 1.1
+++ gnu/usr.bin/binutils214/ld/Makefile.i386 26 Mar 2004 04:32:14 -0000
@@ -16,13 +16,16 @@ EMS+= ${NATIVE_EMULATION}
LDSCRIPTS+= ${NATIVE_EMULATION}.x ${NATIVE_EMULATION}.xbn ${NATIVE_EMULATION}.xn ${NATIVE_EMULATION}.xr \
${NATIVE_EMULATION}.xs ${NATIVE_EMULATION}.xu ${NATIVE_EMULATION}.xc ${NATIVE_EMULATION}.xsc
SRCS+= e${NATIVE_EMULATION}.c
-CLEANFILES+= e${NATIVE_EMULATION}.c
+CLEANFILES+= e${NATIVE_EMULATION}.c elf32.em
e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
- scripttempl/elf.sc genscripts.sh stringify.sed
- sh ${SRCDIR}/ld/genscripts.sh ${SRCDIR}/ld ${_i386_path} \
- "" ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
- "${NATIVE_EMULATION}" "" no ${NATIVE_EMULATION} "${TARGET_TUPLE}"
+ scripttempl/elf.sc genscripts.sh stringify.sed ${.CURDIR}/patches/elf32.em.patch
+ patch -o elf32.em -i ${.CURDIR}/patches/elf32.em.patch ${SRCDIR}/ld/emultempl/elf32.em
+ # make the script use the patched version
+ sed 's!$${srcdir}/emultempl/$${TEMPLATE_NAME-generic}.em!$${TEMPLATE_NAME-generic}.em!' \
+ ${SRCDIR}/ld/genscripts.sh \
+ | sh -s ${SRCDIR}/ld ${_i386_path} "" ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
+ "${NATIVE_EMULATION}" "" no ${NATIVE_EMULATION} "${TARGET_TUPLE}"
# sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${_i386_path} \
# ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
# "${NATIVE_EMULATION}" "" ${NATIVE_EMULATION} "${TARGET_TUPLE}"
Index: gnu/usr.bin/binutils214/ld/patches/elf32.em.patch
===================================================================
RCS file: gnu/usr.bin/binutils214/ld/patches/elf32.em.patch
diff -N gnu/usr.bin/binutils214/ld/patches/elf32.em.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/usr.bin/binutils214/ld/patches/elf32.em.patch 26 Mar 2004 01:53:08 -0000
@@ -0,0 +1,188 @@
+--- emultempl/elf32.em 2 Feb 2004 07:29:28 -0000 1.1
++++ emultempl/elf32.em 25 Mar 2004 23:56:10 -0000
+@@ -440,11 +440,68 @@ gld${EMULATION_NAME}_search_needed (path
+ }
+
+ EOF
+-if [ "x${USE_LIBPATH}" = xyes ] ; then
+- cat >>e${EMULATION_NAME}.c <<EOF
++if [ "x${host}" = "x${target}" ] ; then
++ case " ${EMULATION_LIBPATH} " in
++ *" ${EMULATION_NAME} "*)
++ case ${target} in
++ *-*-freebsd* | *-*-dragonfly*)
++ cat >>e${EMULATION_NAME}.c <<EOF
++/*
++ * Read the system search path the FreeBSD way rather than like Linux.
++ */
++#include <elf-hints.h>
+
+-/* Add the sysroot to every entry in a colon-separated path. */
++static bfd_boolean gld${EMULATION_NAME}_check_ld_elf_hints
++ PARAMS ((const char *, int));
++
++static bfd_boolean
++gld${EMULATION_NAME}_check_ld_elf_hints (name, force)
++ const char *name;
++ int force;
++{
++ static bfd_boolean initialized;
++ static char *ld_elf_hints;
++
++ if (! initialized)
++ {
++ FILE *f;
++
++ f = fopen (_PATH_ELF_HINTS, FOPEN_RB);
++ if (f != NULL)
++ {
++ struct elfhints_hdr hdr;
++
++ if (fread(&hdr, 1, sizeof(hdr), f) == sizeof(hdr) &&
++ hdr.magic == ELFHINTS_MAGIC &&
++ hdr.version == 1)
++ {
++ if (fseek(f, hdr.strtab + hdr.dirlist, SEEK_SET) != -1)
++ {
++ char *b;
+
++ b = (char *) xmalloc (hdr.dirlistlen + 1);
++ if (fread(b, 1, hdr.dirlistlen + 1, f) !=
++ hdr.dirlistlen + 1)
++ {
++ free(b);
++ }
++ else
++ {
++ ld_elf_hints = b;
++ }
++ }
++ }
++ fclose (f);
++ }
++
++ initialized = TRUE;
++ }
++
++ if (ld_elf_hints == NULL)
++ return FALSE;
++
++ return gld${EMULATION_NAME}_search_needed (ld_elf_hints, name, force);
++}
+ static char * gld${EMULATION_NAME}_add_sysroot PARAMS ((const char *));
+
+ static char *
+@@ -484,9 +541,12 @@ gld${EMULATION_NAME}_add_sysroot (path)
+ }
+
+ EOF
+- case ${target} in
+- *-*-linux-gnu*)
+- cat >>e${EMULATION_NAME}.c <<EOF
++ # DragonFly
++ ;;
++
++ *-*-linux-gnu*)
++ cat >>e${EMULATION_NAME}.c <<EOF
++
+ /* For a native linker, check the file /etc/ld.so.conf for directories
+ in which we may find shared libraries. /etc/ld.so.conf is really
+ only meaningful on Linux. */
+@@ -581,6 +641,7 @@ gld${EMULATION_NAME}_check_ld_so_conf (n
+ EOF
+ # Linux
+ ;;
++ esac
+ esac
+ fi
+ cat >>e${EMULATION_NAME}.c <<EOF
+@@ -694,12 +755,16 @@ gld${EMULATION_NAME}_after_open ()
+ size_t len;
+ search_dirs_type *search;
+ EOF
+-if [ "x${USE_LIBPATH}" = xyes ] ; then
++if [ "x${host}" = "x${target}" ] ; then
++ case " ${EMULATION_LIBPATH} " in
++ *" ${EMULATION_NAME} "*)
+ cat >>e${EMULATION_NAME}.c <<EOF
+ const char *lib_path;
+ struct bfd_link_needed_list *rp;
+ int found;
+ EOF
++ ;;
++ esac
+ fi
+ cat >>e${EMULATION_NAME}.c <<EOF
+
+@@ -707,15 +772,13 @@ cat >>e${EMULATION_NAME}.c <<EOF
+ l->name, force))
+ break;
+ EOF
+-if [ "x${USE_LIBPATH}" = xyes ] ; then
++if [ "x${host}" = "x${target}" ] ; then
++ case " ${EMULATION_LIBPATH} " in
++ *" ${EMULATION_NAME} "*)
+ cat >>e${EMULATION_NAME}.c <<EOF
+ if (gld${EMULATION_NAME}_search_needed (command_line.rpath,
+ l->name, force))
+ break;
+-EOF
+-fi
+-if [ "x${NATIVE}" = xyes ] ; then
+-cat >>e${EMULATION_NAME}.c <<EOF
+ if (command_line.rpath_link == NULL
+ && command_line.rpath == NULL)
+ {
+@@ -727,10 +790,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
+ lib_path = (const char *) getenv ("LD_LIBRARY_PATH");
+ if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, force))
+ break;
+-EOF
+-fi
+-if [ "x${USE_LIBPATH}" = xyes ] ; then
+-cat >>e${EMULATION_NAME}.c <<EOF
++
+ found = 0;
+ rp = bfd_elf_get_runpath_list (output_bfd, &link_info);
+ for (; !found && rp != NULL; rp = rp->next)
+@@ -746,6 +806,8 @@ cat >>e${EMULATION_NAME}.c <<EOF
+ break;
+
+ EOF
++ ;;
++ esac
+ fi
+ cat >>e${EMULATION_NAME}.c <<EOF
+ len = strlen (l->name);
+@@ -764,15 +826,25 @@ cat >>e${EMULATION_NAME}.c <<EOF
+ if (search != NULL)
+ break;
+ EOF
+-if [ "x${USE_LIBPATH}" = xyes ] ; then
+- case ${target} in
+- *-*-linux-gnu*)
+- cat >>e${EMULATION_NAME}.c <<EOF
++if [ "x${host}" = "x${target}" ] ; then
++ case " ${EMULATION_LIBPATH} " in
++ *" ${EMULATION_NAME} "*)
++ case ${target} in
++ *-*-freebsd* | *-*-dragonfly*)
++ cat >>e${EMULATION_NAME}.c <<EOF
++ if (gld${EMULATION_NAME}_check_ld_elf_hints (l->name, force))
++ break;
++EOF
++ ;;
++ *-*-linux-gnu*)
++ cat >>e${EMULATION_NAME}.c <<EOF
+ if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
+ break;
+ EOF
+- # Linux
+- ;;
++ # Linux
++ ;;
++ esac
++ ;;
+ esac
+ fi
+ cat >>e${EMULATION_NAME}.c <<EOF
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]