diff --git a/mkstub b/mkstub index 32fe430..ce3df01 100755 --- a/mkstub +++ b/mkstub @@ -30,12 +30,13 @@ echo >$dir/init-stub-${out}.c "// STUB to load and init the so file #include #include #include +#include void * ${out}Base = 0; // linked first stub __attribute__((section(\".dlist_so_${out}\"))) -static long __so_${out}_start[1] = {0}; +long __so_${out}_start[1] = {0}; // init all references by name void __so_${out}_open() { @@ -46,12 +47,12 @@ void __so_${out}_open() { } register long * a0 asm(\"a0\") = &__so_${out}_start[1]; register void * a6 asm(\"a6\") = ${out}Base; - register long d0 asm(\"d0\"); - asm volatile(\"jsr (-30,a6)\": \"=r\"(d0): \"r\"(a0), \"r\"(a6)); - if (d0) { + char const * s; + asm volatile(\"jsr (-30,a6); move.l d0,%0\": \"=r\"(s): \"r\"(a0), \"r\"(a6)); + if (s) { BPTR out = Output(); FPuts(out, \"can't resolve \"); - FPuts(out, (char const *)d0); + FPuts(out, s); FPuts(out, \"\\n\"); exit(10); } @@ -118,11 +119,11 @@ void ** __ptr_to_${n} = &__export_${n}; else echo >>$dir/export-$out.c " - +extern void ${n}(); __attribute__((section(\".dlist_so_export_${n}\"))) char const * __name_${n} = \"${n}\"; __attribute__((section(\".dlist_so_export_${n}\"))) -void ** __ptr_to_${n} = &${n}; +void ** __ptr_to_${n} = (void **)&${n}; " fi diff --git a/sources/nix20/stdio/amistdio.c b/sources/nix20/stdio/amistdio.c index 53f7f0a..cf541fa 100644 --- a/sources/nix20/stdio/amistdio.c +++ b/sources/nix20/stdio/amistdio.c @@ -11,11 +11,7 @@ static int bsz = 128; static char __printf_default_buffer[128]; -static char *buffer; - -void __allocBuff() { - buffer = __printf_default_buffer; -} +static char *buffer = __printf_default_buffer; void __freeBuff() { if (buffer && buffer != __printf_default_buffer) { @@ -33,7 +29,6 @@ void setPrintfBufferSize(int sz) { } } -ADD2INIT(__allocBuff, -42); ADD2EXIT(__freeBuff, -42); // the callback per character, checks for end of buffer! diff --git a/sources/startup/init_shared.c b/sources/startup/init_shared.c index 9da5baf..84bdb76 100644 --- a/sources/startup/init_shared.c +++ b/sources/startup/init_shared.c @@ -185,7 +185,9 @@ __LibOpen(struct Library *_masterlib asm("a6")) { struct Library *childLib = (struct Library*) to; childLib->lib_Sum = (ULONG) task; childLib->lib_OpenCnt = 1; - AddHead(&__libList, (struct Node* )&childLib[1]); // the child's libList as node... + struct Node* node = (struct Node* )&childLib[1]; + node->ln_Name = (char *)childLib; + AddHead(&__libList, node); // the child's libList as node... // apply datadata relocs long *p;