We should link against -lc before any of the binutils libs (libiberty/bfd)
as those libs provide replacements for some common functions we don't really
care about (like getopt). Otherwise, if the C library does something wacky
in its API (like renaming symbols), we get a desync where some symbols are
provided by the binutils libs while others are provided by the C library.
For a concrete example, try building elf2flt on OS X 10.5. Their stupid
headers do this in unistd.h:
int getopt(int, char * const [], const char *) __asm("_" "getopt" "$UNIX2003");
The resulting elf2flt binaries are incapable of properly parsing any option
given to them.
Signed-off-by: Mike Frysinger <[EMAIL PROTECTED]>
---
configure.in | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/configure.in b/configure.in
index 42be556..5ab8983 100644
--- a/configure.in
+++ b/configure.in
@@ -135,6 +135,13 @@ Run configure again specifying these options:
])
fi
+dnl Make sure we resolve system symbols before libiberty/libbfd ones.
+dnl Otherwise, things like getopt get screwed up because the system headers
+dnl redirect some functions to the system symbols, but other local symbols
+dnl come from libiberty/libbfd.
+dnl int getopt(int, char * const [], const char *) __asm("_" "getopt"
"$UNIX2003");
+AC_CHECK_LIB(c, malloc, LIBS="-lc $LIBS")
+
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h bfd.h)
--
1.6.0.3
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev