Bug 1256962

Summary: Clang's DWARF omits varargs for some functions
Product: [Fedora] Fedora EPEL Reporter: Ben Woodard <woodard>
Component: llvmAssignee: Dave Johansen <davejohansen>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: el6CC: davejohansen, dodji, legendre1, tgamblin, tgummels, tstellar
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-31 20:40:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 975551    
Attachments:
Description Flags
clang 3.4.2 compiled library
none
gcc 4.4.7 compiled library none

Description Ben Woodard 2015-08-25 21:44:08 UTC
Description of problem:
Looking at the abidiff comparing the same library compiled with clang vs. compiled with GCC it points out:
[C]'function void RAW_LOG(int, const char*)' has some indirect sub-type changes:
    parameter 3 of type '...' was added
When you look at the declaration of the function in the source code you can see that it makes use of varargs

gperftools/src/base/logging.h
inline void RAW_LOG(int lvl, const char* pat, ...)  { LOG_PRINTF(lvl, pat); }

In the DWARF you can see that GCC gets this right:

 [ 3922b]    subprogram
             external             (flag) Yes
             name                 (strp) "RAW_LOG"
             decl_file            (data1) 1
             decl_line            (data1) 228
             MIPS_linkage_name    (strp) "_Z7RAW_LOGiPKcz"
<snip>
 [ 3924d]      formal_parameter
               name                 (string) "lvl"
               decl_file            (data1) 1
               decl_line            (data1) 228
               type                 (ref4) [ 346dd]
               location             (data4) location list [ 2576f]
 [ 3925c]      formal_parameter
               name                 (string) "pat"
               decl_file            (data1) 1
               decl_line            (data1) 228
               type                 (ref4) [ 34cc6]
               location             (data4) location list [ 25792]
 [ 3926b]      unspecified_parameters
 [ 3926c]      lexical_block


But in Clang it only lists the 1st two parameters:

[ 2474f]    subprogram
             MIPS_linkage_name    (strp) "_Z7RAW_LOGiPKcz"
             name                 (strp) "RAW_LOG"
             decl_file            (data1) 18
             decl_line            (data1) 228
             external             (flag_present) Yes
<snip>
[ 2476c]      formal_parameter
               name                 (strp) "lvl"
               decl_file            (data1) 18
               decl_line            (data1) 228
               type                 (ref4) [ 22c53]
               location             (sec_offset) location list [ 106f1]
 [ 2477b]      formal_parameter
               name                 (strp) "pat"
               decl_file            (data1) 18
               decl_line            (data1) 228
               type                 (ref4) [ 22bf9]
               location             (sec_offset) location list [ 10727]
 [ 2478a]      lexical_block

Note that there is no: "unspecified_parameters". This will impact user's ability to debug functions which make use of varargs

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

How reproducible:
At least sometimes.

Steps to Reproduce:
1. compare the two attached object files using abidiff
2. look at each compiler's resulting DWARF


Actual results:
There are only two parameters listed in clang's DWARF.

Expected results:
There should an unspecified_parameters line in clang's DWARF

Comment 1 Ben Woodard 2015-08-25 21:44:48 UTC
Created attachment 1067011 [details]
clang 3.4.2 compiled library

Comment 2 Ben Woodard 2015-08-25 21:45:18 UTC
Created attachment 1067012 [details]
gcc 4.4.7 compiled library

Comment 3 Ben Woodard 2015-08-26 22:03:49 UTC
This appears to be fixed in clang 3.5.0

 [ 1f8a8]    subprogram
             low_pc               (addr) +0x0000000000015dd0 <_Z7RAW_LOGiPKcz>
             high_pc              (data4) 299 (+0x0000000000015efb)
             frame_base           (exprloc) 
              [   0] reg7
             lo_user+0x1fe7       (flag_present) 
             MIPS_linkage_name    (strp) "_Z7RAW_LOGiPKcz"
             name                 (strp) "RAW_LOG"
             decl_file            (data1) 14
             decl_line            (data1) 228
             external             (flag_present) 
             accessibility        (data1) public (1)
 [ 1f8c2]      formal_parameter
               location             (sec_offset) location list [ 1131f]
               name                 (strp) "lvl"
               decl_file            (data1) 14
               decl_line            (data1) 228
               type                 (ref4) [ 1dd37]
 [ 1f8d1]      formal_parameter
               location             (sec_offset) location list [ 11359]
               name                 (strp) "pat"
               decl_file            (data1) 14
               decl_line            (data1) 228
               type                 (ref4) [ 1e16b]
 [ 1f8e0]      unspecified_parameters
 [ 1f8e1]      lexical_block