[fpc-devel] freebsd 12.1

Marco van de Voort core at pascalprogramming.org
Mon Dec 2 12:15:42 CET 2019

I did some investigations on the FreeBSD problems yesterday, with some 

FreeBSD 12.1 x86_64:

1 starting compiler 3.0.4 might misalign sections. Linker LLD simply silently fails to reads objects with non aligned sections. (32-bit? 64-bit? both?) -> always use BFD with starting compiler.
2 Don Alfredo: compile works with -dFPC_USE_LIBC: true but needs ld.bfd (because of (1)?  tbt)
     -> FPC stat record definition doesn't change in that case. Maybe only syscall nr changed but not record definition? TBD/TBT
3 "old syscalls" I replaced lseek, mmap and ftruncate with newer variants (300 something) that seem to omit the zeroed registers. Result remains the same "can't find ../"
     I used a defined FREEBSDNEWSYSCALL for this (not committed yet, I don't have internet atm, this goes out via mobile)
     -> sounds like canocalization problem (fexpand). I see getcwd output in truss but they all return "0".  Seems getcwd does a lot of calls to the same directory.
     -> disable getcwd usage and do it the old way tbt
4 tried truss but there are very few syscalls in the output. I don't trust the result very much. I see that it calls stat11, so stat syscall number is also old.

issues to be resolved:
- syscall port still doesn't work
- compiler needs parameter to force compiler to use ld.bfd or just ld. (or lld?) So probably setting name of linker in general. I don't like to use platform specific environment variables, as FreeBSD suggests.

0. edit compiler/targets/t_bsd.pas. Go to method TLinkerBSD.setdefaultinfo and set "linkerprogram" to "ld.bfd"
1. install binutils
2. execute EXPORT PATH=/usr/local/bin:$PATH    -> this puts ld.bfd in /usr/local/bin before the one in /usr/bin and can be used to overcome the 3.0.4 bootstrap problems.
3  make with OPT=-dFPC_USE_LIBC

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20191202/9ff8b81e/attachment.html>

More information about the fpc-devel mailing list