This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/18383] New: [4.0 Regression] Cannot use assert in a dynamic library
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Nov 2004 21:03:04 -0000
- Subject: [Bug target/18383] New: [4.0 Regression] Cannot use assert in a dynamic library
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
% cat t.c
#include <assert.h>
int f1(int a)
{
assert(a);
return a;
}
% cat t.cc
#include <assert.h>
extern "C" int f(int);
int f(int a)
{
assert(a);
return a;
}
% cat main.cc
extern"C" int f(int);
extern"C" int f1(int);
int main(void)
{
f(0);
f1(0);
}
% g++ -dynamiclib t.cc -o libt1.dylib
% gcc -dynamiclib t.c -o libt.dylib
% g++ -L. -lt -lt1 main.cc
Before my patch to use shared libgcc for dynamic library which means we are doing something wrong:
/usr/bin/ld: warning suggest use of -bind_at_load, as lazy binding may result in errors or different
symbols being used
symbol ___eprintf used from dynamic library /Users/pinskia/tree-cleanup-branch/lib/gcc/powerpc-
apple-darwin7.4.1/4.1.0-tcb/../../../libstdc++.dylib(_eprintf.o) not from earlier dynamic library
libt.dylib(_eprintf.o)
After (when linking the first dynamic library):
ld: Undefined symbols:
___eprintf
/usr/bin/libtool: internal link edit command failed
--
Summary: [4.0 Regression] Cannot use assert in a dynamic library
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: *-darwin*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18383