This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: link_warning fix
- From: Bruno Haible <haible at ilog dot fr>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Mon, 1 Jul 2002 13:10:22 +0200 (CEST)
- Subject: Re: link_warning fix
- References: <15612.44195.299251.921969@honolulu.ilog.fr><1024534343.22171.133.camel@myware.mynet><15633.37033.949106.871865@honolulu.ilog.fr><1024589313.20279.165.camel@myware.mynet>
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