[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-vax/46715: Relocation in .text section in vax does not work
>Synopsis: Relocation in .text section in vax does not work
>Arrival-Date: Tue Jul 17 16:00:00 +0000 2012
>Originator: Paul Koning
NetBSD pk3900 5.1 NetBSD 5.1 (GENERIC) #0: Thu Jul 12 21:33:26 EDT 2012
I ran into this problem trying to build gmp 5.0.5 on netbsd/vax. There are
some assembly language files that are linked into a shared library; those
contain code like this:
(to jump into the middle of an unrolled loop). So that assembles into a
reference to label Loop, which is relocatable.
The compiler is happy; the linker warns: "Warning: R_VAX_32 relocation to
0xnnnn from .text section". At runtime, I get a segfault in ld.elf_so at the
point where it tries to apply that relocation; apparently it didn't flip the
segment to be writable at this point as most other ld.elf_so ports do.
This particular bit of code is not hard to change for a workaround:
but that requires a source level fix and in other cases it might not be so easy.
Here's a simple test program bug.s:
# This shows an ld.elf_so bug
Assemble (gcc -c bug.s) then link (ld --shared -o libbug.so bug.o). The link
step shows the warning I mentioned.
Link another file with this shared library, for example:
extern void foo(void);
int main (int c, char **v)
gcc bugmain.c -lbug -L .
will show the segfault.
Main Index |
Thread Index |