public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@cygnus.com>
To: jeffdb@goodnet.com
Cc: bfd@cygnus.com, gas2@cygnus.com, cygwin32-developers@cygnus.com
Subject: Re: pei symbols
Date: Tue, 02 Jun 1998 16:49:00 -0000	[thread overview]
Message-ID: <199806022349.TAA12555@subrogation.cygnus.com> (raw)
In-Reply-To: <3557cb83.6685400@smtp.goodnet.com>

   From: jeffdbREMOVETHIS@goodnet.com (Mikey)
   Date: Mon, 11 May 1998 10:04:12 GMT

   Pei function symbols need to have a 20 in

   internal_syment->n_type

   similar to ecoff, anyone know how to get gcc to
   generate the appropriate .def/.endef?

This patch seems to do it in gcc.  I might try to clean it up and get
it into egcs.

Ian

Index: cygwin32.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/i386/cygwin32.h,v
retrieving revision 1.22
diff -u -r1.22 cygwin32.h
--- cygwin32.h	1998/05/08 20:36:53	1.22
+++ cygwin32.h	1998/06/02 23:48:17
@@ -224,6 +224,80 @@
 	     ? "discard" : "same_size");			\
 } while (0)
 
+/* The Microsoft incremental linker requires all functions to be
+   correctly marked with a type of DT_FCN << N_TSHIFT (i.e., 0x20).
+   This macro will emit code to tell the assembler to mark the symbol
+   NAME with the correct type.  */
+#define DECLARE_FUNCTION_TYPE(FILE, NAME, PUBLIC)			\
+  do									\
+    {									\
+      fprintf (FILE, "\t.def\t");					\
+      assemble_name (FILE, NAME);					\
+      fprintf (FILE, ";\t.scl\t%d;\t.type\t0x20;\t.endef\n",		\
+	       (PUBLIC							\
+		? 2    /* C_EXT */					\
+		: 3)); /* C_STAT */					\
+    }									\
+  while (0)
+
+/* Write the extra assembler code needed to declare a function
+   properly.  If we are generating SDB debugging information, this
+   will happen automatically, so we only need to handle other cases.  */
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
+  do									\
+    {									\
+      if (write_symbols != SDB_DEBUG)					\
+	DECLARE_FUNCTION_TYPE (FILE, NAME, TREE_PUBLIC (DECL));		\
+      ASM_OUTPUT_LABEL (FILE, NAME);					\
+    }									\
+  while (0)
+
+/* We also need to declare the type properly for any external
+   function.  We have to save a list of these functions, and run over
+   them at the end of the assembly.  Otherwise, if the function is
+   defined later in the file, we might emit the wrong type when
+   generating SDB debugging information.  */
+
+struct extern_list
+{
+  struct extern_list *next;
+  union tree_node *decl;
+  char *name;
+};
+
+struct extern_list *extern_head;
+
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)				\
+  do									\
+    {									\
+      if (TREE_CODE(DECL) == FUNCTION_DECL)				\
+        {								\
+	  struct extern_list *p;					\
+									\
+	  p = (struct extern_list *) permalloc (sizeof *p);		\
+	  p->next = extern_head;					\
+	  p->decl = DECL;						\
+	  p->name = NAME;						\
+	  extern_head = p;						\
+	}								\
+    }									\
+  while (0)
+
+#define ASM_FILE_END(FILE)						\
+  do									\
+    {									\
+      struct extern_list *p;						\
+									\
+      for (p = extern_head; p != NULL; p = p->next)			\
+	if (! TREE_ASM_WRITTEN (p->decl))				\
+	  DECLARE_FUNCTION_TYPE (FILE, p->name, 1);			\
+    }									\
+  while (0)
+
+/* Also declare the type properly for any external libcall.  */
+#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)				\
+  DECLARE_FUNCTION_TYPE (FILE, XSTR (FUN, 0), 1)
+
 #undef ASM_COMMENT_START
 #define ASM_COMMENT_START " #"
 

  reply	other threads:[~1998-06-02 16:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-11  3:07 Mikey
1998-06-02 16:49 ` Ian Lance Taylor [this message]
1998-06-02 17:15 Christopher Faylor
1998-06-02 19:39 ` Ian Lance Taylor

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=199806022349.TAA12555@subrogation.cygnus.com \
    --to=ian@cygnus.com \
    --cc=bfd@cygnus.com \
    --cc=cygwin32-developers@cygnus.com \
    --cc=gas2@cygnus.com \
    --cc=jeffdb@goodnet.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).