diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-14 12:24:14 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-14 12:24:14 +0000 |
commit | f1d93ec4206b50f7971f7df391dfc9bd52da8344 (patch) | |
tree | 7b695107ed753f44e922fac3c2450b61f1aa197e | |
parent | b2e578a1f2c3cf317b391a7d2c059d6a5f5368b8 (diff) | |
download | busybox-w32-f1d93ec4206b50f7971f7df391dfc9bd52da8344.tar.gz busybox-w32-f1d93ec4206b50f7971f7df391dfc9bd52da8344.tar.bz2 busybox-w32-f1d93ec4206b50f7971f7df391dfc9bd52da8344.zip |
build system: pass CFLAGS to link stage too (closes bug 1376)
-rw-r--r-- | Makefile | 1 | ||||
-rwxr-xr-x | scripts/trylink | 23 |
2 files changed, 13 insertions, 11 deletions
@@ -571,6 +571,7 @@ quiet_cmd_busybox__ ?= LINK $@ | |||
571 | cmd_busybox__ ?= $(srctree)/scripts/trylink \ | 571 | cmd_busybox__ ?= $(srctree)/scripts/trylink \ |
572 | "$@" \ | 572 | "$@" \ |
573 | "$(CC)" \ | 573 | "$(CC)" \ |
574 | "$(CFLAGS)" \ | ||
574 | "$(LDFLAGS) $(EXTRA_LDFLAGS)" \ | 575 | "$(LDFLAGS) $(EXTRA_LDFLAGS)" \ |
575 | "$(core-y)" \ | 576 | "$(core-y)" \ |
576 | "$(libs-y)" \ | 577 | "$(libs-y)" \ |
diff --git a/scripts/trylink b/scripts/trylink index 5ef0132eb..ebfe6cee3 100755 --- a/scripts/trylink +++ b/scripts/trylink | |||
@@ -77,10 +77,11 @@ check_libc_is_glibc() { | |||
77 | 77 | ||
78 | EXE="$1" | 78 | EXE="$1" |
79 | CC="$2" | 79 | CC="$2" |
80 | LDFLAGS="$3" | 80 | CFLAGS="$3" |
81 | O_FILES="$4" | 81 | LDFLAGS="$4" |
82 | A_FILES="$5" | 82 | O_FILES="$5" |
83 | LDLIBS="$6" | 83 | A_FILES="$6" |
84 | LDLIBS="$7" | ||
84 | 85 | ||
85 | # The -Wl,--sort-section option is not supported by older versions of ld | 86 | # The -Wl,--sort-section option is not supported by older versions of ld |
86 | SORT_SECTION=`check_cc "-Wl,--sort-section -Wl,alignment" ""` | 87 | SORT_SECTION=`check_cc "-Wl,--sort-section -Wl,alignment" ""` |
@@ -107,7 +108,7 @@ echo "Trying libraries: $LDLIBS" | |||
107 | # "lib1 lib2 lib3" -> "-llib1 -llib2 -llib3" | 108 | # "lib1 lib2 lib3" -> "-llib1 -llib2 -llib3" |
108 | l_list=`echo "$LDLIBS" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'` | 109 | l_list=`echo "$LDLIBS" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'` |
109 | test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group" | 110 | test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group" |
110 | try $CC $LDFLAGS \ | 111 | try $CC $CFLAGS $LDFLAGS \ |
111 | -o $EXE \ | 112 | -o $EXE \ |
112 | -Wl,--sort-common \ | 113 | -Wl,--sort-common \ |
113 | $SORT_SECTION \ | 114 | $SORT_SECTION \ |
@@ -131,7 +132,7 @@ while test "$LDLIBS"; do | |||
131 | l_list=`echo "$without_one" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'` | 132 | l_list=`echo "$without_one" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'` |
132 | test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group" | 133 | test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group" |
133 | $debug && echo "Trying -l options: '$l_list'" | 134 | $debug && echo "Trying -l options: '$l_list'" |
134 | try $CC $LDFLAGS \ | 135 | try $CC $CFLAGS $LDFLAGS \ |
135 | -o $EXE \ | 136 | -o $EXE \ |
136 | -Wl,--sort-common \ | 137 | -Wl,--sort-common \ |
137 | $SORT_SECTION \ | 138 | $SORT_SECTION \ |
@@ -160,7 +161,7 @@ l_list=`echo "$LDLIBS" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'` | |||
160 | test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group" | 161 | test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group" |
161 | # --verbose gives us gobs of info to stdout (e.g. linker script used) | 162 | # --verbose gives us gobs of info to stdout (e.g. linker script used) |
162 | if ! test -f busybox_ldscript; then | 163 | if ! test -f busybox_ldscript; then |
163 | try $CC $LDFLAGS \ | 164 | try $CC $CFLAGS $LDFLAGS \ |
164 | -o $EXE \ | 165 | -o $EXE \ |
165 | -Wl,--sort-common \ | 166 | -Wl,--sort-common \ |
166 | $SORT_SECTION \ | 167 | $SORT_SECTION \ |
@@ -182,7 +183,7 @@ else | |||
182 | # *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*) | 183 | # *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*) |
183 | # This will eliminate most of the padding (~3kb). | 184 | # This will eliminate most of the padding (~3kb). |
184 | # Hmm, "ld --sort-section alignment" should do it too. | 185 | # Hmm, "ld --sort-section alignment" should do it too. |
185 | try $CC $LDFLAGS \ | 186 | try $CC $CFLAGS $LDFLAGS \ |
186 | -o $EXE \ | 187 | -o $EXE \ |
187 | -Wl,--sort-common \ | 188 | -Wl,--sort-common \ |
188 | $SORT_SECTION \ | 189 | $SORT_SECTION \ |
@@ -212,7 +213,7 @@ if test "$CONFIG_BUILD_LIBBUSYBOX" = y; then | |||
212 | ln -s "libbusybox.so.$BB_VER" "$sharedlib_dir"/libbusybox.so 2>/dev/null | 213 | ln -s "libbusybox.so.$BB_VER" "$sharedlib_dir"/libbusybox.so 2>/dev/null |
213 | 214 | ||
214 | EXE="$sharedlib_dir/libbusybox.so.${BB_VER}_unstripped" | 215 | EXE="$sharedlib_dir/libbusybox.so.${BB_VER}_unstripped" |
215 | try $CC $LDFLAGS \ | 216 | try $CC $CFLAGS $LDFLAGS \ |
216 | -o $EXE \ | 217 | -o $EXE \ |
217 | -shared -fPIC \ | 218 | -shared -fPIC \ |
218 | -Wl,--enable-new-dtags \ | 219 | -Wl,--enable-new-dtags \ |
@@ -238,7 +239,7 @@ fi | |||
238 | 239 | ||
239 | if test "$CONFIG_FEATURE_SHARED_BUSYBOX" = y; then | 240 | if test "$CONFIG_FEATURE_SHARED_BUSYBOX" = y; then |
240 | EXE="$sharedlib_dir/busybox_unstripped" | 241 | EXE="$sharedlib_dir/busybox_unstripped" |
241 | try $CC $LDFLAGS \ | 242 | try $CC $CFLAGS $LDFLAGS \ |
242 | -o $EXE \ | 243 | -o $EXE \ |
243 | -Wl,--sort-common \ | 244 | -Wl,--sort-common \ |
244 | $SORT_SECTION \ | 245 | $SORT_SECTION \ |
@@ -277,7 +278,7 @@ int main(int argc, char **argv) | |||
277 | " >"$sharedlib_dir/applet.c" | 278 | " >"$sharedlib_dir/applet.c" |
278 | 279 | ||
279 | EXE="$sharedlib_dir/$name" | 280 | EXE="$sharedlib_dir/$name" |
280 | try $CC $LDFLAGS "$sharedlib_dir/applet.c" \ | 281 | try $CC $CFLAGS $LDFLAGS "$sharedlib_dir/applet.c" \ |
281 | -o $EXE \ | 282 | -o $EXE \ |
282 | -Wl,--sort-common \ | 283 | -Wl,--sort-common \ |
283 | $SORT_SECTION \ | 284 | $SORT_SECTION \ |