0

Out of sheer academic curiosity I am trying to make a MacOS GUI application ultra compatible — meaning that it has to run on all versions of MacOS from 10.6 to 10.14; going beyond this range is restricted by the differences in Cocoa API and CoreText/CoreGraphics.
Unfortunately the app depends significantly on several features of C11, e.g. __auto_type, so I cannot just go and compile it on 10.6, having to resort to cross-compilation.

The problem is that after being linked on 10.13 the resulting x86-32 Mach-O binary contains 3 load commands in its header that the dyld of 10.6 cannot recognize:

  1. LC_MAIN (0x80000028)
  2. LC_DATA_IN_CODE (0x00000029)
  3. LC_SOURCE_VERSION (0x0000002A)

My question is:
How do I tell the llvm-gcc linker to avoid inserting these commands, and e.g. substitute LC_MAIN with the more compatible LC_UNIXTHREAD, etc.?

hidefromkgb
  • 5,834
  • 1
  • 13
  • 44

1 Answers1

1

Use -macosx_version_min 10.6 as ld parameter. This will generate LC_UNIXTHREAD instead of LC_MAIN in your executable (among other legacy load commands you're after).

Kamil.S
  • 5,205
  • 2
  • 22
  • 51