Skip to content

Commit

Permalink
Merge branch 'devel1'
Browse files Browse the repository at this point in the history
  • Loading branch information
fautomat committed Jun 17, 2024
2 parents 3623b1c + b2a7283 commit 0b70ba9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
15 changes: 8 additions & 7 deletions mkstub
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ echo >$dir/init-stub-${out}.c "// STUB to load and init the so file
#include <proto/dos.h>
#include <proto/exec.h>
#include <stabs.h>
#include <stdlib.h>
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() {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions sources/nix20/stdio/amistdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -33,7 +29,6 @@ void setPrintfBufferSize(int sz) {
}
}

ADD2INIT(__allocBuff, -42);
ADD2EXIT(__freeBuff, -42);

// the callback per character, checks for end of buffer!
Expand Down
4 changes: 3 additions & 1 deletion sources/startup/init_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0b70ba9

Please sign in to comment.