problems with --out-fmt-elf

  • Caio Hoffman

    Caio Hoffman - 2008-12-17


    I need either to compile or to assemble a program using instructions of HC08, but the binary file need to be a ELF file.
    So, I wrote this program in c:

    int main (void) {
      int a;
      for (a = 0; a < 10; a++) {
      return 0;

    and when I use: ./sdcc -mhc08 --out-fmt-elf teste.c
    I get:
    ?ASxxxx-Error-<o> in line 104 of teste.asm
                  <o> .org in REL area or directive / mnemonic error
    ?ASxxxx-Error-<o> in line 124 of teste.asm
                  <o> .org in REL area or directive / mnemonic error
    removing teste.rel

    the lines which are presenting errors are equal:
    S(null)$main$1 ==.

    Could anyone help me?


    • Frieder Ferlemann


      the lines
      "        S(null)$main$0 ==."
      look like lines that are generated f.e. for the mcs51 port
      when using the option --debug: sdcc --debug teste.c
      (lines used to keep the relation between source lines and the AOMF file).

      Additionally specifying --debug on the command line seems do to the trick:

      (probably --out-fmt-elf should imply --debug)

    • Caio Hoffman

      Caio Hoffman - 2008-12-23

      I did this:
      ./sdcc -mhc08 --out-fmt-elf --debug test.c

      and I got the error below, but I thought I solved the problem.
      I used ./sdcc -mhc08 test.c and I altered the file test.lnk adding the flag -t after the flag -l hc08. Then I typed:
      ./link-hc08 -f test.lnk
      and the linker generated the test.elf, I don't know yet if it works because I'm having other problems with the simulator, but it's a hope.

      Thank you for help me.

      the error which I got:
      *** glibc detected *** ./link-hc08: malloc(): memory corruption: 0x091b3720 ***
      ======= Backtrace: =========                                                  
      ======= Memory map: ========
      00110000-00111000 r-xp 00110000 00:00 0          [vdso]
      0030f000-0031c000 r-xp 00000000 08:02 1368119    /lib/
      0031c000-0031d000 rw-p 0000c000 08:02 1368119    /lib/
      00391000-003b1000 r-xp 00000000 08:02 1368090    /lib/
      003b2000-003b3000 r--p 00020000 08:02 1368090    /lib/
      003b3000-003b4000 rw-p 00021000 08:02 1368090    /lib/
      003b6000-00524000 r-xp 00000000 08:02 1368091    /lib/
      00524000-00526000 r--p 0016e000 08:02 1368091    /lib/
      00526000-00527000 rw-p 00170000 08:02 1368091    /lib/
      00527000-0052a000 rw-p 00527000 00:00 0
      08048000-08057000 r-xp 00000000 08:02 281476     /home/A.Einstein/Desktop/sdcc/bin/link-hc08
      08057000-0805b000 rw-p 0000f000 08:02 281476     /home/A.Einstein/Desktop/sdcc/bin/link-hc08
      0805b000-08061000 rw-p 0805b000 00:00 0
      091b3000-091d4000 rw-p 091b3000 00:00 0          [heap]
      b7d00000-b7d21000 rw-p b7d00000 00:00 0
      b7d21000-b7e00000 ---p b7d21000 00:00 0
      b7eef000-b7ef1000 rw-p b7eef000 00:00 0
      b7f0f000-b7f14000 rw-p b7f0f000 00:00 0
      bfafe000-bfb13000 rw-p bffeb000 00:00 0          [stack]

    • Esko Jaakkola

      Esko Jaakkola - 2009-01-24


      I have similar problem with windows version. When I use this command:

      sdcc -mhc08 --out-fmt-elf --debug MULTILED.C

      whole program will crash. And when I try without --debug switch I will get same error:

      ?ASxxxx-Error-<o> in line 230 of MULTILED.asm
                    <o> .org in REL area or directive / mnemonic error
      ?ASxxxx-Error-<o> in line 803 of MULTILED.asm
                    <o> .org in REL area or directive / mnemonic error
      removing MULTILED.rel

      I couldn't solve problem similar way. Any idea ? Bug in sdcc ?