This is the mail archive of the libc-alpha@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]

Re: [PATCH] S390: Refactor ifunc resolvers due to false debuginfo.


On 06/10/2016 06:59 PM, Joseph Myers wrote:
Are the debug info issues you describe unique to S/390 because of some
peculiarity of how S/390, and only S/390, defines IFUNC resolvers in
glibc, or do they apply to any other architectures as well and so need
fixes there?


The libc_ifunc macro in include/libc-symbols.h also uses the asm-name
and the debug-information contains the DW_AT_linkage_name field.
Here is the debug-info for strcmp on a power system:
 <1><297449>: Abbrev Number: 42 (DW_TAG_subprogram)
    <29744a>   DW_AT_external    : 1	
<29744a> DW_AT_name : (indirect string, offset: 0x11700): strcmp_ifunc
    <29744e>   DW_AT_decl_file   : 1	
    <29744f>   DW_AT_decl_line   : 28	
<297450> DW_AT_linkage_name: (indirect string, offset: 0x4b89): strcmp
    <297454>   DW_AT_prototyped  : 1	
    <297454>   DW_AT_type        : <0x295fd6>	
    <297458>   DW_AT_low_pc      : 0xc0520	
    <297460>   DW_AT_high_pc     : 0x0 0xb4	
    <297468>   DW_AT_frame_base  : 1 byte block: 9c 	(DW_OP_call_frame_cfa)
    <29746a>   Unknown AT value: 2117: 1	
    <29746a>   DW_AT_sibling     : <0x2974bc>	
 <2><29746e>: Abbrev Number: 43 (DW_TAG_variable)
    <29746f>   DW_AT_name        : (indirect string, offset: 0xaa4): hwcap
...

In contrast to the s390 ifunc-resolver, the ifunc-resolver does not have a parameter whereas on s390, the resolver gets hwcap as argument. I don't have access to lldb on another architecture, so I don't know if this is an issue there. So far there are multiple hits on power like strcmp, strchr, strcat, strcpy, memcmp, wcscpy, time, ... which uses the libc_ifunc macro and thus have the DW_AT_linkage_name field. There are also a lot of "__" prefixed ifunc functions like __wcschr with an alias wcschr. The debug info for __wcschr contains the DW_AT_linkage_name field and wcschr does not have debug infos.

On intel the most ifunc resolvers for string functions are implemented directly in assembler files and thus have no debug information. The libc_ifunc macro is used for e.g. strstr, memmove, but the functions are redirected to avoid the debug info for strstr, memmove.

There exist sparc ifunc macros which also uses the asm-name construct:
sparc_libm_ifunc and sparc_libc_ifunc in sysdeps/sparc/sparc-ifunc.h.

There also exist some symbol redirections for ABI compatibility.
The ones for libpthread are using an inline assembly with set, globl, type and thus do not produce debug information (See e.g. nptl/pt-fork.c). But for librt I've found the asm-name construct for clock_getres & co in rt/clock-compat.c.

Bye
Stefan


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