[LLVMbugs] [Bug 19341] New: enabling debuginfo with -g causes an undefined reference error at link time

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 4 05:15:14 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19341

            Bug ID: 19341
           Summary: enabling debuginfo with -g causes an undefined
                    reference error at link time
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: greg_bedwell at sn.scee.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The testcase below links correctly when built without -g specified, but fails
with undefined reference errors with -g:

$ clang -v
clang version 3.5.0 (205622)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.2
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ clang 1.cpp

$ clang 1.cpp -g
/tmp/1-812f49.o:(.debug_info+0x91): undefined reference to `Bravo::charlie'
/tmp/1-812f49.o:(.debug_info+0xf2): undefined reference to `alpha()'
clang-3.5: error: linker command failed with exit code 1 (use -v to see
invocation)

// ==========================================
extern char alpha();
struct Bravo {
  static int charlie;
};

template <char (*delta)()> struct Echo {
  int foxtrot() {
    return 1;
  };
};

template <> struct Echo<alpha> {
  int foxtrot() {
    return 100;
  };
};

template <int *delta> struct Golf {
  int foxtrot() {
    return 1000;
  };
};

template <> struct Golf<&Bravo::charlie> {
  int foxtrot() {
    return 10000;
  };
};

int main() {
  Echo<alpha> hotel;
  Golf<&Bravo::charlie> india;
  return hotel.foxtrot() + india.foxtrot();
}
// ==========================================

I've bisected the error and can see that the testcase links successfully at
r181631, but with r181634 it fails with an undefined reference to
'Bravo::charlie'.  At r181685 we also start seeing the undefined reference to
'alpha()'.

Here are the relevant revisions:

-----------------------------------------------
http://llvm.org/viewvc/llvm-project?view=revision&revision=181632
PR14492: Debug Info: Support for values of non-integer non-type template
parameters.

This is only tested for global variables at the moment (& includes tests
for the unnamed parameter case, since apparently this entire function
was completely untested previously)
-----------------------------------------------

-----------------------------------------------
http://llvm.org/viewvc/llvm-project?view=revision&revision=181634
PR14992: Debug Info: Support more non-type template parameters

* Provide DW_TAG_template_value_parameter for pointers, function
  pointers, member pointers, and member function pointers (still missing
  support for template template parameters which GCC encodes as a
  DW_TAG_GNU_template_template_param)
* Provide values for all but the (member & non-member) function pointer case.
  Simple constant integer values for member pointers (offset within the
  object) and address for the value pointer case. GCC doesn't provide a
  value for the member function pointer case so I'm not sure how, if at
  all, GDB supports encoding that. & non-member function pointers should
  follow shortly in a subsequent patch.
* Null pointer value encodings of all of these types, including
  correctly encoding null data member pointers as -1.
-----------------------------------------------

-----------------------------------------------
http://llvm.org/viewvc/llvm-project?view=revision&revision=181685
Debug Info: PR14992: Support values for non-type template parameters of
function type
-----------------------------------------------

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140404/d4015888/attachment.html>


More information about the llvm-bugs mailing list