public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/18383] New: [4.0 Regression] Cannot use assert in a dynamic library
Date: Mon, 08 Nov 2004 21:03:00 -0000	[thread overview]
Message-ID: <20041108210254.18383.pinskia@gcc.gnu.org> (raw)

% 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


             reply	other threads:[~2004-11-08 21:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-08 21:03 pinskia at gcc dot gnu dot org [this message]
2004-11-08 21:06 ` [Bug target/18383] " pinskia at gcc dot gnu dot org
2004-11-08 21:32 ` pinskia at gcc dot gnu dot org
2004-11-19 19:43 ` pinskia at gcc dot gnu dot org
2004-11-25 19:47 ` pinskia at gcc dot gnu dot org
2004-11-30 23:38 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041108210254.18383.pinskia@gcc.gnu.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).