Ok, I'm still confused on this, but here is an interesting data point.
If I build my Pascal code as a unit and a .o, and then have a trivial C main that calls it, that works and does not have the problem.
But if I use GPC with a trivial main that calls it, then I get the error. Perhaps it is something to do with the way GPC sets up the initial stack frame as compared to GCC or some such? Here are my two commands:
With cc, this works:
cc -I/Developer/Headers/FlatCarbon -flat_namespace -undefined suppress -framework Carbon -framework ApplicationServices -framework Security -o build/Installer Sources/Main.c build/Installer.o
With GPC, this fails:
gpc -o installer -Wl,-framework,Carbon,-framework,Security,-framework,ApplicationServices Main.pas ../build/installer.o ../build/Authorization.o ../build/AuthorizationTags.o /Developer/Pascal/GPCPInterfaces/GPCMacOSAll.o /Developer/Pascal/GPCPInterfaces/GPCStringsAll.o
Note that with GPC I have to include all the "empty" .o files which are otherwise unnecessary. Beats me if that is related to the issue.
So it seems there is some issue about the ay GPC initializes as compared to the way cc initializes that is conflicting some how.
I tried gdb, but it didn't tell me anything about the problem (at least nothing I could understand).
For now I have a not very good workaround (since I think this will fail if I try to actually use any of the GPC runtime stuff), but at least I can move on, I've spent the last several days trying to figure this out :-( If I hadn't got it working this morning, I'd have had to spend the rest of the day converting the .pas file to C :-(
Oh well, perhaps this will help shed some light on the subject. Perhaps once I can use that --longjmp-all-nonlocal-labels flag that'll make a difference.
Thanks, Peter.