Re: Text relocations in shared libs
"Charles M. Hannum" <[email protected]> Sun, 25 Dec 2005 13:54:13 -0500
| Newsgroups | gmane.os.netbsd.ports.sh3,gmane.os.netbsd.devel.toolchain |
|---|---|
| Message-ID | <[email protected]> |
Quoting "Valeriy E. Ushakov" <[email protected]>: > #define _SYSCALL(x,y) \ > .text; \ > 911: mov.l 912f, r3; \ > braf r3; \ > nop; \ > .align 2; \ > 912: .long cerror-(911b+6); \ > ^^^^^^^^^^^^^^^^^^^^^^^ > _SYSCALL_NOERROR(x,y); \ > bf 911b; \ > nop > > A proper PIC call would be to set up r12 and do the call via plt, but > that raises a number of questions. > > plt destroys r0, where syscall code passes errno, so that would either > cause a flag day, ... What prevents you from just moving errno to a different register before executing the PLT? Surely you have another callee-saved register you can destroy. You can probably even put the move instruction in one of the branch delay slots, so it doesn't cost you anything. It would cause a flag day only in the sense that libposix and libpthread would have to be updated in sync with libc, because of the new cerror calling convention, but I think this is minor -- owing both to a limited number of users, and the fact that nothing in the build or install process uses either of those libraries.