The reason why you are getting the error "ld: cannot perform PE operations on non PE output file 'loader.bin'" is because the output format that you are using for your linker (ld) is not compatible with the output file type that you are trying to generate (binary).
In your command, you are using the option "--oformat binary" which instructs the linker to generate a binary output file format, but you are also specifying the option "-m i386pe" which instructs the linker to generate a PE (Portable Executable) output file format. These two options are incompatible and cannot be used together.
To fix the issue, you need to use an output file format that is compatible with the output file type that you want to generate. For example, if you want to generate a binary output file format, you can use the option "--oformat elf64-x86-64" instead of "--oformat binary" which will generate an ELF (Executable and Linkable Format) output file format that is compatible with the binary output file type.
Here's the modified command that you can use:
ld -o loader.bin -m elf_x86_64 -Ttext 0x1000 loader_entry.o loader.o --oformat elf64-x86-64
This should generate a binary output file format that you can use for your project.
AvalonAccess Login