gcc compilation errors: error adding symbol: file in wrong format

Asked 2 years ago, Updated 2 years ago, 128 views

Compiling in Ubuntu 16.04, gcc 5.4.0 environment results in an error.

execution commands:

gcc-T link.ls-March i486-m32-o haribote.hrb bootpack.chankaku.caskfunc.o-lc

error messages:

 libgcc_s.o:error adding symbol:file in wrong format

You can also remove -T link.ls to successfully compile.

The linker scripts are as follows:

OUTPUT_FORMAT("binary");
    
SECTIONS
{
    .head0x0:{
        LONG (0x64*1024) / * 0: stack + .data + heap size (multiple of 4KB) * /
        LONG (0x69726148)/*4: Signature "Hari"*/
        LONG(0)/*8: mmarea size (multiple of 4KB)*/
        LONG (0x310000)/*12: Stack initial value & .data transfer destination */
        LONG(SIZEOF (.data))/*16: .data Size*/
        LONG(LOADADDR(.data))/*20: File Location in Initial Value Column */
        LONG (0xE9000000) / * 24:0xE9000000*/
        LONG(main-0x20)/*28: Entry Address - 0x20*/
        LONG(0)/*32—Heap region (malloc region) start address */
    }

    .text: {*(.text)}

    .data0x310000:AT(ADDR(.text)+SIZEOF(.text){
        * (.data)
        * (.rodata*)
        * (.bss)
    }

    /DISCARD /: {*(.eh_frame)}

}

linux c ubuntu gcc

2022-09-30 16:21

1 Answers

If you should have put libgcc but got cannot find-libgcc, you may not have a symbolic link.

I found a blog with countermeasures, so please refer to it.

Make causes library to get in trouble with /usr/lib/ld:cannot find


2022-09-30 16:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.