From: <ke...@us...> - 2003-11-09 19:43:14
|
Update of /cvsroot/linux-vax/glibc/sysdeps/vax In directory sc8-pr-cvs1:/tmp/cvs-serv12544 Modified Files: __longjmp.c Log Message: Remove calls to _libc_fatal, since these lead to undesired object modules being pulled into the ld.so link. Also fixup inline assembler code. Using asm() on a declaration doesn't work and need to use movab to get address of loop: label. Index: __longjmp.c =================================================================== RCS file: /cvsroot/linux-vax/glibc/sysdeps/vax/__longjmp.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- __longjmp.c 15 Aug 2003 13:07:30 -0000 1.3 +++ __longjmp.c 9 Nov 2003 19:43:10 -0000 1.4 @@ -32,12 +32,22 @@ void __longjmp (__jmp_buf env, int val) { - register long int *fp asm("%%fp"); + register long int *fp; long int *regsave; unsigned long int flags; - if (env[0].__fp == NULL) - __libc_fatal("longjmp: Invalid ENV argument.\n"); + asm("movl %%fp, %0" : "=g"(fp) ); + + if (env[0].__fp == NULL) { + /* __libc_fatal calls abort, which eventually leads to I/O stuff being + pulled in during the link of elf/librtld.so, which then dies with + multiply-defined symbols. Instead let's just do a user-mode HALT which + will kill the process */ + + /* __libc_fatal("longjmp: Invalid ENV argument.\n"); */ + asm volatile ("halt"); + for (;;); + } if (val == 0) val = 1; @@ -53,7 +63,7 @@ if (flags & 2) /* R1 was saved by the caller. Store ENV where it will be restored from. */ - *regsave = env; + *regsave = (unsigned int) env; /* Was the FP saved in the last call the same one in ENV? */ asm volatile("cmpl %0, 12(%%fp);" @@ -66,12 +76,15 @@ /* We are more than one level below the state in ENV. Return to where we will pop another stack frame. */ - asm volatile("movl $loop, 16(%fp);\n" + asm volatile("movab loop, 16(%fp)\n" "ret"); asm volatile("done:"); { - char return_insn asm("*16(%%fp)"); + char return_insn; + + asm("movb *16(%%fp), %0" : "=g"(return_insn) ); + if (return_insn == REI) /* We're returning with an `rei' instruction. Do a return with PSL-PC pop. */ @@ -95,5 +108,10 @@ /* Jump here when the FP saved in ENV points to a function that has already returned. */ asm volatile("latejump:"); - __libc_fatal("longjmp: Attempt to jump to a function that has returned.\n"); + + /* see comment above about __libc_fatal */ + + /* __libc_fatal("longjmp: Attempt to jump to a function that has returned.\n"); */ + asm volatile("halt"); + for (;;); } |