I’m using an Xcode 15 based toolchain to build a C++ project, which links against the Intel IPP library if built for x86_64. Since switching to Xcode 15 which comes with the “New Apple Linker” I get a lot of linker warnings like
ld: warning: no platform load command found in '/Path/To/libippvm.a[x86_64][4773](vml_impl_dCtanhScalar_EXHAynn.o)', assuming: macOS
What I get here is that the object files contained in the static Intel IPP library obviously don’t specify some “platform load command”. I’ve had a hard time finding any in depth information on what that “platform load command” is.
State of my own research so far
Inspecting the library with
otool -hvl -arch all /Path/To/libippvm.a
outputs something like this for every contained object
/Path/To/libippvm.a(vml_impl_dCtanhScalar_EXHAynn.o) (architecture x86_64):
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 X86_64 ALL 0x00 OBJECT 3 496 SUBSECTIONS_VIA_SYMBOLS
Load command 0
cmd LC_SEGMENT_64
cmdsize 392
segname
vmaddr 0x0000000000000000
vmsize 0x00000000000006b8
fileoff 528
filesize 1720
maxprot rwx
initprot rwx
nsects 4
flags (none)
Section
sectname __text
segname __TEXT
addr 0x0000000000000000
size 0x00000000000005e0
offset 528
align 2^5 (32)
reloff 2248
nreloc 24
type S_REGULAR
attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
reserved1 0
reserved2 0
Section
sectname __const
segname __TEXT
addr 0x00000000000005e0
size 0x0000000000000040
offset 2032
align 2^4 (16)
reloff 0
nreloc 0
type S_REGULAR
attributes (none)
reserved1 0
reserved2 0
Section
sectname __compact_unwind
segname __LD
addr 0x0000000000000620
size 0x0000000000000020
offset 2096
align 2^3 (8)
reloff 2440
nreloc 1
type S_REGULAR
attributes DEBUG
reserved1 0
reserved2 0
Section
sectname __eh_frame
segname __TEXT
addr 0x0000000000000640
size 0x0000000000000078
offset 2128
align 2^0 (1)
reloff 2448
nreloc 2
type S_COALESCED
attributes NO_TOC STRIP_STATIC_SYMS LIVE_SUPPORT
reserved1 0
reserved2 0
Load command 1
cmd LC_DYSYMTAB
cmdsize 80
ilocalsym 0
nlocalsym 5
iextdefsym 5
nextdefsym 2
iundefsym 7
nundefsym 4
tocoff 0
ntoc 0
modtaboff 0
nmodtab 0
extrefsymoff 0
nextrefsyms 0
indirectsymoff 2464
nindirectsyms 0
extreloff 0
nextrel 0
locreloff 0
nlocrel 0
Load command 2
cmd LC_SYMTAB
cmdsize 24
symoff 2464
nsyms 11
stroff 2640
strsize 204
So I see some mention of the term load command there, but indeed no obvious reference to “macOS” which the linker seems to miss and therefore has to guess.
I inspected an locally built object file for some dummy library and when inspecting it the same way, it contains
Load command 1
cmd LC_BUILD_VERSION
cmdsize 24
platform MACOS
minos 11.0
sdk 11.0
ntools 0
Load command 2
cmd LC_SYMTAB
cmdsize 24
symoff 440
nsyms 3
stroff 488
strsize 20
So indeed, there seems to be another LC_BUILD_VERSION
load command section specifying platform MACOS
for that object file which the Intel library does not have.
What I’m looking for
- Good resources that explain the meaning of those load commands and how they work so that I’m able to really understand the meaning of the warning message.
- At best a way to fix the existing Intel library. Given that I know that the library is built for macOS, is there any way to add according
LC_BUILD_VERSION
load commands that specify the platform to the existing library?
I know that a lot of resources on the internet simply suggest to use the old linker to work around the warnings, but I’d really like to make it work warning free with the new linker.