I want to compile the code below. If I choose '-bin' everything is ok. But when I choose elf (I want to link with some other objects), I got the following error messages:
ELF:
file.asm(1) : Error A2121: Symbol not defined : DGROUP
Using .MODEL TINY creates group DGROUP. If you want to avoid this, remove the .MODEL directive and use full segment directives:
.486
_TEXT16 segment WORD use16 public 'CODE'
ORG 7C00h
start:
add ax, WORD PTR
SomeData DD 0
ORG 7C00h+200h
_TEXT16 ends
END start
However, the ORG 7C00h tells me that you want some "bootloader" code. I doubt that ELF is the best format then. It might be better to use BIN and include the resulting binary data into the other object with directive INCBIN.
japheth
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
However, still the question is: why the compiled elf object is broken? I use latest 2.0 version. During compilation I am warned that GNU extensions for 8/16 bit relocations are used. But the resulting object is broken. Midnight commander says it has a "corrupted header" and ld doesn't want to link it with anything.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just tried to link your sample with LD. It tells:
TEST.ASM:(_TEXT16+0x7c03): relocation truncated to fit: R_386_16
IIRC this warning is ok and to be ignored.
I also tried to view the elf-header with a tool (htwin32), and this tool indeed doesn't know the 16-bit relocation used. But besides this issue there is no problem reported.
japheth
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I want to compile the code below. If I choose '-bin' everything is ok. But when I choose elf (I want to link with some other objects), I got the following error messages:
ELF:
file.asm(1) : Error A2121: Symbol not defined : DGROUP
ELF64:
file.asm(1) : Warning A4114: Multiple .MODEL directives, .MODEL ignored
.MODEL TINY
.CODE
.486
ORG 7C00h
start:
add ax, WORD PTR
SomeData DD 0
ORG 7C00h+200h
END start
If I use FLAT model this disappers. However, I still have a problem after compilation:
**file.o: file not recognized: File format not recognize**
Using .MODEL TINY creates group DGROUP. If you want to avoid this, remove the .MODEL directive and use full segment directives:
.486
_TEXT16 segment WORD use16 public 'CODE'
ORG 7C00h
start:
add ax, WORD PTR
SomeData DD 0
ORG 7C00h+200h
_TEXT16 ends
END start
However, the ORG 7C00h tells me that you want some "bootloader" code. I doubt that ELF is the best format then. It might be better to use BIN and include the resulting binary data into the other object with directive INCBIN.
japheth
Thank you, japheth.
However, still the question is: why the compiled elf object is broken? I use latest 2.0 version. During compilation I am warned that GNU extensions for 8/16 bit relocations are used. But the resulting object is broken. Midnight commander says it has a "corrupted header" and ld doesn't want to link it with anything.
I just tried to link your sample with LD. It tells:
TEST.ASM:(_TEXT16+0x7c03): relocation truncated to fit: R_386_16
IIRC this warning is ok and to be ignored.
I also tried to view the elf-header with a tool (htwin32), and this tool indeed doesn't know the 16-bit relocation used. But besides this issue there is no problem reported.
japheth
Japheth,
I posted source and object files and more complete description here:
http://sourceforge.net/tracker/?func=detail&aid=2868994&group_id=255677&atid=1126895
Thanks.