This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/30007] libgfortran doesn't build for sh-elf
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jan 2007 18:49:31 -0000
- Subject: [Bug libfortran/30007] libgfortran doesn't build for sh-elf
- References: <bug-30007-5394@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from fxcoudert at gcc dot gnu dot org 2007-01-18 18:49 -------
(In reply to comment #5)
> __USER_LABEL_PREFIX__ should be a string already.
>
> so you just need:
> extern void bar (void);
> extern __typeof(bar) bar __asm__(__USER_LABEL_PREFIX__ "foo");
> void bar (void) { ; }
> extern __typeof(bar) gee __attribute__((__alias__("foo")));
That one gives: c.c:2: error: expected string literal before ?_?
__USER_LABEL_PREFIX__ is a string in the compiler config macros. For user code,
the macro expands to the underscore itself.
Actually, the problem with libgfortran is that it uses __USER_LABEL_PREFIX__
already, but it uses it for both __asm__ and __attribute__((__alias__(...))),
which is wrong. I'm testing the following patch, but I should really test it on
a machine that has a non-empty __USER_LABEL_PREFIX__. Any idea?
Index: libgfortran.h
===================================================================
--- libgfortran.h (revision 120891)
+++ libgfortran.h (working copy)
@@ -126,10 +126,10 @@
# define export_proto(x) sym_rename(x, PREFIX(x))
# define export_proto_np(x) extern char swallow_semicolon
# define iexport_proto(x) internal_proto(x)
-# define iexport(x) iexport1(x, __USER_LABEL_PREFIX__, IPREFIX(x))
-# define iexport1(x,p,y) iexport2(x,p,y)
-# define iexport2(x,p,y) \
- extern __typeof(x) PREFIX(x) __attribute__((__alias__(#p #y)))
+# define iexport(x) iexport1(x, IPREFIX(x))
+# define iexport1(x,y) iexport2(x,y)
+# define iexport2(x,y) \
+ extern __typeof(x) PREFIX(x) __attribute__((__alias__(#y)))
/* ??? We're not currently building a dll, and it's wrong to add dllexport
to objects going into a static library archive. */
#elif 0 && defined(HAVE_ATTRIBUTE_DLLEXPORT)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30007