finally fix libintl issues on osx and potentially other platforms by disabling its...
[openwrt.git] / package / busybox / patches / 480-disable_braindead_optimization.patch
1 Index: busybox-1.8.1/editors/awk.c
2 ===================================================================
3 --- busybox-1.8.1.orig/editors/awk.c    2007-11-10 23:53:16.950053243 +0100
4 +++ busybox-1.8.1/editors/awk.c 2007-11-10 23:53:23.422422084 +0100
5 @@ -446,7 +446,7 @@
6         tsplitter fsplitter, rsplitter;
7  };
8  #define G1 (ptr_to_globals[-1])
9 -#define G (*(struct globals2 *const)ptr_to_globals)
10 +#define G (*(struct globals2 *)ptr_to_globals)
11  /* For debug. nm --size-sort awk.o | grep -vi ' [tr] ' */
12  /* char G1size[sizeof(G1)]; - 0x6c */
13  /* char Gsize[sizeof(G)]; - 0x1cc */
14 Index: busybox-1.8.1/include/libbb.h
15 ===================================================================
16 --- busybox-1.8.1.orig/include/libbb.h  2007-11-10 23:53:38.135260518 +0100
17 +++ busybox-1.8.1/include/libbb.h       2007-11-10 23:54:15.773405393 +0100
18 @@ -1111,8 +1111,10 @@
19  struct globals;
20  /* '*const' ptr makes gcc optimize code much better.
21   * Magic prevents ptr_to_globals from going into rodata.
22 - * If you want to assign a value, use PTR_TO_GLOBALS = xxx */
23 -extern struct globals *const ptr_to_globals;
24 + * If you want to assign a value, use PTR_TO_GLOBALS = xxx 
25 + * unfortunately the above hack doesn't work properly :P
26 + */
27 +extern struct globals *ptr_to_globals;
28  #define PTR_TO_GLOBALS (*(struct globals**)&ptr_to_globals)
29  
30  
31 Index: busybox-1.8.1/libbb/messages.c
32 ===================================================================
33 --- busybox-1.8.1.orig/libbb/messages.c 2007-11-10 23:52:47.116353117 +0100
34 +++ busybox-1.8.1/libbb/messages.c      2007-11-10 23:52:57.752959269 +0100
35 @@ -74,4 +74,4 @@
36  
37  struct globals;
38  /* Make it reside in R/W memory: */
39 -struct globals *const ptr_to_globals __attribute__ ((section (".data")));
40 +struct globals *ptr_to_globals __attribute__ ((section (".data")));