This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
#pragma weak is broken in 3.1, partail fix
- From: Marc Espie <espie at nerim dot net>
- To: rth at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 21 May 2002 16:57:08 +0200
- Subject: #pragma weak is broken in 3.1, partail fix
- Reply-to: espie at nerim dot net
Looking at the ChangeLog, I'm afraid rth might be the culprit.
If I use
#pragma f=_f
I always get "alias arg not a string"
after fixing this error with:
*** c-pragma.c.orig Tue May 21 08:28:15 2002
--- c-pragma.c Tue May 21 08:31:01 2002
*************** apply_pragma_weak (decl, value)
*** 285,291 ****
{
if (value)
decl_attributes (&decl, build_tree_list (get_identifier ("alias"),
! build_tree_list (NULL, value)),
0);
if (SUPPORTS_WEAK && DECL_EXTERNAL (decl) && TREE_USED (decl)
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
--- 285,291 ----
{
if (value)
decl_attributes (&decl, build_tree_list (get_identifier ("alias"),
! build_tree_list (NULL, build_string(IDENTIFIER_LENGTH(value), IDENTIFIER_POINTER(value)))),
0);
if (SUPPORTS_WEAK && DECL_EXTERNAL (decl) && TREE_USED (decl)
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
I either get no weak declaration in the
assembly output if there is no other def of the function, or
t.c:1: weak declaration of `f' must precede definition
if f is declared.
Both the following snippets show the same problem:
void f();
#pragma weak f=_f
void f() __attribute__ ((weak, alias("_f")));
#pragma weak f=_f
This looks like an issue where the emitted declaration somehow does not
get merged with the normal declaration or something.
What's missing yet ?