Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • FPC Source FPC Source
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1,259
    • Issues 1,259
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 47
    • Merge requests 47
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 has launched! Please visit Breaking changes in 15.0 and 15.0 Removals to see which breaking changes may impact your workflow.

  • FPC
  • FPC
  • FPC SourceFPC Source
  • Issues
  • #14471
Closed
Open
Created Sep 01, 2009 by FPC Admin account@fpc_adminOwner

Bus Error when linking to dylib with Snow Leopard

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)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking