I get the following error when the PIC libraries are built as part of the SDCC build using latest gputils revision (r1312):
'/usr/local/bin/gplib' -c libc18f.a iscntrl.o isdigit.o isgraph.o islower.o isprint.o ispunct.o isspace.o isupper.o isxdigit.o delay100ktcy.o delay100tcy.o delay10ktcy.o delay10tcy.o delay1ktcy.o delay1mtcy.o fprintf.o printf.o printf_small.o printf_tiny.o putchar.o sprintf.o streams.o strmgpsim.o strmmssp.o strmputchar.o strmusart.o vfprintf.o vprintf.o vsprintf.o atof.o atoi.o atol.o calloc.o crc16.o free.o g_ftoa.o itoa.o ltoa.o malloc.o memfree.o memfreemax.o memmisc.o rand.o realloc.o x_ftoa.o memccpy.o memchr.o memchrpgm.o memchrram.o memcmp.o memcpy.o memcpypgm2ram.o memcpyram2ram.o memmove.o memrchr.o memset.o strcat.o strchr.o strcmp.o strcpy.o strcspn.o strlen.o strlwr.o strncat.o strncmp.o strncpy.o strpbrk.o strrchr.o strspn.o strstr.o strtok.o strupr.o cnvfrac.o cnvint.o cvtdec.o error: Duplicate symbol "digits" defined in "g_ftoa.o" and "cvtdec.o". error: Duplicate symbol "cvt_dec_word" defined in "g_ftoa.o" and "cvtdec.o".
For example, cvtdec.S defines "digits" and g_ftoa.S uses it as an "extern" but it doesn't define it again. So it looks like a gputils bug? After testing different gputils revisions, I think it happened at r1312.
Please let me know if you need more info.
For the record, found while working on the pic16 regression tests for SDCC (https://sourceforge.net/p/sdcc/mailman/message/36107467/).
Thanks,
Diego
Anonymous
Thanks for the bug reports. Later I will have time to deal with it.
Károly
This clearly is. When I changed r1311-> r1312 I fixed a bug, and this fix caused this newer bug.
Rather I should need a partner in the project.
I got bitten by similar as well. It appears that the extern directive, if it is after udata or code, now defines the symbol. For manual assembler code not such a big issue - just moving all externs to the top of file helps - but still an inconvenience.
See attached minimal test case.
gpasm -c test.asm; gplink -o test.hex test.o -c
should fail with undefined symbol, but it compiles. When udata and extern are swapped, error is signalled correctly._do_extern
callsset_global
that was changed in 1312. Attached one-line patch apparently fixes the immediate issue for me (sets section to UNDEFINED for extern symbols), but I know nothing about context of the call, so...There also appears to be another case where you can get duplicated labels - when you do two externs for same symbol. Mpasm is happy with that. The code tries to handle that, but fails, as the symbol->Type is never set, so it cannot match. Test case and suggested one-line patch attached.
And FWIW, note that the distributed gputils-ext/example/example2 fails, too:
All of those are actually GLOBAL in one file, and EXTERNAL in the other that it complains about.
And yes, the patch shown up there does fix this case.
Last edit: Hans-Bernhard Broeker 2018-10-20
Has this been fixed? I've been running a locally patched version (using Tomas Zellerin's patch above) on Gentoo but recently tried building on a Fedora machine and got hit by this bug again.
It has not been fixed. The patches are still necessary with the current HEAD, r1319.
This appears to have been fixed in release v1.5.2
I think it's fine now because of another fix.
Károly