bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/19091] New: sh: FDPIC linker fails to produce DT_PLTGOT for some


From: bugdal at aerifal dot cx
Subject: [Bug ld/19091] New: sh: FDPIC linker fails to produce DT_PLTGOT for some files
Date: Thu, 08 Oct 2015 16:26:17 +0000

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

            Bug ID: 19091
           Summary: sh: FDPIC linker fails to produce DT_PLTGOT for some
                    files
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: bugdal at aerifal dot cx
  Target Milestone: ---

Created attachment 8688
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8688&action=edit
minimal test case

Under some circumstances, the SH/FDPIC linker fails to produce a DT_PLTGOT in
_DYNAMIC for a shared library despite the library containing code which needs a
valid GOT pointer to run. This makes it impossible for the dynamic loader to
load it correctly since it does not have a GOT pointer value to fill into
function descriptors. The attached file is a minimal test case and includes
instructions for assembling/linking in the comments. The circumstance
triggering the error seems to be the complete lack of GOT or PLT relocations
but the presence of static function descriptors. This can happen in a pure-code
library which internally uses or returns function pointers to its own static or
hidden functions.

The problem seems to be in sh_elf_size_dynamic_sections (elf32-sh.c); removing
the "&& htab->sgot->size != 0" condition here makes the linker work correctly
for me:

https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf32-sh.c;h=9fa363615ddbb7629628b7fe500df93d0a27a8b0;hb=HEAD#l3612

However I am not sufficiently familiar with the code to know whether this is
the correct fix or whether it might break other cases.

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