public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@cygnus.com>
To: arnej@pvv.unit.no
Cc: gas2@cygnus.com
Subject: Re: .gas.warning sections
Date: Mon, 04 Dec 1995 08:25:00 -0000	[thread overview]
Message-ID: <199512041625.LAA20339@sanguine.cygnus.com> (raw)
In-Reply-To: <9512022057.AA11248@datter.pvv.unit.no>

   From: "Arne H. Juul" <arnej@pvv.unit.no>
   Date: Sat, 2 Dec 1995 21:57:49 +0100

   #define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME) \
   do {                                                            \
     extern FILE *asm_out_text_file;                               \
     if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)              \
       fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
     else if ((DECL) && TREE_READONLY (DECL))                      \
       fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME));     \
     else                                                          \
       fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME));    \
   } while (0)

   This is probably really an assembler question:  Is all this stuff really
   necessary, and what does the extra @progbits mean?

Yes, all that stuff is really necessary.  I'm not sure why you say the
@progbits is extra.  It means that the section contains data that
forms part of the program image; by way of comparison, a DWARF
debugging section contains data, but it is not part of the program
image.  This ASM_OUTPUT_SECTION_NAME macro is very similar to the one
in config/svr4.h, except that it uses asm_out_text_file instead of F
when selecting the section for a function declaration.  This is
required for the way the MIPS backend handles global pointer
optimizations.

   Stuffing this
   code into netbsd.h as well seemed to work ok, but then I looked a bit
   further, and while svr4.h has a somewhat simple version of this,
   h8300/h8300.h has something more like what I had imagined:
   #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
     fprintf (FILE, "\t.section %s\n", NAME)

It's definitely best to tell the assembler the flags and type to give
the section.  It never hurts, and sometimes it is required.  You also
need to keep the asm_out_text_file distinction in order for functions
to be put in the right place.

   However, if I change my test file to have *only* the warning section
   for null1 (not the function definition itself), I get the following
   behaviour:

   gcc: Internal compiler error: program ld got fatal signal 6

This is a linker bug.  Here's the patch.

Ian

Index: elflink.h
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elflink.h,v
retrieving revision 1.21
diff -u -r1.21 elflink.h
--- elflink.h	1995/12/01 19:47:51	1.21
+++ elflink.h	1995/12/04 16:14:12
@@ -2508,6 +2508,12 @@
 
     case bfd_link_hash_indirect:
     case bfd_link_hash_warning:
+      /* We can't represent these symbols in ELF.  A warning symbol
+         may have come from a .gnu.warning.SYMBOL section anyhow.  We
+         just put the target symbol in the hash table.  If the target
+         symbol does not really exist, don't do anything.  */
+      if (h->root.u.i.link->type == bfd_link_hash_new)
+	return true;
       return (elf_link_output_extsym
 	      ((struct elf_link_hash_entry *) h->root.u.i.link, data));
     }


      parent reply	other threads:[~1995-12-04  8:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-12-02 12:57 Arne H. Juul
1995-12-02 13:49 ` Roland McGrath
1995-12-04  8:25 ` Ian Lance Taylor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199512041625.LAA20339@sanguine.cygnus.com \
    --to=ian@cygnus.com \
    --cc=arnej@pvv.unit.no \
    --cc=gas2@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).