bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/17350] New: ld cannot handle .init_array mixed with comdat


From: rafael.espindola at gmail dot com
Subject: [Bug ld/17350] New: ld cannot handle .init_array mixed with comdat
Date: Thu, 04 Sep 2014 23:59:04 +0000

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

            Bug ID: 17350
           Summary: ld cannot handle .init_array mixed with comdat
           Product: binutils
           Version: 2.25 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: rafael.espindola at gmail dot com

Created attachment 7770
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7770&action=edit
testcase

The attached testcase has a .init_array that is in a comdat.

With gold

$ ~/binutils/build/gold/ld-new -shared -o test.so test.o
$ readelf  -x .init_array test.so

Hex dump of section '.init_array':
  0x00001468 90020000 00000000                   ........

$ readelf -sDW test.so | grep FUNC
    1   0: 0000000000000290     1 FUNC    WEAK   DEFAULT   7 f

That is, .init_array points to the function f, as expected.

With bfd ld:

$ ~/binutils/build/ld/ld-new -shared -o test.so test.o
address@hidden llvm]$ readelf  -x .init_array test.so

Hex dump of section '.init_array':
  0x00200268 00000000 00000000                   ........

The section has a null.


As to why this is useful: In C++ when doing static initialization of a variable
in a comdat we can put the .init_array in that comdat. That way the linker
should keep only one copy.

-- 
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]