Bug 367371

Summary: DW_AT_MIPS_linkage_name with excessive prefix `*__GI_' in C (glibc-debuginfo)
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 8CC: aoliva, drepper, triage
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: bzcl34nup
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-08-03 04:17:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Jan Kratochvil 2007-11-05 20:16:52 UTC
Description of problem:
Upstream GDB needs one of these commands to access `errno' in nonthreaded apps:
  (gdb) print *('*__GI___errno_location')()
  (gdb) print *((int *(*)())__errno_location)()

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. echo 'int main () {}' >main.c
2. gcc -g -o main main.c
3. upstream/gdb ./main
4. start
5. print *__errno_location()

Actual results:
Cannot access memory at address 0xffffffffaaac3698

Expected results:
$1 = 0

Additional info:
The error is due to `__errno_location' having no debug info and defaulting to:
  (gdb) ptype __errno_location
  type = int ()
as GDB prefers DW_AT_MIPS_linkage_name over DW_AT_name, if present.
But glibc-debuginfo-2.7-2.x86_64 has:
 <1><81a0>: Abbrev Number: 12 (DW_TAG_subprogram)
  <81a2>     DW_AT_name        : (indirect string, offset: 0x280e): __errno_location
  <81a8>     DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808):
so one needs to use one of the workarounding commands in the Description.

There is now workaround in gdb-6.7.1-3.fc9 to prefer DW_AT_name over
DW_AT_MIPS_linkage_name for plain C Compilation Units.
AFAIK DW_AT_MIPS_linkage_name is so far in use only as an insufficient debuginfo
reading GDB implementation helper for C++ methods.

It may not make sense to fix DW_AT_MIPS_linkage_name as it should rather be
dropped and GDB implementation improved to cope with C++ without it.

Comment 1 Jakub Jelinek 2007-11-06 17:22:08 UTC
That's not a GCC bug.  In glibc we have extern int *__errno_location (void)
__asm ("__GI___errno_location"); and then add an alias in asm, so that calls to
__errno_location from libc.so are binding to the libc.so definition always and
don't go through PLT, while __errno_location is exported.
Current ld has -Bsymbolic-functions and -Bsymbolic-data support, so perhaps
we could use it instead eventually if we fix bugs in it.

Comment 2 Bug Zapper 2008-04-04 14:25:53 UTC
Based on the date this bug was created, it appears to have been reported
during the development of Fedora 8. In order to refocus our efforts as
a project we are changing the version of this bug to '8'.

If this bug still exists in rawhide, please change the version back to
(If you're unable to change the bug's version, add a comment to the bug
and someone will change it for you.)

Thanks for your help and we apologize for the interruption.

The process we're following is outlined here:

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

Comment 3 Ulrich Drepper 2008-08-03 04:17:15 UTC
We cannot use -Bsymbolic in any form.  The malloc functions must be interceptible.  With gdb working differently now, I assume there is nothing left to do.  If there is, reopen.