• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
unknown load command in shared library
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unknown load command in shared library


  • Subject: unknown load command in shared library
  • From: Ethan Tira-Thompson <email@hidden>
  • Date: Thu, 13 Dec 2007 16:03:50 -0500

I have been maintaining a libjpeg and libpng package installer for OS X, mainly for portability with packages which expect to find jpeg or png headers in one of the standard include directories...
http://ethan.tira-thompson.com/Mac OS X Ports.html

Anyway, I've been trying to do a 4-way universal build on 10.5.  E.g., -arch i386 -arch x86_64 -arch ppc -arch ppc64, plus I've tried a various combinations of sdk options like -mmacosx-version-max=10.4, -universal, -isysroot.  The library builds fine, and I can link against it on Leopard, but when I try to link against it on 10.4 (with Xcode 2.5, gcc version 4.0.1 build 5370), I get the following error:
/Developer/usr/bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: /usr/local/lib/libjpeg.dylib load command 7 unknown cmd field
collect2: ld returned 1 exit status

If I delete the dynamic library, it will link and launch using the static library.  So this is something specific to the dynamic library.

On further investigation (otool -l /usr/local/lib/libjpeg.dylib), load command 7 in the dylib is:
Load command 7
      cmd ?(0x0000001e) Unknown load command
  cmdsize 16
000233e8 0000014c 
(full otool output attached at end)

Command 0x1e is sure enough not found in /usr/include/mach-o/loader.h on 10.4, however, this command corresponds to 'LC_SEGMENT_SPLIT_INFO':
http://fxr.watson.org/fxr/ident?v=xnu-1228;i=LC_SEGMENT_SPLIT_INFO

So my current theory is that I'm compiling the code properly, as it will link/load/execute statically, but either not generating the shared library properly, not linking the executable against the library properly, or have uncovered a bug in the linker.

Evidence for the last is that the cmd is '0x0000001e', NOT '0x8000001e'; in other words, the LC_REQ_DYLD flag is not set, so I think the linker should simply be ignoring the unknown command instead of barfing.  (see comments in mach-o/loader.h)

Thoughts?  I couldn't find any information on the mystery command LC_SEGMENT_SPLIT_INFO, in particular how to disable it or if it's actually necessary.

thanks!
  -ethan

/usr/local/lib/libjpeg.dylib:
Load command 0
      cmd LC_SEGMENT
  cmdsize 396
  segname __TEXT
   vmaddr 0x00000000
   vmsize 0x00021000
  fileoff 0
 filesize 135168
  maxprot 0x00000007
 initprot 0x00000005
   nsects 5
    flags 0x0
Section
  sectname __text
   segname __TEXT
      addr 0x0000119c
      size 0x0001e2d1
    offset 4508
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x80000400
 reserved1 0
 reserved2 0
Section
  sectname __literal8
   segname __TEXT
      addr 0x0001f470
      size 0x00000010
    offset 128112
     align 2^3 (8)
    reloff 0
    nreloc 0
     flags 0x00000004
 reserved1 0
 reserved2 0
Section
  sectname __const
   segname __TEXT
      addr 0x0001f480
      size 0x000008f0
    offset 128128
     align 2^5 (32)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __literal4
   segname __TEXT
      addr 0x0001fd70
      size 0x00000024
    offset 130416
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000003
 reserved1 0
 reserved2 0
Section
  sectname __cstring
   segname __TEXT
      addr 0x0001fd94
      size 0x00001255
    offset 130452
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000002
 reserved1 0
 reserved2 0
Load command 1
      cmd LC_SEGMENT
  cmdsize 260
  segname __DATA
   vmaddr 0x00021000
   vmsize 0x00001000
  fileoff 135168
 filesize 4096
  maxprot 0x00000007
 initprot 0x00000003
   nsects 3
    flags 0x0
Section
  sectname __data
   segname __DATA
      addr 0x00021000
      size 0x00000004
    offset 135168
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __dyld
   segname __DATA
      addr 0x00021004
      size 0x00000008
    offset 135172
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Section
  sectname __const
   segname __DATA
      addr 0x00021020
      size 0x000001f4
    offset 135200
     align 2^5 (32)
    reloff 0
    nreloc 0
     flags 0x00000000
 reserved1 0
 reserved2 0
Load command 2
      cmd LC_SEGMENT
  cmdsize 192
  segname __IMPORT
   vmaddr 0x00022000
   vmsize 0x00001000
  fileoff 139264
 filesize 4096
  maxprot 0x00000007
 initprot 0x00000007
   nsects 2
    flags 0x0
Section
  sectname __pointers
   segname __IMPORT
      addr 0x00022000
      size 0x00000030
    offset 139264
     align 2^2 (4)
    reloff 0
    nreloc 0
     flags 0x00000006
 reserved1 0 (index into indirect symbol table)
 reserved2 0
Section
  sectname __jump_table
   segname __IMPORT
      addr 0x00022040
      size 0x00000177
    offset 139328
     align 2^6 (64)
    reloff 0
    nreloc 0
     flags 0x04000008
 reserved1 12 (index into indirect symbol table)
 reserved2 5 (size of stubs)
Load command 3
      cmd LC_SEGMENT
  cmdsize 56
  segname __LINKEDIT
   vmaddr 0x00023000
   vmsize 0x00004000
  fileoff 143360
 filesize 14504
  maxprot 0x00000007
 initprot 0x00000001
   nsects 0
    flags 0x0
Load command 4
          cmd LC_ID_DYLIB
      cmdsize 56
         name /usr/local/lib/libjpeg.62.dylib (offset 24)
   time stamp 1 Wed Dec 31 19:00:01 1969
      current version 63.0.0
compatibility version 63.0.0
Load command 5
     cmd LC_SYMTAB
 cmdsize 24
  symoff 144692
   nsyms 377
  stroff 150908
 strsize 6956
Load command 6
            cmd LC_DYSYMTAB
        cmdsize 80
      ilocalsym 0
      nlocalsym 260
     iextdefsym 260
     nextdefsym 103
      iundefsym 363
      nundefsym 14
         tocoff 149564
           ntoc 103
      modtaboff 150388
        nmodtab 1
   extrefsymoff 150440
    nextrefsyms 117
 indirectsymoff 149216
  nindirectsyms 87
      extreloff 0
        nextrel 0
      locreloff 143360
        nlocrel 125
Load command 7
      cmd ?(0x0000001e) Unknown load command
  cmdsize 16
000233e8 0000014c
Load command 8
          cmd LC_LOAD_DYLIB
      cmdsize 52
         name /usr/lib/libSystem.B.dylib (offset 24)
   time stamp 2 Wed Dec 31 19:00:02 1969
      current version 111.0.0
compatibility version 1.0.0
Load command 9
          cmd LC_LOAD_DYLIB
      cmdsize 52
         name /usr/lib/libgcc_s.1.dylib (offset 24)
   time stamp 2 Wed Dec 31 19:00:02 1969
      current version 1.0.0
compatibility version 1.0.0
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: unknown load command in shared library
      • From: Peter O'Gorman <email@hidden>
  • Prev by Date: Missing build-in rules for data model files
  • Next by Date: Leopard Codesign - no such identity
  • Previous by thread: Re: Missing build-in rules for data model files
  • Next by thread: Re: unknown load command in shared library
  • Index(es):
    • Date
    • Thread