3a99ce47ce196890fd5dfd5dcfe18ceb0a89cfce
[org.ibex.core.git] / upstream / gcc-3.3 / patches / gcc-fdata-sections-bss.patch
1 I *think* this bug has been fixed in the 3.4 tree. Unfortunately this 
2 code changed significantly between 3.3 and 3.4 so it wasn't possible to
3 backport the fix.
4
5 If the GCC tree is ever updated to 3.4 this patch won't apply. It can
6 probably be safely removed. 
7
8 -Brians
9
10
11 --- gcc/config/mips/mips.c.orig Mon Dec 29 06:30:42 2003
12 +++ gcc/config/mips/mips.c      Mon Dec 29 07:16:35 2003
13 @@ -10535,11 +10535,13 @@
14    int len, size, sec;
15    const char *name, *prefix;
16    char *string;
17 -  static const char *const prefixes[4][2] = {
18 +  static const char *const prefixes[6][2] = {
19      { ".text.", ".gnu.linkonce.t." },
20      { ".rodata.", ".gnu.linkonce.r." },
21      { ".data.", ".gnu.linkonce.d." },
22 -    { ".sdata.", ".gnu.linkonce.s." }
23 +    { ".sdata.", ".gnu.linkonce.sb." },
24 +    { ".bss.", ".gnu.linkonce.b." },
25 +    { ".sbss.", ".gnu.linkonce.sb." }
26    };
27  
28    name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
29 @@ -10551,8 +10553,9 @@
30    if (TREE_CODE (decl) == FUNCTION_DECL)
31      sec = 0;
32    else if (DECL_INITIAL (decl) == 0
33 -           || DECL_INITIAL (decl) == error_mark_node)
34 -    sec = 2;
35 +           || DECL_INITIAL (decl) == error_mark_node
36 +           || initializer_zerop (DECL_INITIAL (decl)))
37 +    sec = (size > 0 && size <= mips_section_threshold) ? 5 : 4;
38    else if ((TARGET_EMBEDDED_PIC || TARGET_MIPS16)
39        && TREE_CODE (decl) == STRING_CST
40        && !flag_writable_strings)