This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Handle weak symbols
OK, now I understand the problem, and I agree that there's a bug
here. That's one step. :-) By the way, you left out the rtlanal.c
patch in your original posting, but I can imagine it. :-)
I don't fully understand what you're proposing from this:
- is_on_pragma_weak_list() walking the (usually short) #pragma weak list
- add_pragma_weak() called from the #pragma handling
- is_on_assembled_weak_list() called from the assemble_* functions and
weak_finish()
- add_weak() called from the assemble_* functions
but, it's probably sensible enough, or we can come up with something
else that works. I can certainly see how we can do this efficiently.
Thanks for the test-case. Unfortunately, on x86-linux I seem to get
code with a test in it when I compile with -O2:
atexit:
pushl %ebp
movl $__dso_handle, %eax
movl %esp, %ebp
subl $12, %esp
xorl %edx, %edx
testl %eax, %eax
je .L4
movl __dso_handle, %edx
.L4:
pushl %edx
movl 8(%ebp), %eax
pushl $0
pushl %eax
call __cxa_atexit
movl %ebp, %esp
popl %ebp
ret
I'd really like a test-case that actually manifests the bug, even
though I can understand why it would exist. Did I do something
wrong?
In any case, you say:
> - Or, are development versions of glibc using some new construct
> that old ones didn't? If so, why?
It was introduced recently.
Is there another way that glibc could do its job without using this
construct? That would allow us not to put these changes into GCC 3.0.
At this point, we're trying to avoid everything we can. If this is
only a development version -- as opposed to released version -- of
glibc, I'd rather see glibc work around the bug.
And then I think we should fix the bug for 3.1.
Thanks again,
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com