Text Truncated

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
jrfritz

Text Truncated

Post 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?
pskyboy

Re:Text Truncated

Post by pskyboy »

Thats odd, can i see the batch file, make file or commands you use for constructing your kernel image.

Peter
jrfritz

Re:Text Truncated

Post 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
pskyboy

Re:Text Truncated

Post 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
jrfritz

Re:Text Truncated

Post 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 )
pskyboy

Re:Text Truncated

Post 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
jrfritz

Re:Text Truncated

Post by jrfritz »

I have no bits 16...only [bits 32]
pskyboy

Re:Text Truncated

Post 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
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Text Truncated

Post by df »

whats the ' -e 0x0' for if you specify a linker address in the script?
-- Stu --
jrfritz

Re:Text Truncated

Post by jrfritz »

I didn't know to take that out.
jrfritz

Re:Text Truncated

Post by jrfritz »

[attachment deleted by admin]
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Text Truncated

Post 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
-- Stu --
pskyboy

Re:Text Truncated

Post by pskyboy »

[attachment deleted by admin]
pskyboy

Re:Text Truncated

Post by pskyboy »

jrfritz

Re:Text Truncated

Post by jrfritz »

Ok...ty

That's why I use .NET server! MS Finaly Made A Stable OS!
Post Reply