A simplified Code Example for Bug 940
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
Now I understand how smart linking works (or should work) in FreePascal.
Finally I could simplify a program that shows bug 940 to only two very
small modules.
To reproduce the bug, the following conditions should be met:
The official FP release 0.99.14 (no snapshots!) for Linux
should be installed with install.sh, and ppc386.cfg should
contain the default options only, as generated by install.sh.
Put the main program in a file bug940.pas, and the unit bug940a
in a file bug940a.pas. Then compile it with
ppc386 -CX -XX -a bug940.pas
This should result in a number of linking errors!
The (external) symbols _BUG940A
_L8 and _BUG940A
_L11 are
reported to be undefined.
The reason is a bug in the code generator, which "forgets"
the .globl instructions for certain string and real (and
maybe other) constants.
If you compile the same program with "ppc386 bug940.pas" only,
it compiles and links without errors.
With FP 0.99.14a under MS-DOS, the program compiles correctly
for GO32V2 with and without the "-CX -XX" options!
It seems that the code, which is responsible for writing the
.globl instructions, already exists in principle, but isn't
compiled for the Linux platform.
I didn't try the Win32 and OS/2 compilers yet.
By the way:
In contrast to the DOS version, the RTL of the FP 0.99.14 Linux
distribution isn't compiled for smart linking yet. But it should
be in future releases, if this finally works! :-)
Additional information:
Reporter: W.W. Heinz
EMail: ww at gpp dot gppm dot de
Mantis conversion info:
- Mantis ID: 2975
- OS: Linux
- Version: ?
- Fixed in version: 0.99.15