Minimal executable, cleaned up from vendor code

- Removed extraneous and/or oversized(?) align from linker script
- Handle init_array properly
- Remove legacy init code paths (.ctors, .init)
- Don't do nonstandard interrupt mode handling by default
This commit is contained in:
R
2024-04-12 17:50:23 +01:00
parent 2f3d484844
commit 40082ed533
6 changed files with 232 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
int test = 0x12345;
int test2;
#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
__attribute__((constructor(0))) static void setup_qingke() {
asm volatile(
// Undocumented "Configure pipelining and instruction prediction"
"li t0, 0x1f\n"
"csrw 0xbc0, t0\n"
);
}
__attribute__((constructor)) static void constructor() {
test2 = 0x5678;
}
__attribute__((destructor)) static void destructor() {
test2 = 0x9abc;
}
int main(void) {
test++;
test2--;
return 123;
}