Rockbox

Tasklist

FS#12014 - LD complained about duplicate symbols(missing "extern")

Attached to Project: Rockbox
Opened by Huan Zhang (victorzhang) - Wednesday, 16 March 2011, 17:28 GMT
Last edited by Nils Wallménius (nls) - Saturday, 19 March 2011, 10:16 GMT
Task Type Patches
Category Operating System/Drivers
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

@rockbox/apps/codecs/libmusepack/requant.h,line 50
@rockbox/apps/plugins/fft/const.h, line 1-10
@rockbox/apps/plugins/goban/display.h, line 41, line 44
@rockbox/apps/plugins/rockboy/rockmacros.h, line 100
Since the keyword "extern" is omitted from the header file, global varibles will have multiple definition.This will cause link error(duplicate symbols),especially for some new version of LD. Generally speaking, if a global variable is going to be used in more than 2 files, it’s better to declare it in the header file(use "extern"), and have ONLY ONE definition in .c file.

This task depends upon

Closed by  Nils Wallménius (nls)
Saturday, 19 March 2011, 10:16 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed, thanks. I'm still curious why only the mips toolchain cares about this.
Comment by Huan Zhang (victorzhang) - Thursday, 17 March 2011, 04:56 GMT
This patch applys to:
rockbox/apps/codecs/libmusepack/requant.h, revision 25056
rockbox/apps/plugins/fft/const.h, revision 26100
rockbox/apps/plugins/goban/display.h, revision 28712
rockbox/apps/plugins/rockboy/rockmacros.h, revision 28664
rockbox/apps/plugins/rockboy/cpu.c, revision 25844
Comment by Nils Wallménius (nls) - Thursday, 17 March 2011, 16:57 GMT
This same source builds fine for coldfire with gcc 4.5.2 and i see no reason for this to be cpu dependant so what options are you using to compile?
Comment by Huan Zhang (victorzhang) - Friday, 18 March 2011, 05:37 GMT
I built this source with mips-sde-elf-gcc 4.5.1 and gnu binary utilities 2.20.51. I think this problem was caused by ld, not gcc. I used default compile options, except that I compiled source with a new toolchain. New version of ld may be more strict with duplicate symbols. Strictly speaking, “extern” is indeed missing in those header file.

Loading...