Advertisement

Link ASM object (aout) in AR archive? [GNU DJGPP] [NASM]

Started by May 25, 2014 04:04 AM
-1 comments, last by Thoover 10 years, 6 months ago

I hope I placed this in the right topic as AR and LD are "Tools" rolleyes.gif .

First note I realize my build script should be a MakeFile, but it's a cmd script.

Second note I have attempted to search Google, this Forum, and OSDEV but the keywords here are way to vague and only 2 letters so all results I saw did not relate to my situation.

Ok, I have currently one ASM file containing all the assembly code I need; but, while rewriting parts of the project I decided I want to break this one ASM file into about 6.

Let me dump some of the build script here before I get into my question...:


...

@ECHO IDT.C
gcc %GCC_OPTIONS% ./OBJ/IDT.O ./DRIVERSRC/SYSTEM/CPU/IDT.c
@ECHO IRQ.ASM
nasm -f aout ./DRIVERSRC/SYSTEM/CPU/IRQ.ASM ./OBJ/IRQA.O
@ECHO IRQ.C
gcc %GCC_OPTIONS% ./OBJ/IRQ.O ./DRIVERSRC/SYSTEM/CPU/IRQ.c

...

ar rvs ./DRIVER/sys.a ./OBJ/8259.O ./OBJ/GDT.O ./OBJ/IDT.O ./OBJ/IRQA.O ./OBJ/IRQ.O ./OBJ/TSS.O ./OBJ/FAT12.O
ar rvs ./DRIVER/sys.a ./OBJ/VFS.O ./OBJ/PAGEDIR.O ./OBJ/PAGEFAULT.O ./OBJ/PAGETABLE.O ./OBJ/PHYSICAL.O
ar rvs ./DRIVER/sys.a ./OBJ/VIRTUAL.O
@ECHO START.ASM
nasm -f aout ./KERNELSRC/START.ASM -o ./OBJ/START.O
@ECHO MAIN.C
gcc %GCC_OPTIONS% ./OBJ/MAIN.O ./KERNELSRC/MAIN.c
@ECHO COMMAND.C
gcc %GCC_OPTIONS% ./OBJ/COMMAND.O ./KERNELSRC/COMMAND.c
@ECHO LINKING KERNEL.BIN
LD -T %LD_SCRIPT% -o %OUTPUT_FILE% ./OBJ/START.O ./OBJ/MAIN.O ./OBJ/COMMAND.O ./LIB/lib.a ./DRIVER/sys.a ./DRIVER/hw.a

...

As you can see above my only ASM file "START.ASM" is compiled format AOUT and placed in directly with the LD command - this works fine.

But when I split this source file into the appropriate sections I run into one of two problems:

1. Add to the archive - Error returned "./DRIVER/sys.a: could not read symbols: File truncated"

2. Add files to LD command - LD becomes too long and the system cannot process it.

The reason I oppose a MakeFile so much is I am constantly rebuilding / testing and a simple BATCH loop with a menu is great - plus I haven't sat down to find out how one is constructed...huh.png

So, anyways, my question is - Is there a way to archive ASM and C objects in the same library, or is there an all-together better way of doing this?

This topic is closed to new replies.

Advertisement