bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/20118] New: gas should set .init_array etc. sh_entsize to word


From: ro at gcc dot gnu.org
Subject: [Bug gas/20118] New: gas should set .init_array etc. sh_entsize to word size
Date: Thu, 19 May 2016 11:16:37 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20118

            Bug ID: 20118
           Summary: gas should set .init_array etc. sh_entsize to word
                    size
           Product: binutils
           Version: 2.26
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: ro at gcc dot gnu.org
  Target Milestone: ---

Solaris elfdump complains about sh_entsize being 0for .init_array etc.
sections.  The following example is on Solaris/x86, but the same applies to any
ELF target.

$ cat ia-i386.s
        .text
        .globl  init
        .type   init, @function
init:
        ret
        .size   init, .-init
        .section        .init_array,"aw"
        .align 4
        .long   init
$ gas-2.26 --32 ia-i386.s -o ia-i386.o
$ elfdump -N .init_array ia-i386.o
ia-i386.o: .init_array: zero sh_entsize information, expected 0x4

Init/Fini Array Section:  .init_array
  index  value derived-address  name
    [0]      0               0  init
$ elfdump -c -N .init_array ia-i386.o

Section Header[4]:  sh_name: .init_array
    sh_addr:      0               sh_flags:   [ SHF_WRITE SHF_ALLOC ]
    sh_size:      0x4             sh_type:    [ SHT_INIT_ARRAY ]
    sh_offset:    0x38            sh_entsize: 0
    sh_link:      0               sh_info:    0
    sh_addralign: 0x4       

Solaris/x86 as behaves the same, while Solaris/SPARC correctly sets
sh_entsize to the respective word size.

Solaris ld also gets it right:

$ cat ia-cc.c
void init()
{
}
$ gcc -c ia-cc.c
$ ld -r -zinitarray=init ia-cc.o -o ia-cc-ld.o
$ elfdump -N .init_array ia-cc-ld.o

Init/Fini Array Section:  .init_array
  index  value derived-address  name
    [0]      0               0  init
$ elfdump -c -N .init_array ia-cc-ld.o

Section Header[2]:  sh_name: .init_array
    sh_addr:      0               sh_flags:   [ SHF_WRITE SHF_ALLOC ]
    sh_size:      0x4             sh_type:    [ SHT_INIT_ARRAY ]
    sh_offset:    0x3c            sh_entsize: 0x4 (1 entry)
    sh_link:      0               sh_info:    0
    sh_addralign: 0x4       

  Rainer

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]