Page 1 of 3
Text Truncated
Posted: Mon Dec 30, 2002 9:23 pm
by jrfritz
If I set my -Ttext=0x10000 or over, LD truncates my external asm module that I linked with my C++ kernel...(I get a error message)
Why?/How can I fix this?
Re:Text Truncated
Posted: Tue Dec 31, 2002 6:12 am
by pskyboy
Thats odd, can i see the batch file, make file or commands you use for constructing your kernel image.
Peter
Re:Text Truncated
Posted: Tue Dec 31, 2002 6:19 am
by jrfritz
I use a linker script now...and I use Linux...I use SH files...not batch files...
Here:
OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
.text 0x100000 : {
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}
.data : {
data = .; _data = .; __data = .;
*(.data)
. = ALIGN(4096);
}
.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
}
Also..I link my files like this:
nasm -f aout kernelasm.asm -o kernelasm.o
ld -T link.ld kernel32.o kernelasm.o -o tempbin -e 0x0
Re:Text Truncated
Posted: Tue Dec 31, 2002 6:30 am
by pskyboy
I don't know if this will solve the Truncation problem but you should remove the -e0x0 bit as this is set in your linker file as ENTRY(start). This bit should be a function exported from another ASM file like i have it as a stub i stick on to the front of my C Kernel.
Peter
Re:Text Truncated
Posted: Tue Dec 31, 2002 7:07 am
by jrfritz
This is what I found on google:
NASM won't mix 16- and 32-bit code in the same ELF or COFF
file. Use aout format instead (nasm -o foo.o -f aout foo.asm)
The DJGPP linker does understand aout format. If you do this,
no data object can be at an offset > 0xFFFF, or you will get
this linker error:
x.o(.text+0x13): relocation truncated to fit: 16 text
How do I make NASM create 32-bit NASM object code? ( My linker supports A.OUT )
Re:Text Truncated
Posted: Tue Dec 31, 2002 7:11 am
by pskyboy
have you got 16bit and 32bit code in the same file if not as long as you have put.
[BITS 32]
It should assemble as 32bit code
Peter
Re:Text Truncated
Posted: Tue Dec 31, 2002 7:12 am
by jrfritz
I have no bits 16...only [bits 32]
Re:Text Truncated
Posted: Tue Dec 31, 2002 7:54 am
by pskyboy
Thats very odd it sounds like it should work to me. I do exactly the same output to aout format and tehn use thdjgpp linker
Peter
Re:Text Truncated
Posted: Tue Dec 31, 2002 1:50 pm
by df
whats the ' -e 0x0' for if you specify a linker address in the script?
Re:Text Truncated
Posted: Tue Dec 31, 2002 1:56 pm
by jrfritz
I didn't know to take that out.
Re:Text Truncated
Posted: Tue Dec 31, 2002 6:30 pm
by jrfritz
[attachment deleted by admin]
Re:Text Truncated
Posted: Wed Jan 01, 2003 3:45 am
by df
try setting -e to 0x100000 or to the start routine, etc. so if its your bootsector youd need uh -e 0x7c00 or whatever. or try -e start
Re:Text Truncated
Posted: Wed Jan 01, 2003 6:59 am
by pskyboy
[attachment deleted by admin]
Re:Text Truncated
Posted: Wed Jan 01, 2003 7:09 am
by pskyboy
Re:Text Truncated
Posted: Wed Jan 01, 2003 7:21 am
by jrfritz
Ok...ty
That's why I use .NET server! MS Finaly Made A Stable OS!