GNU ld on x86 Solaris

Fred Richardson frichard@bbn.com
Wed Nov 5 23:22:00 GMT 1997


Mike-

Thanks for the info!  I took a closer look at the program headers when
I link with the Solaris x86 linker.  Here are the 6 fields it uses:

     ============================================
    |  On a x86 Solaris box:
     ============================================
    % ../binutils/objdump --all-headers foo.2

    foo.2:     file format elf32-i386
    foo.2
    architecture: i386, flags 0x00000112:
    EXEC_P, HAS_SYMS, D_PAGED
    start address 0x08048834

    Program Header:
        PHDR off    0x00000034 vaddr 0x08048034 paddr 0x00000000 align 2**0
             filesz 0x000000c0 memsz 0x000000c0 flags r-x
      INTERP off    0x0000013c vaddr 0x00000000 paddr 0x00000000 align 2**0
             filesz 0x00000011 memsz 0x00000000 flags r--
        LOAD off    0x00000000 vaddr 0x08048000 paddr 0x00000000 align 2**12
             filesz 0x000014bc memsz 0x000014bc flags r-x
        LOAD off    0x000014bc vaddr 0x0804a4bc paddr 0x00000000 align 2**12
             filesz 0x0000060c memsz 0x00000614 flags rwx
     DYNAMIC off    0x000014ec vaddr 0x0804a4ec paddr 0x00000000 align 2**0
             filesz 0x00000088 memsz 0x00000000 flags rwx
        NOTE off    0x00001ac8 vaddr 0x00000000 paddr 0x00000000 align 2**0
             filesz 0x00000050 memsz 0x00000000 flags ---

     ============================================
    |  On a sparc Solaris box:
     ============================================
    % objdump --all-headers foo

    foo:     file format elf32-sparc
    foo
    architecture: sparc, flags 0x00000112:
    EXEC_P, HAS_SYMS, D_PAGED
    start address 0x0001051c

    Program Header:
        PHDR off    0x00000034 vaddr 0x00010034 paddr 0x00010034 align 2**2
             filesz 0x000000a0 memsz 0x000000a0 flags r-x
      INTERP off    0x000000d4 vaddr 0x000100d4 paddr 0x000100d4 align 2**0
             filesz 0x00000011 memsz 0x00000011 flags r--
        LOAD off    0x00000000 vaddr 0x00010000 paddr 0x00010000 align 2**16
             filesz 0x00000746 memsz 0x00000746 flags r-x
        LOAD off    0x00000748 vaddr 0x00020748 paddr 0x00020748 align 2**16
             filesz 0x00000188 memsz 0x000001cc flags rwx
     DYNAMIC off    0x00000840 vaddr 0x00020840 paddr 0x00020840 align 2**2
             filesz 0x00000090 memsz 0x00000090 flags rw-


So I wonder what "NOTE" is for...

I also found that if I run the linker without including:
    /usr/ccs/lib/values-Xa.o
the program links successfully.  But on the sparc, the same file is
included without causing a hitch...

Well, one further clue.  On the sparc, each of these files:
    /usr/ccs/lib/values-Xa.o
    /usr/ccs/lib/values-Xc.o
    /usr/ccs/lib/values-Xs.o
    /usr/ccs/lib/values-Xt.o
has these sections:
     0 .text
     1 .data
     2 .rodata
     3 .stab.index
     4 .stab.indexstr
     5 .comment

but on the x86, they have these sections:
     0 .text
     1 .stab.index
     2 .stab.indexstr
     3 .comment
     4 .data
     5 .stab.excl
     6 .stab.exclstr

Could the ".stab.excl" and ".stab.exclstr" have something to do with
the new "NOTE" section?  I'm afraid I don't really know what any of
this is...

                -Fred



More information about the Gcc mailing list