libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libunwind] Linking with libunwind.a using the Intel compiler


From: Jeremy Suurkivi
Subject: [libunwind] Linking with libunwind.a using the Intel compiler
Date: Thu, 30 Dec 2004 16:08:16 -0600


I'm having trouble linking a test program with libunwind.a using the Intel compiler, version 7.1

I have created a simple test program (shown below) based on the example from the docs.  If I try to build using:

$ ecpc -Iinc test.cpp libunwind.a -o test

I get the following error:

 /<part_of_directory_omitted>/71_40_S2/ia64/lib/libunwind.a(unwind.o): In function `_Unwind_Resume':
unwind.o(.text+0x1300): multiple definition of `_Unwind_Resume'
libunwind.a(Resume.o):unwind/Resume.c:30: first defined here
ld: Disabling relaxation: it will not work with multiple definitions
ld: Warning: size of symbol `_Unwind_Resume' changed from 800 to 3328 in /<part_of_directory_omitted>/71_40_S2/ia64/lib/libunwind.a(unwind.o)

I built libunwind.a (0.98.3) with the same compiler according to the steps in README.  I also tried building libunwind using gcc.

The same command works with version 8 of the Intel compiler or with g++ substituted for ecpc.  I can also get around this by using dynamic linking:

$ ecpc -Iinc test.cpp -Llib -lunwind -o test

This seems to be a reasonable solution but I'm still a little nervous using it.  It seems that the Intel compiler statically links in its own unwind library (libunwind.so.4 in this case) and it seems there is a symbol clash with _Unwind_Resume.  Is it safe to substitute _Unwind_Resume from one library into the other?  Or to have both of these libraries linked in at the same time?

Thanks,

Jeremy



#define UNW_LOCAL_ONLY
#include <libunwind.h>
#include <stdio.h>

void show_backtrace (void) {
  unw_cursor_t cursor; unw_context_t uc;
  unw_word_t ip, sp;

  unw_getcontext(&uc);
  unw_init_local(&cursor, &uc);
  while (unw_step(&cursor) > 0) {
    unw_get_reg(&cursor, UNW_REG_IP, &ip);
    unw_get_reg(&cursor, UNW_REG_SP, &sp);
    printf ("ip = %lx, sp = %lx\n", (long) ip, (long) sp);
  }
}

void a(void)
{
   show_backtrace();
   printf("\n");
}


int main(int argc, char *argv[])
{
   a();

   return 0;
}
reply via email to

[Prev in Thread] Current Thread [Next in Thread]