egcs-1.1 doesnt handle weak symbols on SCO V5.0.4 /ELF
Eric Dumazet
dumazet@cosmosbay.com
Fri Sep 11 20:33:00 GMT 1998
Robert,
I'm sorry, I did my very last test on the wrong stage? directory.
In fact the proposed path WAS working.
I didn't found the disk space to do a full bootstrap / test suite, but I
managed to compile my ISAM library.
For gcc2.7.2, I think I've done something like that some years ago.
Thanks,
Eric
>
> > 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
>
More information about the Gcc
mailing list