This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/17153] New: Shared libraries built with multiple tocs resolve plt to local function entry


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

            Bug ID: 17153
           Summary: Shared libraries built with multiple tocs resolve plt
                    to local function entry
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: amodra at gmail dot com

An optimisation in glibc is supposed to make calls within a shared library go
to the local entry points, when DT_PPC64_OPT does *not* have bit 2
(PPC64_OPT_MULTI_TOC) set.  See
glibc/sysdeps/powerpc/powerpc64/dl-machine.h:ppc64_local_entry_offset.

Libraries (typically built with -mcmodel=small) correctly have the bit set when
their TOC exceeds 64k, but glibc *is* applying the local offset.

When I look at the l_info in question, I see
p ((struct link_map *) 0x3fffb7f925d8)->l_info
$6 = {0x0, 0x3fffb7edaf58, 0x3fffb7edb028, 0x3fffb7edb018, 0x3fffb7edafc8, 
  0x3fffb7edafd8, 0x3fffb7edafe8, 0x3fffb7edb078, 0x3fffb7edb088, 
  0x3fffb7edb098, 0x3fffb7edaff8, 0x3fffb7edb008, 0x3fffb7edaf68, 
  0x3fffb7edaf78, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3fffb7edb038, 0x0, 0x0, 
  0x3fffb7edb048, 0x0, 0x3fffb7edaf88, 0x3fffb7edafa8, 0x3fffb7edaf98, 
  0x3fffb7edafb8, 0x0, 0x0, 0x0, 0x0, 0x0,
-------
  0x3fffb7edb058, 0x0, 0x0, 0x3fffb7edb0b8,
-------
  0x3fffb7edb0a8, 0x0, 0x0, 0x0, 0x0, 0x3fffb7edb0d8, 0x0, 
  0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3fffb7edb0c8, 0x0 <repeats 26 times>}

Highlighted part is the DT_PPC64 area, with DT_PPC64_OPT being the last one. 
It should be "0x2", but is overwritten with some other value due to
DT_PPC64_NUM being one too small in the following from elf.h.

/* PowerPC64 specific values for the Dyn d_tag field.  */
#define DT_PPC64_GLINK  (DT_LOPROC + 0)
#define DT_PPC64_OPD    (DT_LOPROC + 1)
#define DT_PPC64_OPDSZ  (DT_LOPROC + 2)
#define DT_PPC64_OPT    (DT_LOPROC + 3)
#define DT_PPC64_NUM    3

The fix is obvious..

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]