delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/01/28/14:02:49

From: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Message-Id: <199801281902.AA036784139@typhoon.rose.hp.com>
Subject: Re: GAS problems with libgcc1-test.c (fwd)
To: robert DOT hoehne AT gmx DOT net
Date: Wed, 28 Jan 1998 11:02:19 PST
Cc: djgpp-workers AT delorie DOT com
Reply-To: andrewc AT rosemail DOT rose DOT hp DOT com

Here is the latest about the problem I have with pgcc and libgcc1-test.
I still think there may be a problem with the SDB output macros in 
regular gcc sources (I will mail to gcc2 soon),  but Ian provides a
patch (below) for gas (I haven't tried it yet) which he thinks should 
fix things.    

Andy

My message to gcc.utils and ians reply follows .... I wasn't sure if patch
could handle diffs with '>' in front of the lines so I manually removed
them.

> 
>    From: "Andrew Crabtree" <andrewc AT rosemail DOT rose DOT hp DOT com>
>    Date: Mon, 26 Jan 1998 10:28:59 -0800
> 
>    Hello - the following code from libgcc1-test.c can cause gas to choke under
>    certain situations.
> 
>    --------------------------------------------------------------
>    extern void start() __asm__("start");
>    extern void _start() __asm__("_start");
>    extern void __start() __asm__("__start");
> 
>    void start() {}
>    void _start() {}
>    void __start() {}
>    ----------------------------------------------------------------
> 
>    If I do not use specify debugging information I have no problems compiling
>    or assembling it, if I
>    use STABS debugging I have no problems.  But, if I use coff debugging
>    information gas aborts with
> 
>    C:\temp>gcc -c start.s
>    start.s: Assembler messages:
>    start.s:39: Fatal error: Symbol __start already defined.
> 
>    This happens with both binutils 2.7 and 2.8.1 (configured for i386-DJGPP).
>    Here is a copy of an assembly file that fails, and one that works.  The only
>    difference between the two is the presence of a .p2align directive.  Why
>    this would make a difference is beyond me.
> 
> I think I worked this out.  I think the appended patch to
> gas/config/obj-coff.h is the right way to fix the problem.
> 
> Ian
> 
Index: config/obj-coff.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/config/obj-coff.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- obj-coff.h	1998/01/27 13:33:47	1.66
+++ obj-coff.h	1998/01/28 18:49:01	1.67
@@ -795,6 +795,18 @@
 
 #endif /* not BFD_ASSEMBLER */
 
+/* In COFF, if a symbol is defined using .def/.val SYM/.endef, it's OK
+   to redefine the symbol later on.  This can happen if C symbols use
+   a prefix, and a symbol is defined both with and without the prefix,
+   as in start/_start/__start in gcc/libgcc1-test.c.  */
+#define RESOLVE_SYMBOL_REDEFINITION(sym)		\
+(SF_GET_GET_SEGMENT (sym)				\
+ ? (sym->sy_frag = frag_now,				\
+    S_SET_VALUE (sym, frag_now_fix ()),			\
+    S_SET_SEGMENT (sym, now_seg),			\
+    0)							\
+ : 0)
+
 /* Stabs in a coff file go into their own section.  */
 #define SEPARATE_STAB_SECTIONS 1
 





- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019