[MSP430-elf] Linking issue

Orlando Arias orlandoarias@gmail.com
Mon Sep 28 21:25:00 GMT 2015


Greetings,

Passed the option to LD, attached is the output. You are indeed correct
that collect2 is receiving the linker script twice:

COLLECT_GCC_OPTIONS='-v' '-o' 'blink.elf' '-mmcu=msp430f2013'
'-mmcu=msp430f2013' '-fdata-sections' '-ffunction-sections'
'-specs=nosys.specs'
 /usr/lib/gcc/msp430-elf/5.2.0/collect2 -plugin
/usr/lib/gcc/msp430-elf/5.2.0/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/msp430-elf/5.2.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/cckFVMn4.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lcrt
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lnosys
--sysroot=/usr/msp430-elf -o blink.elf
/usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib/430/crt0.o
/usr/lib/gcc/msp430-elf/5.2.0/430/crtbegin.o
-L/usr/lib/gcc/msp430-elf/5.2.0/430
-L/usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib/430
-L/usr/msp430-elf/lib/430 -L/usr/msp430-elf/usr/lib/430
-L/usr/lib/gcc/msp430-elf/5.2.0
-L/usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib
-L/usr/msp430-elf/lib -L/usr/msp430-elf/usr/lib main.o -lgcc
--start-group -lc -lgcc -lcrt --end-group --script=msp430f2013.ld
--script=msp430f2013.ld -lgcc --start-group -lgcc -lc -lnosys
--end-group /usr/lib/gcc/msp430-elf/5.2.0/430/crtend.o
/usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib/430/crtn.o -lgcc

However, I do not know if it is due to nosys.specs:
$ cat /usr/msp430-elf/lib/nosys.specs
%rename link_gcc_c_sequence                nosys_link_gcc_c_sequence

*nosys_libgloss:
-lnosys

*nosys_libc:
%{!specs=nano.specs:-lc} %{specs=nano.specs:-lc_nano}

*link_gcc_c_sequence:
%(nosys_link_gcc_c_sequence) --start-group %G %(nosys_libc)
%(nosys_libgloss) --end-group

[The first line caused conflicts with the redefinition in an older
version of the toolchain, by the way.]

I am not even sure why the linker is receiving the mmcu parameter twice.
Thank you for helping me look into this.

Cheers, Orlando.

On 09/28/2015 05:04 PM, DJ Delorie wrote:
> Add "-v" to LD= to find out exactly what command line gcc is using to
> invoke the linker; you might find that it's including the *.ld file
> twice (possibly due to nosys.specs?).
> 
-------------- next part --------------
msp430-elf-gcc -v -o blink.elf main.o -mmcu=msp430f2013 -fdata-sections -ffunction-sections -mmcu=msp430f2013 -fdata-sections -ffunction-sections --specs=nosys.specs 
Using built-in specs.
Reading specs from /usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib/nosys.specs
rename spec link_gcc_c_sequence to nosys_link_gcc_c_sequence
COLLECT_GCC=msp430-elf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/msp430-elf/5.2.0/lto-wrapper
Target: msp430-elf
Configured with: ../configure --prefix=/usr --program-prefix=msp430-elf- --target=msp430-elf --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --disable-shared --disable-nls --disable-threads --enable-languages=c,c++ --enable-multilib --with-system-zlib --with-local-prefix=/usr/msp430-elf --with-sysroot=/usr/msp430-elf --with-as=/usr/bin/msp430-elf-as --with-ld=/usr/bin/msp430-elf-ld --disable-libgomp --enable-interwork --enable-addons
Thread model: single
gcc version 5.2.0 (GCC) 
COMPILER_PATH=/usr/lib/gcc/msp430-elf/5.2.0/:/usr/lib/gcc/msp430-elf/:/usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/bin/
LIBRARY_PATH=/usr/lib/gcc/msp430-elf/5.2.0/430/:/usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib/430/:/usr/msp430-elf/lib/430/:/usr/msp430-elf/usr/lib/430/:/usr/lib/gcc/msp430-elf/5.2.0/:/usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib/:/usr/msp430-elf/lib/:/usr/msp430-elf/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'blink.elf' '-mmcu=msp430f2013' '-mmcu=msp430f2013' '-fdata-sections' '-ffunction-sections' '-specs=nosys.specs'
 /usr/lib/gcc/msp430-elf/5.2.0/collect2 -plugin /usr/lib/gcc/msp430-elf/5.2.0/liblto_plugin.so -plugin-opt=/usr/lib/gcc/msp430-elf/5.2.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccgeplOy.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lcrt -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lnosys --sysroot=/usr/msp430-elf -o blink.elf /usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib/430/crt0.o /usr/lib/gcc/msp430-elf/5.2.0/430/crtbegin.o -L/usr/lib/gcc/msp430-elf/5.2.0/430 -L/usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib/430 -L/usr/msp430-elf/lib/430 -L/usr/msp430-elf/usr/lib/430 -L/usr/lib/gcc/msp430-elf/5.2.0 -L/usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib -L/usr/msp430-elf/lib -L/usr/msp430-elf/usr/lib main.o -lgcc --start-group -lc -lgcc -lcrt --end-group --script=msp430f2013.ld --script=msp430f2013.ld -lgcc --start-group -lgcc -lc -lnosys --end-group /usr/lib/gcc/msp430-elf/5.2.0/430/crtend.o /usr/lib/gcc/msp430-elf/5.2.0/../../../../msp430-elf/lib/430/crtn.o -lgcc
/usr/bin/msp430-elf-ld:msp430f2013.ld:41: warning: redeclaration of memory region `SFR'
/usr/bin/msp430-elf-ld:msp430f2013.ld:42: warning: redeclaration of memory region `PERIPHERAL_8BIT'
/usr/bin/msp430-elf-ld:msp430f2013.ld:43: warning: redeclaration of memory region `PERIPHERAL_16BIT'
/usr/bin/msp430-elf-ld:msp430f2013.ld:44: warning: redeclaration of memory region `RAM'
/usr/bin/msp430-elf-ld:msp430f2013.ld:45: warning: redeclaration of memory region `INFOMEM'
/usr/bin/msp430-elf-ld:msp430f2013.ld:46: warning: redeclaration of memory region `INFOA'
/usr/bin/msp430-elf-ld:msp430f2013.ld:47: warning: redeclaration of memory region `INFOB'
/usr/bin/msp430-elf-ld:msp430f2013.ld:48: warning: redeclaration of memory region `INFOC'
/usr/bin/msp430-elf-ld:msp430f2013.ld:49: warning: redeclaration of memory region `INFOD'
/usr/bin/msp430-elf-ld:msp430f2013.ld:50: warning: redeclaration of memory region `ROM'
/usr/bin/msp430-elf-ld:msp430f2013.ld:51: warning: redeclaration of memory region `VECT1'
/usr/bin/msp430-elf-ld:msp430f2013.ld:52: warning: redeclaration of memory region `VECT2'
/usr/bin/msp430-elf-ld:msp430f2013.ld:53: warning: redeclaration of memory region `VECT3'
/usr/bin/msp430-elf-ld:msp430f2013.ld:54: warning: redeclaration of memory region `VECT4'
/usr/bin/msp430-elf-ld:msp430f2013.ld:55: warning: redeclaration of memory region `VECT5'
/usr/bin/msp430-elf-ld:msp430f2013.ld:56: warning: redeclaration of memory region `VECT6'
/usr/bin/msp430-elf-ld:msp430f2013.ld:57: warning: redeclaration of memory region `VECT7'
/usr/bin/msp430-elf-ld:msp430f2013.ld:58: warning: redeclaration of memory region `VECT8'
/usr/bin/msp430-elf-ld:msp430f2013.ld:59: warning: redeclaration of memory region `VECT9'
/usr/bin/msp430-elf-ld:msp430f2013.ld:60: warning: redeclaration of memory region `VECT10'
/usr/bin/msp430-elf-ld:msp430f2013.ld:61: warning: redeclaration of memory region `VECT11'
/usr/bin/msp430-elf-ld:msp430f2013.ld:62: warning: redeclaration of memory region `VECT12'
/usr/bin/msp430-elf-ld:msp430f2013.ld:63: warning: redeclaration of memory region `VECT13'
/usr/bin/msp430-elf-ld:msp430f2013.ld:64: warning: redeclaration of memory region `VECT14'
/usr/bin/msp430-elf-ld:msp430f2013.ld:65: warning: redeclaration of memory region `VECT15'
/usr/bin/msp430-elf-ld:msp430f2013.ld:66: warning: redeclaration of memory region `RESETVEC'
   text	   data	    bss	    dec	    hex	filename
    586	     24	     18	    628	    274	blink.elf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20150928/91c2e2b3/attachment.sig>


More information about the Binutils mailing list