diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-08-29 21:46:10 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-08-29 21:46:10 +0000 |
commit | 68886fea59057fc1ae9850968081d8a10750407e (patch) | |
tree | d9fbbaa0b81a5f3610a434caf96a51c58a02d031 | |
parent | e3f4197642b21ce7ef3a6174db3a1ca91fb7da7f (diff) | |
download | busybox-w32-68886fea59057fc1ae9850968081d8a10750407e.tar.gz busybox-w32-68886fea59057fc1ae9850968081d8a10750407e.tar.bz2 busybox-w32-68886fea59057fc1ae9850968081d8a10750407e.zip |
There's some strange bug in glibc that triggers if you combine the
--gc-sections linker flag with static linking. If this happens, then
the "stdout" variable (used by printf() and such) will only work if stdout
is _not_ redirected. I.E "./busybox" prints stuff, but "./busybox | cat"
does not produce any output. (But even when redirected, "write(1,"blah",4);"
continues to work just fine.)
This is clearly a glibc bug, but to avoid triggering it I've moved the
--gc-sections flag so it only gets added when we're not statically linking.
If somebody would like to go poke Ulrich Drepper, you can trivially reproduce
this with a "hello world" program, ala:
gcc -static -Wl,--gc-sections hello.c && (./a.out | cat)
git-svn-id: svn://busybox.net/trunk/busybox@16017 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | Rules.mak | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -267,8 +267,6 @@ ifeq ($(strip $(CONFIG_DEBUG)),y) | |||
267 | CFLAGS +=-g | 267 | CFLAGS +=-g |
268 | else | 268 | else |
269 | CFLAGS +=-DNDEBUG | 269 | CFLAGS +=-DNDEBUG |
270 | CHECKED_LDFLAGS += $(call check_ld,$(LD),--sort-common,) | ||
271 | CHECKED_LDFLAGS += $(call check_ld,$(LD),--gc-sections,) | ||
272 | endif | 270 | endif |
273 | 271 | ||
274 | ifneq ($(strip $(CONFIG_DEBUG_PESSIMIZE)),y) | 272 | ifneq ($(strip $(CONFIG_DEBUG_PESSIMIZE)),y) |
@@ -288,6 +286,11 @@ endif | |||
288 | STRIPCMD:=$(call check_strip,$(STRIP),-s --remove-section=.note --remove-section=.comment,$(STRIP)) | 286 | STRIPCMD:=$(call check_strip,$(STRIP),-s --remove-section=.note --remove-section=.comment,$(STRIP)) |
289 | ifeq ($(strip $(CONFIG_STATIC)),y) | 287 | ifeq ($(strip $(CONFIG_STATIC)),y) |
290 | PROG_CFLAGS += $(call check_cc,$(CC),-static,) | 288 | PROG_CFLAGS += $(call check_cc,$(CC),-static,) |
289 | else | ||
290 | ifneq ($(strip $(CONFIG_DEBUG)),y) | ||
291 | CHECKED_LDFLAGS += $(call check_ld,$(LD),--sort-common,) | ||
292 | CHECKED_LDFLAGS += $(call check_ld,$(LD),--gc-sections,) | ||
293 | endif | ||
291 | endif | 294 | endif |
292 | CFLAGS_SHARED := $(call check_cc,$(CC),-shared,) | 295 | CFLAGS_SHARED := $(call check_cc,$(CC),-shared,) |
293 | LIB_CFLAGS+=$(CFLAGS_SHARED) | 296 | LIB_CFLAGS+=$(CFLAGS_SHARED) |