This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: egcs-1.1 doesnt handle weak symbols on SCO V5.0.4 / ELF


> I successfully build egcs-1.1 --with-gnu-as --with-gnu-ld on
> SCO V5.0.4.

Welcome.

GNU as and ld have limited support on OpenServer.   But I don't think
that's your problem.

> I have one litle problem : weak symbols are silently ignored :

Thanx for the sample syntax.   

> #pragma weak isread = _isread
> int _isread(int fd, char *buffer, int mode)
> {
> ...
> }
> 
> The SCO Compiler handles this kind of construct quite well.
> I also have gcc-2.7.2 on this platform and it is OK.

Remember that the FSF 2.7.2 didn't support OpenServer at all, so it's
normally important to mention exactly what 2.7.x derivitave you're
using when discussing it. (i.e. one of Kean's, one of mine, or a home
brew.) In this case, it doesn't matter.

> I tried some changes in gcc/config/i386/sco5.h
> 
> #define SUPPORTS_WEAK   TARGET_ELF                           
> #define ASM_WEAKEN_LABEL(FILE,NAME) \
>   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME);
> \                    fputc ('\n', FILE); } while (0)
> 
> But I don't have any results. I must be very stupid at this moment.

Your patch should have worked.

On OpenServer, weak is supported in both COFF and ELF.  (Hint: this is
one of the reasons that GNU ld is a little dicey on OSR5.)  So there
is no reason to limit SUPPORTS_WEAK in this way.  The definition in
defaults.h is just fine.

Apply this patch and rebuild at least varasm.o and c-pragma.o.   My 
quick testing shows that this now works.

(robertl) rjlhome:/play/negcs/gcc
$ ./xgcc -B./ -S /tmp/x.c
$ tail -5 x.s
        ret
        .size    _isread,.-_isread
        .weak   isread
                .set    isread,_isread
        .ident  "GCC: (GNU) egcs-2.92.04 19980910 (gcc2 ss-980609 experimental)"
$ ./xgcc -B./ -c /tmp/x.c
$ nm x.o | grep WEAK
[7]     |         0|       7|FUNC |WEAK |0    |1      |isread


If this actually works in your application let me know and I'll commit
this.  You get a chance to earn bonus points for telling me that a full
bootstrap still works and there are no regressions in any of the normal
or COFF testsuites.  If you don't tell me this, then I'll probably just
check it in anyway and wait for my next testrun.





Index: sco5.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/sco5.h,v
retrieving revision 1.16
diff -u -p -r1.16 sco5.h
--- sco5.h	1998/07/13 22:38:49	1.16
+++ sco5.h	1998/09/11 01:26:24
@@ -731,6 +731,10 @@ dtors_section ()							\
 #undef HANDLE_SYSV_PRAGMA
 #define HANDLE_SYSV_PRAGMA 1
 
+#define ASM_WEAKEN_LABEL(FILE,NAME) \
+  do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME);		\
+	fputc ('\n', FILE); } while (0)
+
 #undef SCCS_DIRECTIVE
 #define SCCS_DIRECTIVE 1
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]