Page 1 of 1
Linker Syntax Error
Posted: Fri Apr 01, 2022 10:15 am
by Mehmetdev1
Hello, I'm getting Linker Syntax Error on Line 21. What is the solution for the error I will write the code here?
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_PRIOTRY( .init_array.* )));
end_ctors = .;
*(.data)
}
.bss :
{
*(.bss)
}
/DISCARD/ :
}
*(.fini_array*)
*(.comment)
}
}
Re: Linker Syntax Error
Posted: Sat Apr 02, 2022 10:22 pm
by klange
Please try to use the [code] markup when posting code snippets.
You have a typo that I suspect is the source of the issue: SORT_BY_INIT_PRIOTRY should be SORT_BY_INIT_PRIORITY
Re: Linker Syntax Error
Posted: Sun Apr 03, 2022 7:00 am
by Mehmetdev1
Code: Select all
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)
}
}
Yes, This Solved My Code Error On Line 21, But Now Line 33 Has The Same Linker Error. I'm Posting the Screenshot.
Re: Linker Syntax Error
Posted: Sun Apr 03, 2022 3:46 pm
by klange
On the line after "/DISCARD/ :" you have a closing curly brace } when you want an opening one {
I would have thought binutils ld would print better messages than just "syntax error" and I wonder if something is wrong with your language configuration since it looks like you're using Turkish? Before you fix the above issue, can you try putting LANG=C before your make command? I want to see if this produces more useful output.