Eliminate "_code32_" prefix on 32bit symbols referenced from 16bit code.
Use linking magic to eliminate the need for the _code32_ prefix.
This commit is contained in:
parent
b1a0d3a2ee
commit
1445843b99
20
Makefile
20
Makefile
|
@ -1,6 +1,6 @@
|
|||
# Legacy Bios build system
|
||||
# SeaBIOS build system
|
||||
#
|
||||
# Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
|
||||
# Copyright (C) 2008,2009 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
|
@ -111,16 +111,18 @@ $(OUT)romlayout.lds: $(OUT)romlayout16.o
|
|||
@echo " Building layout information $@"
|
||||
$(Q)$(OBJDUMP) -h $< | ./tools/layoutrom.py $@
|
||||
|
||||
$(OUT)rombios16.lds: $(OUT)romlayout.lds
|
||||
$(OUT)layout16.lds: $(OUT)romlayout.lds
|
||||
|
||||
$(OUT)rom16.o: $(OUT)romlayout16.o $(OUT)rom32.o $(OUT)rombios16.lds
|
||||
@echo " Linking (16bit) $@"
|
||||
$(Q)$(OBJCOPY) --prefix-symbols=_code32_ $(OUT)rom32.o $(OUT)rom32.rename.o
|
||||
$(Q)$(LD) -T $(OUT)rombios16.lds -R $(OUT)rom32.rename.o $< -o $@
|
||||
$(OUT)rom16.o: $(OUT)romlayout16.o $(OUT)rom32.o $(OUT)layout16.lds
|
||||
@echo " Linking (no relocs) $@"
|
||||
$(Q)$(LD) -r -T $(OUT)layout16.lds $< -o $@
|
||||
|
||||
$(OUT)rom.o: $(OUT)rom16.o $(OUT)rom32.o $(OUT)rombios.lds
|
||||
$(OUT)rom.o: $(OUT)rom16.o $(OUT)rom32.o $(OUT)rombios16.lds $(OUT)rombios.lds
|
||||
@echo " Linking $@"
|
||||
$(Q)$(LD) -T $(OUT)rombios.lds $(OUT)rom16.o $(OUT)rom32.o -o $@
|
||||
$(Q)$(LD) -T $(OUT)rombios16.lds $(OUT)rom16.o -R $(OUT)rom32.o -o $(OUT)rom16.final.o
|
||||
$(Q)$(STRIP) $(OUT)rom16.final.o
|
||||
$(Q)$(OBJCOPY) --extract-symbol --adjust-vma 0xf0000 $(OUT)rom16.o $(OUT)rom16.moved.o
|
||||
$(Q)$(LD) -T $(OUT)rombios.lds $(OUT)rom16.final.o $(OUT)rom32.o -R $(OUT)rom16.moved.o -o $@
|
||||
|
||||
$(OUT)bios.bin.elf: $(OUT)rom.o
|
||||
@echo " Prepping $@"
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Placement of the 16bit code.
|
||||
//
|
||||
// Copyright (C) 2008,2009 Kevin O'Connor <kevin@koconnor.net>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
#include "config.h" // BUILD_BIOS_ADDR
|
||||
|
||||
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
|
||||
OUTPUT_ARCH("i386")
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
// The actual placement of the 16bit sections is determined by the
|
||||
// script tools/layoutrom.py
|
||||
#include "../out/romlayout.lds"
|
||||
|
||||
// Discard regular data sections to force a link error if
|
||||
// 16bit code attempts to access data not marked with VAR16.
|
||||
/DISCARD/ : { *(.text*) *(.rodata*) *(.data*) *(.bss*) *(COMMON) }
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
// Code for handling calls to "post" that are resume related.
|
||||
//
|
||||
// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
|
||||
// Copyright (C) 2008,2009 Kevin O'Connor <kevin@koconnor.net>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
|
@ -40,7 +40,7 @@ handle_resume(u8 status)
|
|||
asm volatile(
|
||||
"movw %w1, %%ss\n"
|
||||
"movl %0, %%esp\n"
|
||||
"pushl $_code32_s3_resume\n"
|
||||
"pushl $s3_resume\n"
|
||||
"jmp transition32\n"
|
||||
: : "i"(BUILD_S3RESUME_STACK_ADDR), "r"(0)
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Linker definitions for 16bit code
|
||||
//
|
||||
// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
|
||||
// Copyright (C) 2008,2009 Kevin O'Connor <kevin@koconnor.net>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
|
@ -10,12 +10,7 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
|
|||
OUTPUT_ARCH("i386")
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
// The actual placement of the 16bit sections is determined by the
|
||||
// script tools/layoutrom.py
|
||||
#include "../out/romlayout.lds"
|
||||
|
||||
// Discard regular data sections to force a link error if
|
||||
// 16bit code attempts to access data not marked with VAR16.
|
||||
/DISCARD/ : { *(.text*) *(.rodata*) *(.data*) *(.bss*) *(COMMON) }
|
||||
.text16 code16_start : {
|
||||
*(.text16)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ entry_post:
|
|||
jnz 1f
|
||||
|
||||
// Normal entry point
|
||||
ENTRY_INTO32 _code32__start
|
||||
ENTRY_INTO32 _start
|
||||
|
||||
// Entry point when a post call looks like a resume.
|
||||
1:
|
||||
|
@ -345,7 +345,7 @@ post32:
|
|||
movw %ax, %gs
|
||||
movw %ax, %ss
|
||||
movl $BUILD_STACK_ADDR, %esp
|
||||
ljmpl $SEG32_MODE32_CS, $_code32__start
|
||||
ljmpl $SEG32_MODE32_CS, $_start
|
||||
|
||||
.code16gcc
|
||||
|
||||
|
@ -403,11 +403,11 @@ irqentryarg:
|
|||
// int 18/19 are special - they reset stack and call into 32bit mode.
|
||||
DECLFUNC entry_19
|
||||
entry_19:
|
||||
ENTRY_INTO32 _code32_handle_19
|
||||
ENTRY_INTO32 handle_19
|
||||
|
||||
DECLFUNC entry_18
|
||||
entry_18:
|
||||
ENTRY_INTO32 _code32_handle_18
|
||||
ENTRY_INTO32 handle_18
|
||||
|
||||
|
||||
/****************************************************************
|
||||
|
|
Loading…
Reference in New Issue