Menu

#248 Segmentation fault generating COFF file

closed
None
5
2012-08-12
2012-07-02
No

Hi Scott,

Just wanted to try out generation of COFF files, and with the luck I'm having over the last few days, gpasm generated a Segmentation fault... gputils is version 0.14.2. This is the message and backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x000000000041a37c in _gp_coffgen_write_reloc (object=0x6e8170, numerrors=<value optimized="" out="">)
at gpwriteobj.c:170
170 gp_fputl32(current->symbol->number, fp);
(gdb) bt

0 0x000000000041a37c in _gp_coffgen_write_reloc (object=0x6e8170, numerrors=<value optimized="" out="">)

at gpwriteobj.c:170

1 gp_write_coff (object=0x6e8170, numerrors=<value optimized="" out="">) at gpwriteobj.c:426

2 0x000000000040a846 in coff_close_file () at coff.c:241

3 0x0000000000401fd8 in assemble () at gpasm.c:462

4 0x00007ffff7a3caa5 in __libc_start_main () from /lib64/libc.so.6

5 0x0000000000401559 in _start () at ../sysdeps/x86_64/elf/start.S:113

(gdb) list
165 gp_reloc_type *current = section->relocations;
166
167 while (current != NULL) {
168
169 gp_fputl32(current->address, fp);
170 gp_fputl32(current->symbol->number, fp);
171 gp_fputl16(current->offset, fp);
172 gp_fputl16(current->type, fp);
173
174 current = current->next;

This is the first time it enters this section of the program. I added a breakpoint:

(gdb) p current
$1 = (gp_reloc_type ) 0x6fa340
(gdb) p current->symbol->number
Cannot access memory at address 0x40
(gdb) p current->symbol
$2 = (struct gp_symbol_type
) 0x0
(gdb)

Discussion

  • Borut Ražem

    Borut Ražem - 2012-07-02

    Can you please attach the asm file which reproduces the problem an the command line used to assemble the source?

    Borut

     
  • John Coppens

    John Coppens - 2012-07-02

    Test file causes segfault: gpasm -c boot87xa.asm

     
  • John Coppens

    John Coppens - 2012-07-02

    Hi Borut,

    Attached a (very) simplified source file which still causes the same segmentation fault.
    Hope this helps.

     
  • John Coppens

    John Coppens - 2012-07-07

    Apparently here is the problem:

                __CONFIG        _CP_OFF & _XT_OSC & _PWRTE_ON & _LVP_OFF & _WDT_OFF
                processor       p16f873a
    

    causes segmentation fault,

                processor       p16f873a
                __CONFIG        _CP_OFF & _XT_OSC & _PWRTE_ON & _LVP_OFF & _WDT_OFF
    

    works fine.

    A segmentation error should not happen in any instance, so maybe a detection for this
    problem could be included?

     
  • Borut Ražem

    Borut Ražem - 2012-07-09

    Bug fixed in svn revision #731.

    Borut

     

Anonymous
Anonymous

Add attachments
Cancel