Menu

#7 Non-relocatable elf object file

closed
nobody
None
5
2009-10-10
2009-09-11
Anonymous
No

The problem appears if I want to use jwasm to compile mixed 16-bit and 32-bit code (e.g. boot loader). Suppose I want to write most of 32-bit code on C and compile it with gcc (elf32 objects). However, I still need to have 16-bit code and I need to compile this as elf32 object. If I compile the attached code, I get:
jwasm -4 -elf file.asm
file.asm : Error A2226: Fixup invalid for ELF: location 1

My understanding it happens because we have 32-bit relocatable offset for ELF and the code requires 16 bit offsets. Is there any way we can workaround this problem or possible create non-relocatable ELF object file? The idea is that we just need to have only 1 object with non-relocatable symbols (16-bit code) and it goes first during the linking process.

It looks like gas and gcc do not have such problem (e.g. look at any boot loader code).

Discussion

  • Nobody/Anonymous

    Example

     
  • Nobody/Anonymous

    Yes, there are some extensions to the ELF format implemented by LD, which make this linker understand 8- and 16-bit relocations. These were missing in JWasm, just added.

    japheth

     
  • japheth

    japheth - 2009-10-10
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.