[fpc-pascal] FPC and Mac OS X 10.5
jonas.maebe at elis.ugent.be
Fri Oct 26 16:58:29 CEST 2007
Now that Mac OS X 10.5 has been (more or less) released, some notes
on issues you may encounter when using FPC 2.2.0 (or earlier) on that
new Mac OS X release. All issues are related to the fact the Apple
now uses a different linker (the old 32 bit linker has been scrapped,
and the old 64 bit linker has been extended to support all targets --
well, it already could link code for all targets in 10.4, but only 64
bit targets were supported by Apple).
Note that the information below is based on information gathered from
testing on pre-release versions of Mac OS X 10.5, so the final
version may still be different.
* The new linker refuses to link dynamic libraries containing non-PIC
- Effect: you can't compile dynamic libraries anymore with FPC 2.2.0
- Occurs: whenever you compile a dynamic library. I don't know
whether FPC-compiled dynamic libraries compiled on 10.4 still work on
- Fix: already in FPC 2.3.1 and FPC 2.2.1 (FPC now always generates
PIC by default on Darwin)
* There is a bug in the new i386 linker regarding dealing with
certain kinds of relocations, which is triggered by the instructions
which FPC generates for jump tables.
- Effect: crash of the compiled code
- Occurs: when compiling i386 code with large case statements on Mac
OS X 10.5, mostly when using -O1 and higher. i386 programs compiled
on Mac OS X 10.4.x containing such jump tables however work fine when
run on Mac OS X 10.5 (as the 10.4.x linker does handle those
- Fix: This will have to be fixed by Apple. I have however added a
workaround in FPC 2.3.1 and FPC 2.2.1 which mostly avoids generating
the crashing relocation (and the resulting code is faster to boot).
The only case in which it can still happen is an enumeration or
subrange type of which the lowest element has an ordinal value > 0,
and you have a case statement which is translated to a jump table in
which this lowest element is used. E.g.
tmysub = 5..50;
case x of
* There is a bug in the new linker when dealing with certain kinds of
(invalid?) Dwarf debug info
- Effect: crash of the linker, e.g. when linking a compiler which is
compiled with Dwarf debug info
- Occurs: I have not yet been able to isolate which specific kind of
Dwarf debug info causes the crash
- Fix: It seems the Dwarf info generated by the latest FPC 2.3.1 no
longer crashes the linker. I'm not sure if all Dwarf fixes have
already been merged back to 2.2.1 though.
* The new linker deals differently with stabs debug information
compared to previous versions, causing a lot of "Unknown stabs"
warnings and also some errors during linking
- Effect: you can't compile code with stabs debug information
- Occurs: with any program compiled with stabs debug information
(programs compiled on 10.4 with stabs may still be debuggable on 10.5
- Fix: already in FPC 2.3.1 (not yet merged to FPC 2.2.1)
I will merge the fixes for the last two issues to FPC 2.2.1 some time
during the coming days and put up snapshot installers with that
version for PPC and i386 on the ftp site.
More information about the fpc-pascal