svn commit: trunk/busybox: applets networking scripts
vda at busybox.net
vda at busybox.net
Fri Dec 28 09:04:44 PST 2007
Author: vda
Date: 2007-12-28 09:04:42 -0800 (Fri, 28 Dec 2007)
New Revision: 20693
Log:
trylink: instead of build error, disable --gc-sections if GLIBC && STATIC
nameif: glibc build fixlet
Modified:
trunk/busybox/applets/applets.c
trunk/busybox/networking/nameif.c
trunk/busybox/scripts/trylink
Changeset:
Modified: trunk/busybox/applets/applets.c
===================================================================
--- trunk/busybox/applets/applets.c 2007-12-27 12:00:12 UTC (rev 20692)
+++ trunk/busybox/applets/applets.c 2007-12-28 17:04:42 UTC (rev 20693)
@@ -10,17 +10,6 @@
#include <assert.h>
#include "busybox.h"
-/* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
-#if ENABLE_STATIC && defined(__GLIBC__) && !defined(__UCLIBC__)
-#warning Static linking against glibc produces buggy executables
-#warning (glibc does not cope well with ld --gc-sections).
-#warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
-#warning Note that glibc is unsuitable for static linking anyway.
-#warning If you still want to do it, remove -Wl,--gc-sections
-#warning from scripts/trylink and remove this warning.
-#error Aborting compilation.
-#endif
-
#if ENABLE_BUILD_LIBBUSYBOX
int main(int argc, char **argv)
{
Modified: trunk/busybox/networking/nameif.c
===================================================================
--- trunk/busybox/networking/nameif.c 2007-12-27 12:00:12 UTC (rev 20692)
+++ trunk/busybox/networking/nameif.c 2007-12-28 17:04:42 UTC (rev 20693)
@@ -50,7 +50,7 @@
#define ETHTOOL_BUSINFO_LEN 32
/* these strings are set to whatever the driver author decides... */
struct ethtool_drvinfo {
- __u32 cmd;
+ uint32_t cmd;
char driver[32]; /* driver short name, "tulip", "eepro100" */
char version[32]; /* driver version string */
char fw_version[32]; /* firmware version string, if applicable */
@@ -58,10 +58,10 @@
/* For PCI devices, use pci_dev->slot_name. */
char reserved1[32];
char reserved2[16];
- __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
- __u32 testinfo_len;
- __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
- __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */
+ uint32_t n_stats; /* number of u64's from ETHTOOL_GSTATS */
+ uint32_t testinfo_len;
+ uint32_t eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
+ uint32_t regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */
};
#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
#endif
Modified: trunk/busybox/scripts/trylink
===================================================================
--- trunk/busybox/scripts/trylink 2007-12-27 12:00:12 UTC (rev 20692)
+++ trunk/busybox/scripts/trylink 2007-12-28 17:04:42 UTC (rev 20693)
@@ -47,13 +47,30 @@
}
check_cc() {
- if $CC $1 -shared -o /dev/null -xc /dev/null > /dev/null 2>&1; then
- echo "$1";
+ if $CC $1 -shared -o /dev/null -xc /dev/null >/dev/null 2>&1; then
+ echo "$1";
else
- echo "$2";
+ echo "$2";
fi
}
+check_libc_is_glibc() {
+ local tempname="/tmp/temp.$$.$RANDOM.c"
+ echo "\
+ #include <stdlib.h>
+ /* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
+ #if defined(__GLIBC__) && !defined(__UCLIBC__)
+ syntax error here
+ #endif
+ " >"$tempname"
+ if $CC "$tempname" -c -o /dev/null >/dev/null 2>&1; then
+ echo "$2";
+ else
+ echo "$1";
+ fi
+ rm "$tempname"
+}
+
EXE="$1"
CC="$2"
LDFLAGS="$3"
@@ -64,6 +81,20 @@
# The -Wl,--sort-section option is not supported by older versions of ld
SORT_SECTION=`check_cc "-Wl,--sort-section -Wl,alignment" ""`
+# Static linking against glibc produces buggy executables
+# (glibc does not cope well with ld --gc-sections).
+# See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
+# Note that glibc is unsuitable for static linking anyway.
+# We are removing -Wl,--gc-sections from link command line.
+GC_SECTION=`(
+. ./.config
+if test x"$CONFIG_STATIC" = x"y"; then
+ check_libc_is_glibc "" "-Wl,--gc-sections"
+else
+ echo "-Wl,--gc-sections"
+fi
+)`
+
# Sanitize lib list (dups, extra spaces etc)
LDLIBS=`echo "$LDLIBS" | xargs -n1 | sort | uniq | xargs`
@@ -76,7 +107,7 @@
-o $EXE \
-Wl,--sort-common \
$SORT_SECTION \
- -Wl,--gc-sections \
+ $GC_SECTION \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
$l_list \
|| {
@@ -100,7 +131,7 @@
-o $EXE \
-Wl,--sort-common \
$SORT_SECTION \
- -Wl,--gc-sections \
+ $GC_SECTION \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
$l_list
if test $? = 0; then
@@ -129,7 +160,7 @@
-o $EXE \
-Wl,--sort-common \
$SORT_SECTION \
- -Wl,--gc-sections \
+ $GC_SECTION \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
$l_list \
-Wl,--warn-common \
@@ -151,7 +182,7 @@
-o $EXE \
-Wl,--sort-common \
$SORT_SECTION \
- -Wl,--gc-sections \
+ $GC_SECTION \
-Wl,-T -Wl,busybox_ldscript \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
$l_list \
@@ -207,7 +238,7 @@
-o $EXE \
-Wl,--sort-common \
$SORT_SECTION \
- -Wl,--gc-sections \
+ $GC_SECTION \
-Wl,--start-group $O_FILES -Wl,--end-group \
-L"$sharedlib_dir" -lbusybox \
-Wl,--warn-common \
@@ -246,7 +277,7 @@
-o $EXE \
-Wl,--sort-common \
$SORT_SECTION \
- -Wl,--gc-sections \
+ $GC_SECTION \
-L"$sharedlib_dir" -lbusybox \
-Wl,--warn-common \
|| {
More information about the busybox-cvs
mailing list