libunwind-devel
[Top][All Lists]
Advanced

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

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


From: Tommy Hoffner
Subject: Re: [libunwind] Linking with libunwind.a using the Intel compiler
Date: Tue, 04 Jan 2005 09:07:25 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b) Gecko/20040421

Jeremy Suurkivi wrote:

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.
This is due to the fact that Intel has changed default behaviour for the compiler somewhere between version 7 and the latest. 7.1 uses the included Dinkumware c++-libraries (and include-files) while 8.0 (or 8.1?) switched to using the libraries related to the binary called gcc in the searchpath (if it is gcc 3.2 or higher)

ecpc file.C in ver 8 is equivalent to ecpc -cxxlib-gcc in 7.1.

And yes the Dinkumware libraries has there own libunwind which has nothing to do with this lists libunwind, e.g. Intels compiler does definetly not support this libunwind if you link towards the Dinkumware libraries.

If and how the gcc libraries (eg gcclib) support libunwind you can probably see in my earlier discussion with David.

 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?
I doubt it. According to Intel, Mosbergers libunwind is not supported yet, but it seems to work when linking with gcc-libraries. I got it working for ecpc ver 8.1 and gcc 3.3/3.4 (latest debian sarge) with some restrictions (se my earlier posts, there is a makefile with two equivalent setups, one using ecpc and one using gcc).

I don't know what platform you are using but I found it none-trivial to get dynamic support working for debian sarge on Itanium. (One feature I was using was broken in the 0.97 releas that comes with debian sarge and it was not trivial to get it to use a full functional 0.98.3, but my probelms where related to duýnamic unwind so it might work for you.)

Good luck,

/Tommy

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; }


------------------------------------------------------------------------

_______________________________________________
libunwind mailing list
address@hidden
http://www.hpl.hp.com/hosted/linux/mail-archives/libunwind/


--
Tommy Hoffner
Senior Software Designer
Compiler Technology

Ericsson AB
Development Unit Core Network Development
Tel:    +46 13 23 57 12
Fax:    +46 13 23 57 99
address@hidden
www.ericsson.com

This communication is confidential and intended solely for the
addressee(s). Any unauthorized review, use, disclosure or distribution is
prohibited. If you believe this message has been sent to you in error,
please notify the sender by replying to this transmission and delete the
message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption,
interruption, unauthorized amendment, tampering and viruses, and we only
send and receive e-mails on the basis that we are not liable for any such
corruption, interception, amendment, tampering or viruses or any
consequences thereof.

reply via email to

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