This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[msp430-elf] Unexpected behavior with -nostdlib


I was playing around a bit with the msp430-elf toolchain and I ran into
some odd behavior which I am not sure if it is intended. I wrote a small
program in assembly [attached] which I am building with the [also
attached] makefiles.

When passing -nostdlib to the linker command, the default/simulator
linker script is used instead of the MCU specific linker script as
specified in the parameter list with the -mmcu flag. This results in all
of the code being eliminated from the program and a .text section of 0
bytes in size [as expected given the --gc-sections].

I am able to override the behavior using the proper -Wl,-T commands to
force the utilization of a linker script, but this seems less than
elegant. I expected the linker to still use the MCU specific linker
script. The documentation is not very clear as to what the expected
behavior should be in this case regarding the usage of linker scripts.

I thought I would ask this here before filing a bug. Thank you.


Attachment: msp430g2553.ld
Description: Text document

Attachment: msp430g2553_symbols.ld
Description: Text document

Attachment: Makefile
Description: Text document

Description: PGP signature

#include <msp430.h>

	.section .text
	.globl timer0_isr
	.type timer0_isr, @function
	xor.b	#0xff, P1OUT

	.globl _start
	.type _start, @function
	mov.w	#__stack, sp

	mov.b	#0xff, &P1DIR
	mov.b	#0x01, &P1OUT

	mov.w	#CCIE, &TACCTL0
	mov.w	#62449, &TACCR0
	mov.w	#(TASSEL1 | MC0 | ID_3), &TACTL

	bis.w	#(CPUOFF | GIE), sr

	.globl main
	.type main, @function
	jmp main

	.section "__interrupt_vector_reset"
.short _start
	.section "__interrupt_vector_timer0_a0"
.short timer0_isr

Attachment: signature.asc
Description: OpenPGP digital signature

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