Linking..
Posted: Thu Sep 26, 2002 3:43 pm
Ok, i have a shell script to link a C and ASM file together, that's all wel, but it links/compiles incorrectly, either way, my script is like so:
---
#!/bin/csh
nasm -f elf $1.s -o obj/$1_a.o
if ( $? != 0 ) then
echo NASM: Error!
exit 1
endif
gcc -ffreestanding -static -c $1.c -o obj/$1_c.o
if ( $? != 0 ) then
echo GCC: Error!
exit 1
endif
ld -o obj/$1 -static -Ttext 0x600-e 0x0 obj/$1_a.o obj/$1_c.o
if ( $? != 0 ) then
echo LD: Error!
exit 1
endif
trimbin obj/$1 obj/$1.sect #trim elf out of binary
sectbin obj/$1.sect $2 #make binary confom to sectors, 512, 1024..
exit 0
---
now.. i linked a file with it (a variation on it without the ASM parts), and it reports a 4 kb file size (and the precompiled binary was like 72 bytes...) what the heck!? thanks in advance, if i get any help
---
#!/bin/csh
nasm -f elf $1.s -o obj/$1_a.o
if ( $? != 0 ) then
echo NASM: Error!
exit 1
endif
gcc -ffreestanding -static -c $1.c -o obj/$1_c.o
if ( $? != 0 ) then
echo GCC: Error!
exit 1
endif
ld -o obj/$1 -static -Ttext 0x600-e 0x0 obj/$1_a.o obj/$1_c.o
if ( $? != 0 ) then
echo LD: Error!
exit 1
endif
trimbin obj/$1 obj/$1.sect #trim elf out of binary
sectbin obj/$1.sect $2 #make binary confom to sectors, 512, 1024..
exit 0
---
now.. i linked a file with it (a variation on it without the ASM parts), and it reports a 4 kb file size (and the precompiled binary was like 72 bytes...) what the heck!? thanks in advance, if i get any help