diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2023-08-06 13:49:16 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-06 13:49:16 -0400 |
| commit | 065751554f2cdf7b5a64b0573e269cbbd1cb6ed3 (patch) | |
| tree | 9d6d2f912a28d083d82f3f5091b3109a5296cb63 /include | |
| parent | 5d8e1f69bffa92983aab5fab7f96bddd34908bbd (diff) | |
Bring over bss headers and bss script from MM (#38)
* prevent_bss_reordering header
* global_bss_check.py
Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
* rewrite bss script to use mapfile_parser
* Change collections for dataclasses
* update requirements.txt
* simplify some stuff
---------
Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/prevent_bss_reordering.h | 83 | ||||
| -rw-r--r-- | include/prevent_bss_reordering2.h | 44 |
2 files changed, 127 insertions, 0 deletions
diff --git a/include/prevent_bss_reordering.h b/include/prevent_bss_reordering.h new file mode 100644 index 0000000..604e45b --- /dev/null +++ b/include/prevent_bss_reordering.h @@ -0,0 +1,83 @@ +#ifndef PREVENT_BSS_REORDERING_H +#define PREVENT_BSS_REORDERING_H + +/** + * To determine variable order for .bss, the compiler sorts variables by their + * "name index" mod 256, where name index is something that, with -g, gets + * incremented by struct and variable declarations, typedefs, and file markers, + * among else. (Without -g, only variable declarations affects the index.) + * This file contains enough dummy declarations to bump the index by 128. + * Including it, or removing the include, should fix bss reordering problems + * for a file, assuming the name index distance between its first and last bss + * variable is at most 128. + * Note that if a variable is declared "extern" within a header file, the name + * index is taken at that point of the extern declaration. Thus, this include + * must come before any such header. + */ + +struct Dummy0 { int x; }; +struct Dummy1 { int x; }; +struct Dummy2 { int x; }; +struct Dummy3 { int x; }; +struct Dummy4 { int x; }; +struct Dummy5 { int x; }; +struct Dummy6 { int x; }; +struct Dummy7 { int x; }; +struct Dummy8 { int x; }; +struct Dummy9 { int x; }; +struct Dummy10 { int x; }; +struct Dummy11 { int x; }; +struct Dummy12 { int x; }; +struct Dummy13 { int x; }; +struct Dummy14 { int x; }; +struct Dummy15 { int x; }; +struct Dummy16 { int x; }; +struct Dummy17 { int x; }; +struct Dummy18 { int x; }; +struct Dummy19 { int x; }; +struct Dummy20 { int x; }; +struct Dummy21 { int x; }; +struct Dummy22 { int x; }; +struct Dummy23 { int x; }; +struct Dummy24 { int x; }; +struct Dummy25 { int x; }; +struct Dummy26 { int x; }; +struct Dummy27 { int x; }; +struct Dummy28 { int x; }; +struct Dummy29 { int x; }; +struct Dummy30 { int x; }; +struct Dummy31 { int x; }; +struct Dummy32 { int x; }; +struct Dummy33 { int x; }; +struct Dummy34 { int x; }; +struct Dummy35 { int x; }; +struct Dummy36 { int x; }; +struct Dummy37 { int x; }; +struct Dummy38 { int x; }; +struct Dummy39 { int x; }; +struct Dummy40 { int x; }; +struct Dummy41 { int x; }; +struct Dummy42 { int x; }; +struct Dummy43 { int x; }; +struct Dummy44 { int x; }; +struct Dummy45 { int x; }; +struct Dummy46 { int x; }; +struct Dummy47 { int x; }; +struct Dummy48 { int x; }; +struct Dummy49 { int x; }; +struct Dummy50 { int x; }; +struct Dummy51 { int x; }; +struct Dummy52 { int x; }; +struct Dummy53 { int x; }; +struct Dummy54 { int x; }; +struct Dummy55 { int x; }; +struct Dummy56 { int x; }; +struct Dummy57 { int x; }; +struct Dummy58 { int x; }; +struct Dummy59 { int x; }; +struct Dummy60 { int x; }; +struct Dummy61 { int x; }; +struct Dummy62 { int x; }; +typedef int Dummy63; + +#endif diff --git a/include/prevent_bss_reordering2.h b/include/prevent_bss_reordering2.h new file mode 100644 index 0000000..c0a4820 --- /dev/null +++ b/include/prevent_bss_reordering2.h @@ -0,0 +1,44 @@ +#ifndef PREVENT_BSS_REORDERING2_H +#define PREVENT_BSS_REORDERING2_H + +/** + * See the explanation at prevent_bss_reordering.h + * + * Instead of producing 64 dummy declarations, this header only produces 32 + * dummy declarations + */ + +struct Dummy100 { int x; }; +struct Dummy101 { int x; }; +struct Dummy102 { int x; }; +struct Dummy103 { int x; }; +struct Dummy104 { int x; }; +struct Dummy105 { int x; }; +struct Dummy106 { int x; }; +struct Dummy107 { int x; }; +struct Dummy108 { int x; }; +struct Dummy109 { int x; }; +struct Dummy110 { int x; }; +struct Dummy111 { int x; }; +struct Dummy112 { int x; }; +struct Dummy113 { int x; }; +struct Dummy114 { int x; }; +struct Dummy115 { int x; }; +struct Dummy116 { int x; }; +struct Dummy117 { int x; }; +struct Dummy118 { int x; }; +struct Dummy119 { int x; }; +struct Dummy120 { int x; }; +struct Dummy121 { int x; }; +struct Dummy122 { int x; }; +struct Dummy123 { int x; }; +struct Dummy124 { int x; }; +struct Dummy125 { int x; }; +struct Dummy126 { int x; }; +struct Dummy127 { int x; }; +struct Dummy128 { int x; }; +struct Dummy129 { int x; }; +struct Dummy130 { int x; }; +struct Dummy131 { int x; }; + +#endif |
