[fpc-devel] threads crash on FreeBSD 9 RC1, FPC 2.6RC1

Pierre Free Pascal pierre at freepascal.org
Mon Nov 14 14:26:57 CET 2011



> -----Message d'origine-----
> De : fpc-devel-bounces at lists.freepascal.org [mailto:fpc-devel-
> bounces at lists.freepascal.org] De la part de Helmut Hartl
> Envoyé : mercredi 9 novembre 2011 20:58
> À : fpc-devel at lists.freepascal.org
> Objet : Re: [fpc-devel] threads crash on FreeBSD 9 RC1, FPC 2.6RC1
> 
> Am 09.11.11 14:12, schrieb Pierre Free Pascal:
> >> while testing our code on freebsd 9RC1/32 bit with fpc 2.6rc1
> >> it seems that all programs compiled on that system using threads crash
> >> with an "Illegal Instruction 4 (core dumped)" error.
> >> Binaries compiled on Freebsd 8.2/32 and transferred to the 9RC1 box
work,
> >> which is a bit strange.
> >    There is no warranty that an executable for a given version
> > will work on a later...
> >    If only one system call interface is changed, this is enough to break
> > everything!
> >
> What made me wonder was, that the (old) binary compiled on 8.2 still
> worked on 9.0RC1
> after the upgrade from 8.2 -> 9.0 (same machine) while the new one
> compiled with the same
> compiler after the upgrade crashed.
> If I copy back the new binary (same source) to a 8.2 machine it fails
> with a linker failure
> unresolved symbol "sem_init".  But thats only a observation that i am
> too dumb to
> understand atm, and maybe unrelated to the main problem.

I retested your test source.

test-9rc1 was compiled on 9RC1 machine and copied back to 8.2 machine.

On 8.2 machine:
[pierre at freelove64 ~/pas/test]$  ./test-9rc1
/usr/libexec/ld-elf.so.1: /usr/home/pierre/pas/test/test-9rc1: Undefined
symbol
"sem_init"
[pierre at freelove64 ~/pas/test]$ objdump -T ./test-9rc1 | grep sem_
0000000000000000      DF *UND*  0000000000000056  FBSD_1.2    sem_trywait
0000000000000000      DF *UND*  000000000000004a  FBSD_1.2    sem_init
0000000000000000      DF *UND*  0000000000000007  FBSD_1.2    sem_wait
0000000000000000      DF *UND*  000000000000004f  FBSD_1.2    sem_post
0000000000000000      DF *UND*  0000000000000031  FBSD_1.2    sem_destroy
[pierre at freelove64 ~/pas/test]$ objdump -T ./test | grep sem_
0000000000400e38      DF *UND*  0000000000000141  FBSD_1.0    sem_wait
0000000000400ea8      DF *UND*  0000000000000073  FBSD_1.0    sem_post
0000000000400f18      DF *UND*  0000000000000081  FBSD_1.0    sem_trywait
0000000000401008      DF *UND*  0000000000000051  FBSD_1.0    sem_destroy
0000000000401068      DF *UND*  00000000000000f4  FBSD_1.0    sem_init

[pierre at freelove64 ~/pas/trunk/rtl/freebsd]$ objdump -T /lib/libthr.so.3
|grep
sem_init
00000000000079e0 g    DF .text  00000000000000f4  FBSDprivate_1.0 _sem_init
00000000000079e0  w   DF .text  00000000000000f4  FBSD_1.0    sem_init
0000000000000000      DF *UND*  0000000000000000  FBSD_1.0    ksem_init

On the 9RC1 machine:
[pierre at freelovebeta64 ~/pas/test]$ objdump -T /lib/libthr.so.3 |grep
sem_init
0000000000007cc0  w   DF .text  0000000000000005 (FBSD_1.0)   sem_init
0000000000000000      DF *UND*  0000000000000083  FBSDprivate_1.0
_libc_sem_init_compat

  I still don't understand much about shared library versioning, so maybe
someone with more
knowledge could help us here...

I suspect that it is due to the fact that the FBSD_1.2 version is required
by the
9RC1 compiled executable, but why does it find the FBSD_1.0 sem_init symbol
on 9RC1 and not on 8.2?

Pierre Muller




More information about the fpc-devel mailing list