aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-11 11:27:29 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-11 11:27:29 +0000
commit93b8263652ac001247ff923499bdc04ab0a1a4c4 (patch)
tree9c608c11471a562bbb359ec661cb4e3a9cd5489a
parent80f647c21c4457b5f74f5cdd87b789a0fa0d7c0d (diff)
downloadbusybox-w32-93b8263652ac001247ff923499bdc04ab0a1a4c4.tar.gz
busybox-w32-93b8263652ac001247ff923499bdc04ab0a1a4c4.tar.bz2
busybox-w32-93b8263652ac001247ff923499bdc04ab0a1a4c4.zip
fix build with gcc -combine
-rw-r--r--libbb/ptr_to_globals.c15
-rw-r--r--scripts/Makefile.IMA14
-rw-r--r--shell/ash_ptr_hack.c17
3 files changed, 40 insertions, 6 deletions
diff --git a/libbb/ptr_to_globals.c b/libbb/ptr_to_globals.c
index f8ccbf142..48cf8d86c 100644
--- a/libbb/ptr_to_globals.c
+++ b/libbb/ptr_to_globals.c
@@ -5,7 +5,20 @@
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this tarball for details.
6 */ 6 */
7 7
8struct globals;
9
10#ifndef GCC_COMBINE
11
8/* We cheat here. It is declared as const ptr in libbb.h, 12/* We cheat here. It is declared as const ptr in libbb.h,
9 * but here we make it live in R/W memory */ 13 * but here we make it live in R/W memory */
10struct globals;
11struct globals *ptr_to_globals; 14struct globals *ptr_to_globals;
15
16#else
17
18/* gcc -combine will see through and complain */
19/* Using alternative method which is more likely to break
20 * on weird architectures, compilers, linkers and so on */
21struct globals *const ptr_to_globals __attribute__ ((section (".data")));
22
23#endif
24
diff --git a/scripts/Makefile.IMA b/scripts/Makefile.IMA
index 762e25292..d24651787 100644
--- a/scripts/Makefile.IMA
+++ b/scripts/Makefile.IMA
@@ -145,8 +145,10 @@ include libbb/Kbuild
145lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y))) 145lib-all-y += $(patsubst %,libbb/%,$(sort $(lib-y)))
146lib-y:= 146lib-y:=
147 147
148busybox: $(usage_stuff) 148busybox: $(usage_stuff) include/applet_tables.h
149 $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) --combine $(WHOLE_PROGRAM) \ 149 $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) \
150 -DGCC_COMBINE=1 \
151 --combine $(WHOLE_PROGRAM) \
150 -funit-at-a-time -Wno-error -std=gnu99 \ 152 -funit-at-a-time -Wno-error -std=gnu99 \
151 -o $(@)_unstripped $(lib-all-y:.o=.c) \ 153 -o $(@)_unstripped $(lib-all-y:.o=.c) \
152 -Wl,--start-group -lcrypt -lm -Wl,--end-group 154 -Wl,--start-group -lcrypt -lm -Wl,--end-group
@@ -154,7 +156,13 @@ busybox: $(usage_stuff)
154 -$(STRIP) -s -R .note -R .comment -R .version $@ 156 -$(STRIP) -s -R .note -R .comment -R .version $@
155 157
156applets/usage: 158applets/usage:
157 $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/usage applets/usage.c 159 $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/usage applets/usage.c
160
161applets/applet_tables:
162 $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c
163
158include/usage_compressed.h: $(srctree)/include/usage.h applets/usage 164include/usage_compressed.h: $(srctree)/include/usage.h applets/usage
159 $(srctree)/applets/usage_compressed include/usage_compressed.h applets 165 $(srctree)/applets/usage_compressed include/usage_compressed.h applets
160 166
167include/applet_tables.h: $(srctree)/include/applets.h
168 applets/applet_tables include/applet_tables.h
diff --git a/shell/ash_ptr_hack.c b/shell/ash_ptr_hack.c
index 490b73b6d..68d907292 100644
--- a/shell/ash_ptr_hack.c
+++ b/shell/ash_ptr_hack.c
@@ -5,12 +5,25 @@
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this tarball for details.
6 */ 6 */
7 7
8/* We cheat here. They are declared as const ptr in ash.c,
9 * but here we make them live in R/W memory */
10struct globals_misc; 8struct globals_misc;
11struct globals_memstack; 9struct globals_memstack;
12struct globals_var; 10struct globals_var;
13 11
12#ifndef GCC_COMBINE
13
14/* We cheat here. They are declared as const ptr in ash.c,
15 * but here we make them live in R/W memory */
14struct globals_misc *ash_ptr_to_globals_misc; 16struct globals_misc *ash_ptr_to_globals_misc;
15struct globals_memstack *ash_ptr_to_globals_memstack; 17struct globals_memstack *ash_ptr_to_globals_memstack;
16struct globals_var *ash_ptr_to_globals_var; 18struct globals_var *ash_ptr_to_globals_var;
19
20#else
21
22/* gcc -combine will see through and complain */
23/* Using alternative method which is more likely to break
24 * on weird architectures, compilers, linkers and so on */
25struct globals_misc *const ash_ptr_to_globals_misc __attribute__ ((section (".data")));
26struct globals_memstack *const ash_ptr_to_globals_memstack __attribute__ ((section (".data")));
27struct globals_var *const ash_ptr_to_globals_var __attribute__ ((section (".data")));
28
29#endif