libgcc_s.so: Error adding symbols: File in wrong format

Viewed 4002

When using GCC like gcc -march i486 -m32 -e Harimain -o bootpack.hrb bootpack.c hankaku.c naskfunc.o, the compiler worked well. But when I add -T link.ls it told me:

libgcc_s.so:Error adding symbols:File in wrong format

I am creating 32bit binary on 64bit PC. This is my linker script:

OUTPUT_FORMAT("binary");
SECTIONS
{
    .head 0x0 : {
        LONG(0x64 * 1024)  /*  0 : stack+.data+heap の大きさ(4KBの倍数) */
        LONG(0x69726148)      /*  4 : シグネチャ "Hari" */
        LONG(0)               /*  8 : mmarea の大きさ(4KBの倍数) */
        LONG(0x310000)        /* 12 : スタック初期値&.data転送先 */
        LONG(SIZEOF(.data))   /* 16 : .dataサイズ */
        LONG(LOADADDR(.data)) /* 20 : .dataの初期値列のファイル位置 */
        LONG(0xE9000000)      /* 24 : 0xE9000000 */
        LONG(main - 0x20) /* 28 : エントリアドレス - 0x20 */
        LONG(0)               /* 32 : heap領域(malloc領域)開始アドレス */
}
   .text : { *(.text) }
   .data 0x310000 : AT ( ADDR(.text) + SIZEOF(.text) ) {
        *(.data)
        *(.rodata*)
        *(.bss)
}   /DISCARD/ : { *(.eh_frame) }
}

The OS is Ubuntu 16.04 64-bit and GCC version is 5.4.0.

What is the problem, and how do I fix it?

1 Answers
Related