This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.


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

Re: global vars and symbol visibility for mips32/elf


Ruediger Helsch <rh@unifix.de> writes:
>But the standard allows such behaviour only if no strictly 
>standard-conforming program is broken by the extension.  The following
>program is strictly conforming and should continue to run:
>
>	#include <assert.h>
>	int optind[30000], optarg[30000];
>
>	main()
>	{
>		int i;
>		for (i = 0; i < 30000; i++) {
>			optind[i] = 1;
>			optarg[i] = 2;
>		}
>
>		for (i = 0; i < 30000; i++) {
>			assert(optind[i] == 1);
>			assert(optarg[i] == 2);
>		}
>		return 0;
>	}
>
>Try this to see whether your compiler conforms to the C standard!
>
FWIW - gcc-2.7.2 (using /usr/ccs/bin/ld) , Solaris 2.5 

gcc     x.c   -o x
ld: warning: symbol `optind' has differing sizes:
	(file /var/tmp/cca006vl1.o value=0x1d4c0; file /usr/lib/libc.so value=0x4);
	/usr/lib/libc.so definition taken
ld: warning: symbol `optarg' has differing sizes:
	(file /var/tmp/cca006vl1.o value=0x1d4c0; file /usr/lib/libc.so value=0x4);
	/usr/lib/libc.so definition taken
pluto 5% x
Segmentation Fault (core dumped)

Identical results with SunPro cc ...