#2264 stm8 linker crash when debug option specified

closed-fixed
Ben Shi
None
STM8
5
2015-01-21
2014-03-21
teplofizik
No

Linker produce cdb, ihx abut crash.

Commands:

sdcc.exe -c --std-c99 -mstm8     --debug -o"build/" -DSTM8S105 .\source\drivers.c -IC:\Dev\stm8\include -IC:\Dev\stm8\sdcc\include 
sdcc.exe -c --std-c99 -mstm8     --debug -o"build/" -DSTM8S105 .\source\main.c -IC:\Dev\stm8\include -IC:\Dev\stm8\sdcc\include 
sdcc.exe -c --std-c99 -mstm8     --debug -o"build/" -DSTM8S105 .\source\drivers\clock.c -IC:\Dev\stm8\include -IC:\Dev\stm8\sdcc\include 
sdcc.exe -c --std-c99 -mstm8     --debug -o"build/" -DSTM8S105 .\source\drivers\gpio.c -IC:\Dev\stm8\include -IC:\Dev\stm8\sdcc\include 
sdcc.exe -c --std-c99 -mstm8     --debug -o"build/" -DSTM8S105 .\source\drivers\pwm.c -IC:\Dev\stm8\include -IC:\Dev\stm8\sdcc\include

sdcc.exe -mstm8  --debug -o"build/" build\main.rel build\drivers.rel build\clock.rel build\gpio.rel build\pwm.rel C:\Dev\stm8\sdcc\lib\stm8\stm8.lib

Crash! Unhandled exception at address "0x00401aa8" in module "sdld.exe": 0xC0000005: Read of address "0xfffffffc".

SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/h
c08/s08/stm8 3.4.0/rc1/ #8960 (Mar 18 2014) (MINGW32)
published under GNU General Public License (GPL)

Example in attach

1 Attachments

Discussion

  • Ben Shi
    Ben Shi
    2014-08-06

    I change the above attached test case to a *nix version. That e.sh will crash with --debug specified, while r.sh won't do without --debug.

    The reason is due to line 433 - 436 in sdcc/sdas/linksrc/lkmain.c, which should not be executed in stm8 port, since it is for the mcs51 like targets.

     
    Attachments
  • Ben Shi
    Ben Shi
    2014-08-06

    • assigned_to: Ben Shi
     
  • Ben Shi
    Ben Shi
    2014-08-07

    It is fixed in rev9056 by adding an array bound check. However, a formal solution needs a separated sdldstm8 to avoid run that part.

     
  • Ben Shi
    Ben Shi
    2014-08-16

    • status: open --> closed-fixed
     
  • Ben Shi
    Ben Shi
    2014-08-16

    Fixed in rev9059 with a seperated sdldstm8 added.