`.note.gnu.property' referenced in section `.text' of defined in discarded section `.note.gnu.property'

Viewed 190

I have the files port.cpp and port.h.

The code isn't relevant for this question. The problem, I believe, is the linker script.

The linker script contains the following code:

ENTRY(loader)
OUTPUT_FORMAT(elf32-i386)
OUTPUT_ARCH(i386:i386)

SECTIONS
{
    . = 0x0100000;

    .text :
    {
        *(.multiboot)
        *(.text*)
        *(.rodata)
    }

    .data :
    {
        start_ctors = .;
        KEEP(*( .init_array ));
        KEEP(*(SORT_BY_INIT_PRIORITY( .init_array.* )));
        end_ctors = .;

        *(.data)
    }

    .bss :
    {
        *(.bss)
    }
    
    /DISCARD/ : 
    {
        *(.fini_array*)
        *(.comment)
    }   
}

And when I run ld with the only flag being -melf_i386 I get this error:

`.note.gnu.property' referenced in section `.text' of port.o: defined in discarded section `.note.gnu.property' of port.o

I believe the problem is the linker, but even after reading ld documentation, looking at the assembly code being generated and adding KEEP(*( .note.gnu.property )); I could not fix it.

0 Answers
Related