Trel725 / chavrprog

AVR programmer based on Chinese ch341a
GNU General Public License v3.0
58 stars 19 forks source link

Fix global variables for GCC 10 #12

Closed sodaplayer closed 3 years ago

sodaplayer commented 3 years ago

Hey there! I was getting build errors like:

/usr/bin/ld: /tmp/ccLarY3u.o:(.rodata+0x0): multiple definition of `confset'; /tmp/ccC14b8u.o:(.rodata+0x0): first defined here
/usr/bin/ld: /tmp/ccLarY3u.o:(.bss+0x0): multiple definition of `data_buffer'; /tmp/ccC14b8u.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccLarY3u.o:(.bss+0x8): multiple definition of `spi_data'; /tmp/ccC14b8u.o:(.bss+0x8): first defined here
/usr/bin/ld: /tmp/ccLarY3u.o:(.bss+0xc): multiple definition of `device_sign'; /tmp/ccC14b8u.o:(.bss+0xc): first defined here
/usr/bin/ld: /tmp/ccLarY3u.o:(.bss+0x10): multiple definition of `cfg_pagesize'; /tmp/ccC14b8u.o:(.bss+0x10): first defined here
/usr/bin/ld: /tmp/ccLarY3u.o:(.bss+0x14): multiple definition of `cfg_num_of_pages'; /tmp/ccC14b8u.o:(.bss+0x14): first defined here
/usr/bin/ld: /tmp/ccLarY3u.o:(.bss+0x18): multiple definition of `cfg_eeprom'; /tmp/ccC14b8u.o:(.bss+0x18): first defined here
/usr/bin/ld: /tmp/ccLarY3u.o:(.bss+0x1c): multiple definition of `cfg_pageshift'; /tmp/ccC14b8u.o:(.bss+0x1c): first defined here
/usr/bin/ld: /tmp/ccLarY3u.o:(.bss+0x20): multiple definition of `cfg_pagemask'; /tmp/ccC14b8u.o:(.bss+0x20): first defined here
/usr/bin/ld: /tmp/ccLarY3u.o:(.bss+0x24): multiple definition of `cfg_pagemsq'; /tmp/ccC14b8u.o:(.bss+0x24): first defined here
/usr/bin/ld: /tmp/cc8LMP1v.o:(.data.rel.ro.local+0x0): multiple definition of `confset'; /tmp/ccC14b8u.o:(.rodata+0x0): first defined here
collect2: error: ld returned 1 exit status

It looks like GCC10 changed some defaults, so I added externs to the global variables.

Trel725 commented 3 years ago

Dear sodaplayer,

Thank you for fixing that! I was not aware about changes in the new GCC. Merging your PR.