prevent_bss_reordering.h (2585B)
1 #ifndef PREVENT_BSS_REORDERING_H 2 #define PREVENT_BSS_REORDERING_H 3 4 /** 5 * To determine variable order for .bss, the compiler sorts variables by their 6 * "name index" mod 256, where name index is something that, with -g, gets 7 * incremented by struct and variable declarations, typedefs, and file markers, 8 * among else. (Without -g, only variable declarations affects the index.) 9 * This file contains enough dummy declarations to bump the index by 128. 10 * Including it, or removing the include, should fix bss reordering problems 11 * for a file, assuming the name index distance between its first and last bss 12 * variable is at most 128. 13 * Note that if a variable is declared "extern" within a header file, the name 14 * index is taken at that point of the extern declaration. Thus, this include 15 * must come before any such header. 16 */ 17 18 struct Dummy0 { int x; }; 19 struct Dummy1 { int x; }; 20 struct Dummy2 { int x; }; 21 struct Dummy3 { int x; }; 22 struct Dummy4 { int x; }; 23 struct Dummy5 { int x; }; 24 struct Dummy6 { int x; }; 25 struct Dummy7 { int x; }; 26 struct Dummy8 { int x; }; 27 struct Dummy9 { int x; }; 28 struct Dummy10 { int x; }; 29 struct Dummy11 { int x; }; 30 struct Dummy12 { int x; }; 31 struct Dummy13 { int x; }; 32 struct Dummy14 { int x; }; 33 struct Dummy15 { int x; }; 34 struct Dummy16 { int x; }; 35 struct Dummy17 { int x; }; 36 struct Dummy18 { int x; }; 37 struct Dummy19 { int x; }; 38 struct Dummy20 { int x; }; 39 struct Dummy21 { int x; }; 40 struct Dummy22 { int x; }; 41 struct Dummy23 { int x; }; 42 struct Dummy24 { int x; }; 43 struct Dummy25 { int x; }; 44 struct Dummy26 { int x; }; 45 struct Dummy27 { int x; }; 46 struct Dummy28 { int x; }; 47 struct Dummy29 { int x; }; 48 struct Dummy30 { int x; }; 49 struct Dummy31 { int x; }; 50 struct Dummy32 { int x; }; 51 struct Dummy33 { int x; }; 52 struct Dummy34 { int x; }; 53 struct Dummy35 { int x; }; 54 struct Dummy36 { int x; }; 55 struct Dummy37 { int x; }; 56 struct Dummy38 { int x; }; 57 struct Dummy39 { int x; }; 58 struct Dummy40 { int x; }; 59 struct Dummy41 { int x; }; 60 struct Dummy42 { int x; }; 61 struct Dummy43 { int x; }; 62 struct Dummy44 { int x; }; 63 struct Dummy45 { int x; }; 64 struct Dummy46 { int x; }; 65 struct Dummy47 { int x; }; 66 struct Dummy48 { int x; }; 67 struct Dummy49 { int x; }; 68 struct Dummy50 { int x; }; 69 struct Dummy51 { int x; }; 70 struct Dummy52 { int x; }; 71 struct Dummy53 { int x; }; 72 struct Dummy54 { int x; }; 73 struct Dummy55 { int x; }; 74 struct Dummy56 { int x; }; 75 struct Dummy57 { int x; }; 76 struct Dummy58 { int x; }; 77 struct Dummy59 { int x; }; 78 struct Dummy60 { int x; }; 79 struct Dummy61 { int x; }; 80 struct Dummy62 { int x; }; 81 typedef int Dummy63; 82 83 #endif // PREVENT_BSS_REORDERING_H