public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andreas Jaeger <aj@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: John David Anglin <dave@hiauly1.hia.nrc.ca>,
	gcc@gcc.gnu.org, libc-alpha@sources.redhat.com
Subject: Re: Miscompilation of glibc with CVS mainline
Date: Thu, 02 Jan 2003 14:41:00 -0000	[thread overview]
Message-ID: <u81y3vvcq6.fsf@gromit.moeb> (raw)
In-Reply-To: <u865t7vet9.fsf@gromit.moeb> (Andreas Jaeger's message of "Thu, 02 Jan 2003 14:53:06 +0100")

Andreas Jaeger <aj@suse.de> writes:

> Jakub Jelinek <jakub@redhat.com> writes:
>
>> On Thu, Jan 02, 2003 at 02:16:01PM +0100, Andreas Jaeger wrote:
>>> I could reproduce this with a simple hello-world program and also with
>>> some smaller program, it is indeed a bug in handling of weak extern
>>> functions.
>>> 
>>> Here's a small testcase that has the same behaviour:
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> extern void weak_func (void *arg);
>>> asm (".weak weak_func");
>>> 
>>> void
>>> test (void *arg)
>>> {
>>>   if (&weak_func != (void *)0)
>>>     weak_func (arg);
>>>   
>>> }
>>
>> As GCC is not told in any way that weak_func is actually weak, I think
>> it is glibc's fault.
>> Does:
>> #define weak_extern(x) extern __typeof (x) x __attribute__((weak));
>> work ok?
>
> I'm playing now with:
> #    define __pragma_weak(expr) _Pragma(#expr)
> #    define _weak_extern(symbol) __pragma_weak("weak " #symbol)
>
> And this works with my small testcase and I've just started
> recompiling glibc with it.

Unfortunately my solution didn't work out, it gave a number of these
warnings:

In file included from ../sysdeps/generic/abort.c:19:
../linuxthreads/sysdeps/pthread/bits/libc-lock.h:312: warning: ignoring #pragma "weak " 
../linuxthreads/sysdeps/pthread/bits/libc-lock.h:313: warning: ignoring #pragma "weak " 


> I'll try your definition also and let you know about the results,

With your change in, it looked better but I had to disable the alias
for res_init to fix compilation:

res_libc.c:95: error: weak declaration of `__res_init_weak' must precede defininition
make[2]: *** [/builds/glibc/main-gcc3.4/resolv/res_libc.os] Error 1

And add declarations in libc-tsd.h.  With these changes everything
compiled but running the testsuite failed directly:

make[2]: *** [/builds/glibc/main-gcc3.4/iconv/tst-iconv1.out] Error 139

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

  reply	other threads:[~2003-01-02 14:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-01 17:43 John David Anglin
2003-01-02 13:18 ` Andreas Jaeger
2003-01-02 13:27   ` Jakub Jelinek
2003-01-02 13:53     ` Andreas Jaeger
2003-01-02 14:41       ` Andreas Jaeger [this message]
2003-01-02 21:10         ` Andreas Jaeger
2003-01-02 17:38     ` John David Anglin
2003-01-02 17:48       ` "Martin v. Löwis"
2003-01-02 18:52         ` John David Anglin
2003-01-02 18:58           ` Paul Jarc
2003-01-02 19:10             ` Dale Johannesen
2003-01-02 19:16             ` John David Anglin
2003-01-02 19:26               ` Paul Jarc
2003-01-02 20:25                 ` Martin v. Löwis
2003-01-02 22:11               ` Richard Henderson
2003-01-03  1:02                 ` John David Anglin
2003-01-03  1:35                   ` Richard Henderson
2003-01-02 19:42           ` Ulrich Drepper
2003-01-02 22:16             ` Richard Henderson
2003-01-03  0:14             ` Fergus Henderson
  -- strict thread matches above, loose matches on Subject: below --
2003-01-04 18:54 Robert Dewar
2003-01-04 17:52 Robert Dewar
     [not found] <no.id>
2003-01-02 17:48 ` John David Anglin
2003-01-02 17:54   ` Jakub Jelinek
2003-01-02 18:58     ` John David Anglin
2003-01-02 17:57   ` Daniel Jacobowitz
2003-01-01 13:37 Andreas Jaeger

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=u81y3vvcq6.fsf@gromit.moeb \
    --to=aj@suse.de \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=gcc@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=libc-alpha@sources.redhat.com \
    /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).