Bug 1256962 - Clang's DWARF omits varargs for some functions
Clang's DWARF omits varargs for some functions
Status: CLOSED CURRENTRELEASE
Product: Fedora EPEL
Classification: Fedora
Component: llvm (Show other bugs)
el6
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Dave Johansen
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 975551
  Show dependency treegraph
 
Reported: 2015-08-25 17:44 EDT by Ben Woodard
Modified: 2017-08-31 16:40 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-31 16:40:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
clang 3.4.2 compiled library (767.51 KB, application/x-sharedlib)
2015-08-25 17:44 EDT, Ben Woodard
no flags Details
gcc 4.4.7 compiled library (1.03 MB, application/x-sharedlib)
2015-08-25 17:45 EDT, Ben Woodard
no flags Details

  None (edit)
Description Ben Woodard 2015-08-25 17:44:08 EDT
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 17:44:48 EDT
Created attachment 1067011 [details]
clang 3.4.2 compiled library
Comment 2 Ben Woodard 2015-08-25 17:45:18 EDT
Created attachment 1067012 [details]
gcc 4.4.7 compiled library
Comment 3 Ben Woodard 2015-08-26 18:03:49 EDT
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

Note You need to log in before you can comment on or make changes to this bug.