public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "howarth at nitro dot med.uc.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libitm/55693] [4.8 Regression] libitm.c++/eh-1.C execution test fails on darwin from r193271
Date: Wed, 23 Jan 2013 19:42:00 -0000	[thread overview]
Message-ID: <bug-55693-4-lt1DqtJ7Pr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55693-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55693

--- Comment #31 from Jack Howarth <howarth at nitro dot med.uc.edu> 2013-01-23 19:41:52 UTC ---
I believe the attached testcase, weak_symbol.tar.bz2, demonstrates that the
solution on darwin is to mark the duplicate symbols in crttme.o as weak.
Consider the following test case...

% cat fun.c
extern void foo(void) __attribute__((weak));
 void fun(void)
 {
   if (foo) foo();
 }

% cat foo.c
#include <stdio.h>

void foo(void)
{
  printf("Hello!\n");
}


% cat bar.c
#include <stdio.h>

void foo(void) __attribute__((weak));

void foo(void)
{
  printf("Goodbye!\n");
}

% cat weak_test.c
#include <stdio.h>

void fun(void);

int main()
{
  fun();
  return 0;
}

compiled as...

clang -c fun.c
clang -dyanmiclib -shared -Wl,-undefined -Wl,dynamic_lookup -o libfun.dylib
fun.o
clang -c foo.c
clang -dyanmiclib -shared -Wl,-undefined -Wl,dynamic_lookup -o libfoo.dylib
foo.o
clang -c bar.c
clang -c weak_test.c
clang -o weak_test weak_test.o ./libfoo.dylib ./libfun.dylib bar.o
clang -o weak_test2 weak_test.o  ./libfun.dylib bar.o

This gives...

setenv DYLD_LIBRARY_PATH .
% ./weak_test
Hello!
% ./weak_test2
Goodbye!

which argues that if we mark the weak symbols from eh_cpp.cc as weak in
crttme.o as well, those symbols can be overridden by the ones in libstdc++ as
expected. Also, this eliminates the need to place libstdc++ first...

% clang -o weak_test3 weak_test.o ./libfun.dylib bar.o ./libfoo.dylib
% ./weak_test3
Hello!


  parent reply	other threads:[~2013-01-23 19:42 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14 18:53 [Bug libitm/55693] New: libitm.c++/eh-1.C execution test " howarth at nitro dot med.uc.edu
2012-12-14 18:55 ` [Bug libitm/55693] " howarth at nitro dot med.uc.edu
2012-12-14 19:35 ` [Bug libitm/55693] regression in " howarth at nitro dot med.uc.edu
2012-12-14 19:40 ` howarth at nitro dot med.uc.edu
2012-12-14 19:54 ` dominiq at lps dot ens.fr
2012-12-14 20:31 ` howarth at nitro dot med.uc.edu
2012-12-14 21:25 ` [Bug libitm/55693] [4.8 Regression] libitm.c++/eh-1.C execution test fails " dominiq at lps dot ens.fr
2013-01-11 22:54 ` torvald at gcc dot gnu.org
2013-01-12  3:25 ` howarth at nitro dot med.uc.edu
2013-01-15 19:14 ` rth at gcc dot gnu.org
2013-01-17 17:36 ` aldyh at gcc dot gnu.org
2013-01-17 18:26 ` aldyh at gcc dot gnu.org
2013-01-17 18:45 ` aldyh at gcc dot gnu.org
2013-01-17 22:17 ` echristo at gmail dot com
2013-01-18 17:15 ` aldyh at redhat dot com
2013-01-18 17:23 ` aldyh at gcc dot gnu.org
2013-01-18 22:03 ` howarth at nitro dot med.uc.edu
2013-01-18 22:16 ` howarth at nitro dot med.uc.edu
2013-01-19 17:12 ` howarth at nitro dot med.uc.edu
2013-01-23  4:01 ` howarth at nitro dot med.uc.edu
2013-01-23  4:34 ` aldyh at gcc dot gnu.org
2013-01-23  8:45 ` iains at gcc dot gnu.org
2013-01-23  9:44 ` jakub at gcc dot gnu.org
2013-01-23  9:56 ` dominiq at lps dot ens.fr
2013-01-23 13:33 ` iains at gcc dot gnu.org
2013-01-23 14:12 ` aldyh at redhat dot com
2013-01-23 16:45 ` howarth at nitro dot med.uc.edu
2013-01-23 16:49 ` howarth at nitro dot med.uc.edu
2013-01-23 17:33 ` howarth at nitro dot med.uc.edu
2013-01-23 18:31 ` dominiq at lps dot ens.fr
2013-01-23 19:32 ` howarth at nitro dot med.uc.edu
2013-01-23 19:42 ` howarth at nitro dot med.uc.edu [this message]
2013-01-23 20:00 ` iains at gcc dot gnu.org
2013-01-23 20:15 ` iains at gcc dot gnu.org
2013-01-23 20:36 ` iains at gcc dot gnu.org
2013-01-23 21:14 ` howarth at nitro dot med.uc.edu
2013-01-23 21:28 ` howarth at nitro dot med.uc.edu
2013-01-23 22:16 ` iains at gcc dot gnu.org
2013-01-24  5:54 ` howarth at nitro dot med.uc.edu
2013-01-24 11:34 ` iains at gcc dot gnu.org
2013-01-24 14:55 ` howarth at nitro dot med.uc.edu
2013-01-24 15:24 ` howarth at nitro dot med.uc.edu
2013-01-25 13:24 ` howarth at nitro dot med.uc.edu
2013-02-04 19:51 ` mrs at gcc dot gnu.org
2013-02-07 19:34 ` howarth at nitro dot med.uc.edu
2013-02-07 22:00 ` dominiq at lps dot ens.fr
2013-02-08 11:47 ` patrick.marlier at gmail dot com
2013-02-08 14:39 ` howarth at nitro dot med.uc.edu
2013-02-08 14:40 ` howarth at nitro dot med.uc.edu
2013-02-08 18:18 ` howarth at nitro dot med.uc.edu
2013-02-11 17:55 ` howarth at nitro dot med.uc.edu
2013-02-11 23:30 ` mrs at gcc dot gnu.org
2013-02-11 23:37 ` mrs at gcc dot gnu.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=bug-55693-4-lt1DqtJ7Pr@http.gcc.gnu.org/bugzilla/ \
    --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).