1

Closed

Multiboot0695AssemblyStage Incorrectly Throws LinkerException

description

When executing mosacl with the following parameters:
 
-o Mosa.Kernel.exe --Architecture=x86 -b=mb0.7 --format=ELF32 Mosa.Kernel.dll
 
A LinkerException with message "Load and virtual section alignment must be identical if you are booting non-ELF binaries with a multiboot bootloader" is generated in Multiboot0695AssemblyStage.WriteMultibootHeader()
 
Assuming that the error message is correct, this is a flaw in the code's attempt to check which linker is actually in use. When I break on the exception and take a look, the IAssemblyLinker that is being checked (to determine if Elf32 or Elf64 are in use) is an instance of LinkerFormatSelector , which wraps an underlying true implementation of what in this case is Elf32.
 

Work Around Suggestion

Currently everyone seems to be used to passing parameters to mosacl that make LoadSectionAlignment and VirtualSectionAlignment equal each other, but as you can tell, I've omitted them.
 

Solution Suggestion

Make Multiboot0695AssemblyStage.WriteMultibootHeader() aware of the underlying linker implementation's type. This can be done with the addition of a public property to LinkerFormatSelector and an 'if' check in Multiboot0695AssemblyStage.WriteMultibootHeader(), but I don't want to pollute the meticulous architecture without feedback first.
Closed Aug 22, 2009 at 4:03 AM by illuminus86

comments

wrote Aug 22, 2009 at 4:03 AM

Resolved with changeset 58318.

wrote Feb 13, 2013 at 7:45 PM

wrote May 16, 2013 at 1:11 AM