link_warning fix
Bruno Haible
haible@ilog.fr
Mon Jul 1 04:16:00 GMT 2002
Ulrich Drepper writes:
> But if this is exactly what is wanted in some place. We alrady have
> enough weird things in gcc. Maybe at some point something comes up
> where #NO_APP is necessary.
Here is an updated patch.
2002-06-25 Bruno Haible <bruno@clisp.org>
* include/libc-symbols.h (__as_app_line, __as_noapp): New macros.
(link_warning): Emit #APP line to turn comment recognition on, and
turn it off afterwards.
--- glibc-2.2.5/include/libc-symbols.h.bak 2001-08-04 01:02:52.000000000 +0200
+++ glibc-2.2.5/include/libc-symbols.h 2002-06-25 11:00:48.000000000 +0200
@@ -207,18 +207,34 @@
# define __make_section_unallocated(section_string)
# endif
-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
- section attributes on what looks like a comment to the assembler. */
+/* Tacking on "\n\t#" to the section name makes gcc put its bogus
+ section attributes on what looks like a comment to the assembler.
+ Furthermore, with gas, we need to add a "#APP" line so the comment
+ is recognized as such. Afterwards, we turn off #APP again, through
+ an empty asm (for which gcc emits "#APP" followed by "#NO_APP"). */
+# ifdef HAVE_GNU_AS
+# define __as_app_line "#APP\n"
+# define __as_noapp __asm__ ("");
+# else
+# define __as_app_line ""
+# define __as_noapp
+# endif
# ifdef HAVE_SECTION_QUOTES
# define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." #symbol) \
- static const char __evoke_link_warning_##symbol[] \
- __attribute__ ((section (".gnu.warning." #symbol "\"\n\t#\""))) = msg;
+ static const char __evoke_link_warning_##symbol[] \
+ __attribute__ \
+ ((section (".gnu.warning." #symbol "\"\n" __as_app_line "\t#\""))) \
+ = msg; \
+ __as_noapp
# else
# define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." #symbol) \
- static const char __evoke_link_warning_##symbol[] \
- __attribute__ ((section (".gnu.warning." #symbol "\n\t#"))) = msg;
+ static const char __evoke_link_warning_##symbol[] \
+ __attribute__ \
+ ((section (".gnu.warning." #symbol "\n" __as_app_line "\t#"))) \
+ = msg; \
+ __as_noapp
# endif
# else /* Not ELF: a.out */
# ifdef HAVE_XCOFF
More information about the Libc-alpha
mailing list