PATCH: Fix DWARF2 section lossage

Jakub Jelinek jakub@redhat.com
Wed Apr 25 14:46:00 GMT 2001


On Wed, Apr 25, 2001 at 01:32:15PM -0700, Richard Henderson wrote:
> On Wed, Apr 25, 2001 at 01:16:39PM -0700, Mark Mitchell wrote:
> > Is simply looking for `.debug_*' and then emitting `.section x' good
> > enough?
> 
> I wouldn't think so.  This would affect __attribute__((section)) as well.
> Perhaps enumerating all of the known sections would be ok, but I certainly
> don't like it.
> 
> What I'd really like to see is 
> 
> enum section_flags
> {
>   SECT_EXECUTABLE = 1,
>   SECT_WRITABLE = 2,
>   SECT_LOADED = 4,
>   SECT_SHORT = 8,
>   SECT_COMDAT = 16,
> };

We should then IMHO extend __attribute__((section)) syntax so that the
programmer could specify that as well (say __attribute__((section("awx")))
). The letters could be borrowed say from ELF .section command and for other
targets the ASM_OUTPUT_* macros would just map that manually to
corresponding syntax. __attribute__((section(""))) could mean just keep the
section attributes which have been given already.
With this, linux kernel could get rid of tons of warnings and glibc could
kill ugly workarounds:
/* 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.  */
#  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;
#  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;
#  endif

	Jakub



More information about the Gcc-patches mailing list