#1295 hc08: sdcc linker SIGABRT at current svn


in using the option


current sdcc svn quits with a SIGABRT

1. sample
#define MAX_DB_NUM 0xF0
#define IDX 0x2C
#define IDX2 0x2E

data char dummy_bytes[MAX_DB_NUM];
xdata unsigned int i;

void main( void )
for ( i = 0; i < MAX_DB_NUM; i++){
dummy_bytes[i] = (char) i;
dummy_bytes[IDX2] = dummy_bytes[IDX];

2. sdcc command
sdcc --stack-loc 0x044F --data-loc 0x0050 --xram-loc 0x0100 --no-peep -I. -mhc08 --out-fmt-s19 --verbose -V --debug -c main_s.c

followed by the linker command

sdcc --stack-loc 0x044F --data-loc 0x0050 --xram-loc 0x0100 --no-peep -I. -mhc08 --out-fmt-s19 --verbose -V --debug -o ldhx_bug.s19 main_s.rel

3. sdcc -v
SDCC : hc08 2.6.4 #4638 (Feb 21 2007) (UNIX)

(yesterdays svn snapshot, no noticable modifications seen until then)

as everytime, sdcc compiled from source with everything
disabled but hc08 with
--disable-mcs51-port --disable-gbz80-port
--disable-z80-port --disable-avr-port
--disable-ds390-port --disable-pic-port
--disable-xa51-port --disable-ds400-port
--disable-ucsim --disable-pic16-port

Current stable release 2.6.0 succeeds compile the example!

4. error

sdcc: Calling linker...
sdcc: ../support/Util/NewAlloc.c:229: Safe_strdup: Assertion `sz' failed.
Caught signal 6: SIGABRT
make: *** [prog] Error 1

5. email


  • kosmonaut_pirx

    kosmonaut_pirx - 2007-03-03

    Logged In: YES
    Originator: YES

    followed this by myself a while:

    in revision 4521, the file SDCCmain.c receives the following update:

    /* pdata/xstack segment start. If zero, the linker
    1561 chooses the best place for them */
    1562 if (options.xstack_loc)
    1563 {
    1564 WRITE_SEG_LOC (PDATA_NAME, options.xstack_loc);
    1565 }

    as xstack-loc is set automatically, if xdata-loc is set (line 1461 in the same file) this case is true while using the xram-option. however, in the hc08-port there's no PDATA, the port struct for this declares it consequently NULL.

    the macro is defined with
    #define WRITE_SEG_LOC(N, L) \ segName = Safe_strdup(N); \

    which is a call to NewAlloc.c in support/Util. there an assertion is made to make sure, the given string name (for duplication) is not NULL. of course this fails for the hc08 port, as explained above.

    it is unknown to me, for what pdata is good for. due to this no patch. a suggestion would be to first look, if a memory section is defined in the port. according to this, linker options should be set. a quick hack would be to exclude the hc08 port from this.

    bye kosmo

  • Maarten Brock

    Maarten Brock - 2007-03-03

    Logged In: YES
    Originator: NO

    Thanks Joerg,

    This helped a lot and thus the quick fix in SDCC 2.6.4 #4662.


  • Maarten Brock

    Maarten Brock - 2007-03-03
    • labels: --> C-Front End
    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open --> closed-fixed

Log in to post a comment.