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:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user