Extremely illogical unresolved references [SOLVED]
Posted: Thu Dec 29, 2011 9:23 am
Hi, again. So I've been following Bran's tutorial. I can never get the GDT, IDT, ISR and IRQ bits to link. Ever. Not even after downloading the complete source (bkerndev.zip) and trying to compile it.
When I don't modify anything, ie (OUTPUT_FORMAT is binary, nasm compiles to aout), GRUB refuses to read my file, (error 13). When I modify OUTPUT_FORMAT to elf32-i386 and nasm -f elf, ld complains about all the calls from C>ASM, but not the other way around. I have used -fleading-underscore, adding the necessary '_'s, and fno-leading-underscore, removing those '_'s, but to no avail.
Objdump -t on the problem files (gdt.o, idt.o, isrs.o, irq.o and start.o) seriously makes this illogical. The symbol tables all include things like irq0 etc, but neither of them have underscores, anywhere. all the names match, I seriously don't understand what is going on.
Ubuntu 10.04LTS, standard NASM, GCC and LD. I don't see how the lack of a cross compiler will solve this.
Output below.
(Some things like "Assembling... Linking... etc are part of my script. The following is the output of ELF output, in both nasm and ld, with fno-leading-underscore in gcc.)
Build.sh
Objdump -t start.o
Objdump -t isrs.o
Objdump -t irq.o
When I don't modify anything, ie (OUTPUT_FORMAT is binary, nasm compiles to aout), GRUB refuses to read my file, (error 13). When I modify OUTPUT_FORMAT to elf32-i386 and nasm -f elf, ld complains about all the calls from C>ASM, but not the other way around. I have used -fleading-underscore, adding the necessary '_'s, and fno-leading-underscore, removing those '_'s, but to no avail.
Objdump -t on the problem files (gdt.o, idt.o, isrs.o, irq.o and start.o) seriously makes this illogical. The symbol tables all include things like irq0 etc, but neither of them have underscores, anywhere. all the names match, I seriously don't understand what is going on.
Ubuntu 10.04LTS, standard NASM, GCC and LD. I don't see how the lack of a cross compiler will solve this.
Output below.
(Some things like "Assembling... Linking... etc are part of my script. The following is the output of ELF output, in both nasm and ld, with fno-leading-underscore in gcc.)
Build.sh
Code: Select all
Clearing old files...
Assembling...
Compiling...
Linking...
ld: warning: cannot find entry symbol start; defaulting to 0000000000100000
gdt.o: In function `gdt_install':
gdt.c:(.text+0x10e): undefined reference to `gdt_flush'
idt.o: In function `idt_install':
idt.c:(.text+0x64): undefined reference to `idt_load'
isrs.o: In function `isrs_install':
isrs.c:(.text+0x48): undefined reference to `isr0'
isrs.c:(.text+0x6c): undefined reference to `isr1'
isrs.c:(.text+0x90): undefined reference to `isr2'
isrs.c:(.text+0xb4): undefined reference to `isr3'
isrs.c:(.text+0xd8): undefined reference to `isr4'
isrs.c:(.text+0xfc): undefined reference to `isr5'
isrs.c:(.text+0x120): undefined reference to `isr6'
isrs.c:(.text+0x144): undefined reference to `isr7'
isrs.c:(.text+0x168): undefined reference to `isr8'
isrs.c:(.text+0x18c): undefined reference to `isr9'
isrs.c:(.text+0x1b0): undefined reference to `isr10'
isrs.c:(.text+0x1d4): undefined reference to `isr11'
isrs.c:(.text+0x1f8): undefined reference to `isr12'
isrs.c:(.text+0x21c): undefined reference to `isr13'
isrs.c:(.text+0x240): undefined reference to `isr14'
isrs.c:(.text+0x264): undefined reference to `isr15'
isrs.c:(.text+0x288): undefined reference to `isr16'
isrs.c:(.text+0x2ac): undefined reference to `isr17'
isrs.c:(.text+0x2d0): undefined reference to `isr18'
isrs.c:(.text+0x2f4): undefined reference to `isr19'
isrs.c:(.text+0x318): undefined reference to `isr20'
isrs.c:(.text+0x33c): undefined reference to `isr21'
isrs.c:(.text+0x360): undefined reference to `isr22'
isrs.c:(.text+0x384): undefined reference to `isr23'
isrs.c:(.text+0x3a8): undefined reference to `isr24'
isrs.c:(.text+0x3cc): undefined reference to `isr25'
isrs.c:(.text+0x3f0): undefined reference to `isr26'
isrs.c:(.text+0x414): undefined reference to `isr27'
isrs.c:(.text+0x438): undefined reference to `isr28'
isrs.c:(.text+0x45c): undefined reference to `isr29'
isrs.c:(.text+0x480): undefined reference to `isr30'
isrs.c:(.text+0x4a4): undefined reference to `isr31'
irq.o: In function `irq_install':
irq.c:(.text+0x159): undefined reference to `irq0'
irq.c:(.text+0x17d): undefined reference to `irq1'
irq.c:(.text+0x1a1): undefined reference to `irq2'
irq.c:(.text+0x1c5): undefined reference to `irq3'
irq.c:(.text+0x1e9): undefined reference to `irq4'
irq.c:(.text+0x20d): undefined reference to `irq5'
irq.c:(.text+0x231): undefined reference to `irq6'
irq.c:(.text+0x255): undefined reference to `irq7'
irq.c:(.text+0x279): undefined reference to `irq8'
irq.c:(.text+0x29d): undefined reference to `irq9'
irq.c:(.text+0x2c1): undefined reference to `irq10'
irq.c:(.text+0x2e5): undefined reference to `irq11'
irq.c:(.text+0x309): undefined reference to `irq12'
irq.c:(.text+0x32d): undefined reference to `irq13'
irq.c:(.text+0x351): undefined reference to `irq14'
irq.c:(.text+0x375): undefined reference to `irq15'
Writing kernel to floppy image...
Missing kernel.bin!
Aborting...
Objdump -t start.o
Code: Select all
start.o: file format elf32-i386
SYMBOL TABLE:
00000000 l df *ABS* 00000000 start.asm
00000000 l d .bss 00000000 .bss
00000000 l d .text 00000000 .text
00000000 l *UND* 00000000 mboot
00000001 l *ABS* 00000000 MULTIBOOT_PAGE_ALIGN
00000002 l *ABS* 00000000 MULTIBOOT_MEMORY_INFO
00010000 l *ABS* 00000000 MULTIBOOT_AOUT_KLUDGE
1badb002 l *ABS* 00000000 MULTIBOOT_HEADER_MAGIC
00010003 l *ABS* 00000000 MULTIBOOT_HEADER_FLAGS
e4514ffb l *ABS* 00000000 MULTIBOOT_CHECKSUM
00000000 l *UND* 00000000 stublet
00000000 l *UND* 00000000 flush2
00000000 l *UND* 00000000 isr_common_stub
00000000 l *UND* 00000000 irq_common_stub
00002000 l .bss 00000000 sys_stack
00000000 *UND* 00000000 code
00000000 *UND* 00000000 bss
00000000 *UND* 00000000 end
00000000 *UND* 00000000 main
00000000 *UND* 00000000 gp
00000000 *UND* 00000000 idtp
00000000 *UND* 00000000 fault_handler
00000000 *UND* 00000000 irq_handler
00000000 *UND* 00000000 start
00000000 *UND* 00000000 gdt_flush
00000000 *UND* 00000000 idt_load
00000000 *UND* 00000000 isr0
00000000 *UND* 00000000 isr1
00000000 *UND* 00000000 isr2
00000000 *UND* 00000000 isr3
00000000 *UND* 00000000 isr4
00000000 *UND* 00000000 isr5
00000000 *UND* 00000000 isr6
00000000 *UND* 00000000 isr7
00000000 *UND* 00000000 isr8
00000000 *UND* 00000000 isr9
00000000 *UND* 00000000 isr10
00000000 *UND* 00000000 isr11
00000000 *UND* 00000000 isr12
00000000 *UND* 00000000 isr13
00000000 *UND* 00000000 isr14
00000000 *UND* 00000000 isr15
00000000 *UND* 00000000 isr16
00000000 *UND* 00000000 isr17
00000000 *UND* 00000000 isr18
00000000 *UND* 00000000 isr19
00000000 *UND* 00000000 isr20
00000000 *UND* 00000000 isr21
00000000 *UND* 00000000 isr22
00000000 *UND* 00000000 isr23
00000000 *UND* 00000000 isr24
00000000 *UND* 00000000 isr25
00000000 *UND* 00000000 isr26
00000000 *UND* 00000000 isr27
00000000 *UND* 00000000 isr28
00000000 *UND* 00000000 isr29
00000000 *UND* 00000000 isr30
00000000 *UND* 00000000 isr31
00000000 *UND* 00000000 irq0
00000000 *UND* 00000000 irq1
00000000 *UND* 00000000 irq2
00000000 *UND* 00000000 irq3
00000000 *UND* 00000000 irq4
00000000 *UND* 00000000 irq5
00000000 *UND* 00000000 irq6
00000000 *UND* 00000000 irq7
00000000 *UND* 00000000 irq8
00000000 *UND* 00000000 irq9
00000000 *UND* 00000000 irq10
00000000 *UND* 00000000 irq11
00000000 *UND* 00000000 irq12
00000000 *UND* 00000000 irq13
00000000 *UND* 00000000 irq14
00000000 *UND* 00000000 irq15
Objdump -t isrs.o
Code: Select all
isrs.o: file format elf32-i386
SYMBOL TABLE:
00000000 l df *ABS* 00000000 isrs.c
00000000 l d .text 00000000 .text
00000000 l d .data 00000000 .data
00000000 l d .bss 00000000 .bss
00000000 l d .rodata.str1.1 00000000 .rodata.str1.1
00000000 l d .note.GNU-stack 00000000 .note.GNU-stack
00000000 l d .comment 00000000 .comment
00000000 g F .text 00000031 fault_handler
00000000 g O .data 00000080 exception_messages
00000000 *UND* 00000000 puts
00000031 g F .text 00000487 isrs_install
00000000 *UND* 00000000 isr0
00000000 *UND* 00000000 idt_set_gate
00000000 *UND* 00000000 isr1
00000000 *UND* 00000000 isr2
00000000 *UND* 00000000 isr3
00000000 *UND* 00000000 isr4
00000000 *UND* 00000000 isr5
00000000 *UND* 00000000 isr6
00000000 *UND* 00000000 isr7
00000000 *UND* 00000000 isr8
00000000 *UND* 00000000 isr9
00000000 *UND* 00000000 isr10
00000000 *UND* 00000000 isr11
00000000 *UND* 00000000 isr12
00000000 *UND* 00000000 isr13
00000000 *UND* 00000000 isr14
00000000 *UND* 00000000 isr15
00000000 *UND* 00000000 isr16
00000000 *UND* 00000000 isr17
00000000 *UND* 00000000 isr18
00000000 *UND* 00000000 isr19
00000000 *UND* 00000000 isr20
00000000 *UND* 00000000 isr21
00000000 *UND* 00000000 isr22
00000000 *UND* 00000000 isr23
00000000 *UND* 00000000 isr24
00000000 *UND* 00000000 isr25
00000000 *UND* 00000000 isr26
00000000 *UND* 00000000 isr27
00000000 *UND* 00000000 isr28
00000000 *UND* 00000000 isr29
00000000 *UND* 00000000 isr30
00000000 *UND* 00000000 isr31
Objdump -t irq.o
Code: Select all
irq.o: file format elf32-i386
SYMBOL TABLE:
00000000 l df *ABS* 00000000 irq.c
00000000 l d .text 00000000 .text
00000000 l d .data 00000000 .data
00000000 l d .bss 00000000 .bss
00000000 l d .note.GNU-stack 00000000 .note.GNU-stack
00000000 l d .comment 00000000 .comment
00000000 g F .text 00000010 irq_install_handler
00000000 g O .bss 00000040 irq_routines
00000010 g F .text 00000010 irq_uninstall_handler
00000020 g F .text 0000004e irq_handler
00000000 *UND* 00000000 outportb
0000006e g F .text 000000cf irq_remap
0000013d g F .text 0000024c irq_install
00000000 *UND* 00000000 irq0
00000000 *UND* 00000000 idt_set_gate
00000000 *UND* 00000000 irq1
00000000 *UND* 00000000 irq2
00000000 *UND* 00000000 irq3
00000000 *UND* 00000000 irq4
00000000 *UND* 00000000 irq5
00000000 *UND* 00000000 irq6
00000000 *UND* 00000000 irq7
00000000 *UND* 00000000 irq8
00000000 *UND* 00000000 irq9
00000000 *UND* 00000000 irq10
00000000 *UND* 00000000 irq11
00000000 *UND* 00000000 irq12
00000000 *UND* 00000000 irq13
00000000 *UND* 00000000 irq14
00000000 *UND* 00000000 irq15