Bus Error when linking to dylib with Snow Leopard
Original Reporter info from Mantis: macite
-
Reporter name: macite
Original Reporter info from Mantis: macite
- Reporter name: macite
Description:
Compiling and running FPC generated dylibs on Snow Leopard using -k"-no_dead_strip_inits_and_terms" corrects the Segmentation Fault but has other issues.
Console IO stops working. Compiling and running code attached without SysUtils and Trace calls/code results in the program running but no output is displayed on the console. This includes the "Here" code from the printf calls in RunTest.c as well as the WriteLn in the Pascal code. Removing the call to SayHello, but still linking to the FPC dylib has the same result (i.e. no output).
Adding in the trace code (which writes to file) results in a Bus Error.
This code works on Leopard.
(ps. love the product, keep up the great work!)
Steps to reproduce:
Compile attached source code with:
fpc -k"-no_dead_strip_inits_and_terms" Test.pas
gcc -arch i386 -L. -lTest RunTest.c
Execute program:
./a.out
Output:
Bus Error
Expected Output:
Here
Hello World
Here
+ Trace log file
---
When run without SysUtils or Trace:
Output: &LtPos;none>
Expected Output:
Here
Hello World
Here
Additional information:
gdb backtrace of error:
#0 0x00005c93 in SYSTEM_FPC_SHORTSTR_ASSIGN$LONGINT$POINTER$POINTER ()
#1 0x00005010 in P$TEST_TRACE$SHORTSTRING$SHORTSTRING$SHORTSTRING$SHORTSTRING ()
#2 0x00004fdb in _P$TEST_main ()
#3 0x8fe0ed6d in __dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE ()
#4 0x8fe0d31e in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj ()
#5 0x8fe0d2c2 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEj ()
#6 0x8fe0d3d1 in __dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextE ()
#7 0x8fe024a9 in __dyld__ZN4dyld24initializeMainExecutableEv ()
#8 0x8fe07950 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#9 0x8fe018b1 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl ()
#10 0x8fe01057 in __dyld__dyld_start ()
Mantis conversion info:
- Mantis ID: 14471
- OS: Mac OS X
- OS Build: Snow Leopard
- Platform: i386
- Version: 2.2.4
- Fixed in version: 2.4.0
- Fixed in revision: 13717 (#0698121f)
- Monitored by: » macite (macite)