diff --git a/docs/file_format/segments.md b/docs/file_format/segments.md index f120585..68deedd 100644 --- a/docs/file_format/segments.md +++ b/docs/file_format/segments.md @@ -152,6 +152,33 @@ The name of an existing [`vram_class`](vram_class.md). `null` +## `dir` + +Used as a prefix for all the files emitted for this Segment. + +### Example + +```yaml +settings: + base_path: build + +segments: + - name: omo2_1 + dir: src/battle/area/omo2_1 + files: + - { path: actor/shy_squad.o } +``` + +Emits the `build/src/battle/area/omo2_1/actor/shy_squad.o` file path. + +### Valid values + +Any valid path. + +### Default value + +Empty path. + ## `alloc_sections` List of allocatable sections (the ones that take ROM space) for this specific diff --git a/slinky/src/absent_nullable.rs b/slinky/src/absent_nullable.rs index 5819219..89d5590 100644 --- a/slinky/src/absent_nullable.rs +++ b/slinky/src/absent_nullable.rs @@ -36,7 +36,7 @@ where } } -// TODO: consider changing the "default" callbacks to return a result +// TODO: consider changing the "default" callbacks to return a Result impl AbsentNullable { pub fn get_non_null(self, name: &str, default: F) -> Result where diff --git a/slinky/src/linker_writer.rs b/slinky/src/linker_writer.rs index 6d9882e..cd403a1 100644 --- a/slinky/src/linker_writer.rs +++ b/slinky/src/linker_writer.rs @@ -16,10 +16,11 @@ pub struct LinkerWriter<'a> { // Used for dependency generation files_paths: indexmap::IndexSet, - single_segment: bool, - vram_classes: indexmap::IndexMap, + single_segment: bool, + reference_partial_objects: bool, + /* Options to control stuff */ emit_sections_kind_symbols: bool, emit_section_symbols: bool, @@ -39,10 +40,11 @@ impl<'a> LinkerWriter<'a> { files_paths: indexmap::IndexSet::new(), - single_segment: false, - vram_classes, + single_segment: false, + reference_partial_objects: false, + emit_sections_kind_symbols: true, emit_section_symbols: true, @@ -50,6 +52,14 @@ impl<'a> LinkerWriter<'a> { } } + pub fn new_reference_partial_objects(d: &'a Document) -> Self { + let mut s = Self::new(d); + + s.reference_partial_objects = true; + + s + } + pub fn add_all_segments(&mut self, segments: &[Segment]) { if self.d.settings.single_segment_mode { assert!(segments.len() == 1); @@ -647,6 +657,13 @@ impl LinkerWriter<'_> { } fn emit_section(&mut self, segment: &Segment, section: &str) { + let mut base_path = PathBuf::new(); + + base_path.extend(&self.d.settings.base_path); + if !self.reference_partial_objects { + base_path.extend(&segment.dir); + } + for file in &segment.files { if !file.section_order.is_empty() { // Keys specify the section and value specify where it will be put @@ -660,12 +677,12 @@ impl LinkerWriter<'_> { // Check if any other section should be placed be placed here for (k, v) in &file.section_order { if v == section { - self.emit_file(file, segment, k, &self.d.settings.base_path); + self.emit_file(file, segment, k, &base_path); } } } - self.emit_file(file, segment, section, &self.d.settings.base_path); + self.emit_file(file, segment, section, &base_path); } } diff --git a/slinky/src/partial_linker_writer.rs b/slinky/src/partial_linker_writer.rs index 282e91c..a0691da 100644 --- a/slinky/src/partial_linker_writer.rs +++ b/slinky/src/partial_linker_writer.rs @@ -19,7 +19,7 @@ pub struct PartialLinkerWriter<'a> { impl<'a> PartialLinkerWriter<'a> { pub fn new(d: &'a Document) -> Self { Self { - main_writer: LinkerWriter::new(d), + main_writer: LinkerWriter::new_reference_partial_objects(d), partial_writers: Vec::new(), diff --git a/slinky/src/segment.rs b/slinky/src/segment.rs index aa04c21..b12b754 100644 --- a/slinky/src/segment.rs +++ b/slinky/src/segment.rs @@ -1,6 +1,8 @@ /* SPDX-FileCopyrightText: © 2024 decompals */ /* SPDX-License-Identifier: MIT */ +use std::path::PathBuf; + use serde::Deserialize; use crate::{ @@ -33,6 +35,9 @@ pub struct Segment { /// Not compatible with `fixed_vram`, `fixed_symbol` or `follows_segment`. pub vram_class: Option, + /// Used as a prefix for all the files emitted for this Segment. + pub dir: PathBuf, + // The default value of the following members come from Settings pub alloc_sections: Vec, pub noload_sections: Vec, @@ -64,6 +69,9 @@ pub(crate) struct SegmentSerial { #[serde(default)] pub vram_class: AbsentNullable, + #[serde(default)] + pub dir: AbsentNullable, + // The default of the following come from Options #[serde(default)] pub alloc_sections: AbsentNullable>, @@ -162,6 +170,8 @@ impl SegmentSerial { }); } + let dir = self.dir.get_non_null("dir", PathBuf::new)?; + let alloc_sections = self .alloc_sections .get_non_null("alloc_sections", || settings.alloc_sections.clone())?; @@ -196,6 +206,7 @@ impl SegmentSerial { fixed_symbol, follows_segment, vram_class, + dir, alloc_sections, noload_sections, subalign, diff --git a/tests/partial_linking/vram_classes.h b/tests/partial_linking/vram_classes.h index 0491ffd..9579eff 100644 --- a/tests/partial_linking/vram_classes.h +++ b/tests/partial_linking/vram_classes.h @@ -37,6 +37,116 @@ extern char boot_VRAM_END[]; extern char boot_VRAM_SIZE[]; extern char boot_ROM_END[]; extern char boot_ROM_SIZE[]; +extern char battle_area2_VRAM_CLASS_START[]; +extern char battle_area2_VRAM_CLASS_END[]; +extern char omo2_1_ROM_START[]; +extern char omo2_1_VRAM[]; +extern char omo2_1_alloc_VRAM[]; +extern char omo2_1_TEXT_START[]; +extern char omo2_1_TEXT_END[]; +extern char omo2_1_TEXT_SIZE[]; +extern char omo2_1_DATA_START[]; +extern char omo2_1_DATA_END[]; +extern char omo2_1_DATA_SIZE[]; +extern char omo2_1_RODATA_START[]; +extern char omo2_1_RODATA_END[]; +extern char omo2_1_RODATA_SIZE[]; +extern char omo2_1_SDATA_START[]; +extern char omo2_1_SDATA_END[]; +extern char omo2_1_SDATA_SIZE[]; +extern char omo2_1_alloc_VRAM_END[]; +extern char omo2_1_alloc_VRAM_SIZE[]; +extern char omo2_1_noload_VRAM[]; +extern char omo2_1_SBSS_START[]; +extern char omo2_1_SBSS_END[]; +extern char omo2_1_SBSS_SIZE[]; +extern char omo2_1_SCOMMON_START[]; +extern char omo2_1_SCOMMON_END[]; +extern char omo2_1_SCOMMON_SIZE[]; +extern char omo2_1_BSS_START[]; +extern char omo2_1_BSS_END[]; +extern char omo2_1_BSS_SIZE[]; +extern char omo2_1COMMON_START[]; +extern char omo2_1COMMON_END[]; +extern char omo2_1COMMON_SIZE[]; +extern char omo2_1_noload_VRAM_END[]; +extern char omo2_1_noload_VRAM_SIZE[]; +extern char omo2_1_VRAM_END[]; +extern char omo2_1_VRAM_SIZE[]; +extern char omo2_1_ROM_END[]; +extern char omo2_1_ROM_SIZE[]; +extern char omo2_2_ROM_START[]; +extern char omo2_2_VRAM[]; +extern char omo2_2_alloc_VRAM[]; +extern char omo2_2_TEXT_START[]; +extern char omo2_2_TEXT_END[]; +extern char omo2_2_TEXT_SIZE[]; +extern char omo2_2_DATA_START[]; +extern char omo2_2_DATA_END[]; +extern char omo2_2_DATA_SIZE[]; +extern char omo2_2_RODATA_START[]; +extern char omo2_2_RODATA_END[]; +extern char omo2_2_RODATA_SIZE[]; +extern char omo2_2_SDATA_START[]; +extern char omo2_2_SDATA_END[]; +extern char omo2_2_SDATA_SIZE[]; +extern char omo2_2_alloc_VRAM_END[]; +extern char omo2_2_alloc_VRAM_SIZE[]; +extern char omo2_2_noload_VRAM[]; +extern char omo2_2_SBSS_START[]; +extern char omo2_2_SBSS_END[]; +extern char omo2_2_SBSS_SIZE[]; +extern char omo2_2_SCOMMON_START[]; +extern char omo2_2_SCOMMON_END[]; +extern char omo2_2_SCOMMON_SIZE[]; +extern char omo2_2_BSS_START[]; +extern char omo2_2_BSS_END[]; +extern char omo2_2_BSS_SIZE[]; +extern char omo2_2COMMON_START[]; +extern char omo2_2COMMON_END[]; +extern char omo2_2COMMON_SIZE[]; +extern char omo2_2_noload_VRAM_END[]; +extern char omo2_2_noload_VRAM_SIZE[]; +extern char omo2_2_VRAM_END[]; +extern char omo2_2_VRAM_SIZE[]; +extern char omo2_2_ROM_END[]; +extern char omo2_2_ROM_SIZE[]; +extern char omo2_3_ROM_START[]; +extern char omo2_3_VRAM[]; +extern char omo2_3_alloc_VRAM[]; +extern char omo2_3_TEXT_START[]; +extern char omo2_3_TEXT_END[]; +extern char omo2_3_TEXT_SIZE[]; +extern char omo2_3_DATA_START[]; +extern char omo2_3_DATA_END[]; +extern char omo2_3_DATA_SIZE[]; +extern char omo2_3_RODATA_START[]; +extern char omo2_3_RODATA_END[]; +extern char omo2_3_RODATA_SIZE[]; +extern char omo2_3_SDATA_START[]; +extern char omo2_3_SDATA_END[]; +extern char omo2_3_SDATA_SIZE[]; +extern char omo2_3_alloc_VRAM_END[]; +extern char omo2_3_alloc_VRAM_SIZE[]; +extern char omo2_3_noload_VRAM[]; +extern char omo2_3_SBSS_START[]; +extern char omo2_3_SBSS_END[]; +extern char omo2_3_SBSS_SIZE[]; +extern char omo2_3_SCOMMON_START[]; +extern char omo2_3_SCOMMON_END[]; +extern char omo2_3_SCOMMON_SIZE[]; +extern char omo2_3_BSS_START[]; +extern char omo2_3_BSS_END[]; +extern char omo2_3_BSS_SIZE[]; +extern char omo2_3COMMON_START[]; +extern char omo2_3COMMON_END[]; +extern char omo2_3COMMON_SIZE[]; +extern char omo2_3_noload_VRAM_END[]; +extern char omo2_3_noload_VRAM_SIZE[]; +extern char omo2_3_VRAM_END[]; +extern char omo2_3_VRAM_SIZE[]; +extern char omo2_3_ROM_END[]; +extern char omo2_3_ROM_SIZE[]; extern char battle_partner_VRAM_CLASS_START[]; extern char battle_partner_VRAM_CLASS_END[]; extern char battle_partner_goompa_ROM_START[]; @@ -447,6 +557,7 @@ extern char assets4_VRAM_END[]; extern char assets4_VRAM_SIZE[]; extern char assets4_ROM_END[]; extern char assets4_ROM_SIZE[]; +extern char battle_area2_VRAM_CLASS_SIZE[]; extern char battle_partner_VRAM_CLASS_SIZE[]; extern char battle_code_VRAM_CLASS_SIZE[]; extern char heaps2_VRAM_CLASS_SIZE[]; diff --git a/tests/partial_linking/vram_classes.ld b/tests/partial_linking/vram_classes.ld index 5fc0bb8..62a6569 100644 --- a/tests/partial_linking/vram_classes.ld +++ b/tests/partial_linking/vram_classes.ld @@ -75,6 +75,234 @@ SECTIONS boot_ROM_END = __romPos; boot_ROM_SIZE = ABSOLUTE(boot_ROM_END - boot_ROM_START); + battle_area2_VRAM_CLASS_START = Vine1Base; + battle_area2_VRAM_CLASS_END = 0x00000000; + + omo2_1_ROM_START = __romPos; + omo2_1_VRAM = ADDR(.omo2_1); + omo2_1_alloc_VRAM = .; + + .omo2_1 battle_area2_VRAM_CLASS_START : AT(omo2_1_ROM_START) SUBALIGN(16) + { + FILL(0x00000000); + omo2_1_TEXT_START = .; + build/segments/omo2_1.o(.text*); + . = ALIGN(., 0x10); + omo2_1_TEXT_END = .; + omo2_1_TEXT_SIZE = ABSOLUTE(omo2_1_TEXT_END - omo2_1_TEXT_START); + + omo2_1_DATA_START = .; + build/segments/omo2_1.o(.data*); + . = ALIGN(., 0x10); + omo2_1_DATA_END = .; + omo2_1_DATA_SIZE = ABSOLUTE(omo2_1_DATA_END - omo2_1_DATA_START); + + omo2_1_RODATA_START = .; + build/segments/omo2_1.o(.rodata*); + . = ALIGN(., 0x10); + omo2_1_RODATA_END = .; + omo2_1_RODATA_SIZE = ABSOLUTE(omo2_1_RODATA_END - omo2_1_RODATA_START); + + omo2_1_SDATA_START = .; + build/segments/omo2_1.o(.sdata*); + . = ALIGN(., 0x10); + omo2_1_SDATA_END = .; + omo2_1_SDATA_SIZE = ABSOLUTE(omo2_1_SDATA_END - omo2_1_SDATA_START); + } + + omo2_1_alloc_VRAM_END = .; + omo2_1_alloc_VRAM_SIZE = ABSOLUTE(omo2_1_alloc_VRAM_END - omo2_1_alloc_VRAM); + + omo2_1_noload_VRAM = .; + + .omo2_1.noload (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + omo2_1_SBSS_START = .; + build/segments/omo2_1.o(.sbss*); + . = ALIGN(., 0x10); + omo2_1_SBSS_END = .; + omo2_1_SBSS_SIZE = ABSOLUTE(omo2_1_SBSS_END - omo2_1_SBSS_START); + + omo2_1_SCOMMON_START = .; + build/segments/omo2_1.o(.scommon*); + . = ALIGN(., 0x10); + omo2_1_SCOMMON_END = .; + omo2_1_SCOMMON_SIZE = ABSOLUTE(omo2_1_SCOMMON_END - omo2_1_SCOMMON_START); + + omo2_1_BSS_START = .; + build/segments/omo2_1.o(.bss*); + . = ALIGN(., 0x10); + omo2_1_BSS_END = .; + omo2_1_BSS_SIZE = ABSOLUTE(omo2_1_BSS_END - omo2_1_BSS_START); + + omo2_1COMMON_START = .; + build/segments/omo2_1.o(COMMON*); + . = ALIGN(., 0x10); + omo2_1COMMON_END = .; + omo2_1COMMON_SIZE = ABSOLUTE(omo2_1COMMON_END - omo2_1COMMON_START); + } + + omo2_1_noload_VRAM_END = .; + omo2_1_noload_VRAM_SIZE = ABSOLUTE(omo2_1_noload_VRAM_END - omo2_1_noload_VRAM); + omo2_1_VRAM_END = .; + omo2_1_VRAM_SIZE = ABSOLUTE(omo2_1_VRAM_END - omo2_1_VRAM); + __romPos += SIZEOF(.omo2_1); + omo2_1_ROM_END = __romPos; + omo2_1_ROM_SIZE = ABSOLUTE(omo2_1_ROM_END - omo2_1_ROM_START); + + battle_area2_VRAM_CLASS_END = MAX(battle_area2_VRAM_CLASS_END, omo2_1_VRAM_END); + + omo2_2_ROM_START = __romPos; + omo2_2_VRAM = ADDR(.omo2_2); + omo2_2_alloc_VRAM = .; + + .omo2_2 battle_area2_VRAM_CLASS_START : AT(omo2_2_ROM_START) SUBALIGN(16) + { + FILL(0x00000000); + omo2_2_TEXT_START = .; + build/segments/omo2_2.o(.text*); + . = ALIGN(., 0x10); + omo2_2_TEXT_END = .; + omo2_2_TEXT_SIZE = ABSOLUTE(omo2_2_TEXT_END - omo2_2_TEXT_START); + + omo2_2_DATA_START = .; + build/segments/omo2_2.o(.data*); + . = ALIGN(., 0x10); + omo2_2_DATA_END = .; + omo2_2_DATA_SIZE = ABSOLUTE(omo2_2_DATA_END - omo2_2_DATA_START); + + omo2_2_RODATA_START = .; + build/segments/omo2_2.o(.rodata*); + . = ALIGN(., 0x10); + omo2_2_RODATA_END = .; + omo2_2_RODATA_SIZE = ABSOLUTE(omo2_2_RODATA_END - omo2_2_RODATA_START); + + omo2_2_SDATA_START = .; + build/segments/omo2_2.o(.sdata*); + . = ALIGN(., 0x10); + omo2_2_SDATA_END = .; + omo2_2_SDATA_SIZE = ABSOLUTE(omo2_2_SDATA_END - omo2_2_SDATA_START); + } + + omo2_2_alloc_VRAM_END = .; + omo2_2_alloc_VRAM_SIZE = ABSOLUTE(omo2_2_alloc_VRAM_END - omo2_2_alloc_VRAM); + + omo2_2_noload_VRAM = .; + + .omo2_2.noload (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + omo2_2_SBSS_START = .; + build/segments/omo2_2.o(.sbss*); + . = ALIGN(., 0x10); + omo2_2_SBSS_END = .; + omo2_2_SBSS_SIZE = ABSOLUTE(omo2_2_SBSS_END - omo2_2_SBSS_START); + + omo2_2_SCOMMON_START = .; + build/segments/omo2_2.o(.scommon*); + . = ALIGN(., 0x10); + omo2_2_SCOMMON_END = .; + omo2_2_SCOMMON_SIZE = ABSOLUTE(omo2_2_SCOMMON_END - omo2_2_SCOMMON_START); + + omo2_2_BSS_START = .; + build/segments/omo2_2.o(.bss*); + . = ALIGN(., 0x10); + omo2_2_BSS_END = .; + omo2_2_BSS_SIZE = ABSOLUTE(omo2_2_BSS_END - omo2_2_BSS_START); + + omo2_2COMMON_START = .; + build/segments/omo2_2.o(COMMON*); + . = ALIGN(., 0x10); + omo2_2COMMON_END = .; + omo2_2COMMON_SIZE = ABSOLUTE(omo2_2COMMON_END - omo2_2COMMON_START); + } + + omo2_2_noload_VRAM_END = .; + omo2_2_noload_VRAM_SIZE = ABSOLUTE(omo2_2_noload_VRAM_END - omo2_2_noload_VRAM); + omo2_2_VRAM_END = .; + omo2_2_VRAM_SIZE = ABSOLUTE(omo2_2_VRAM_END - omo2_2_VRAM); + __romPos += SIZEOF(.omo2_2); + omo2_2_ROM_END = __romPos; + omo2_2_ROM_SIZE = ABSOLUTE(omo2_2_ROM_END - omo2_2_ROM_START); + + battle_area2_VRAM_CLASS_END = MAX(battle_area2_VRAM_CLASS_END, omo2_2_VRAM_END); + + omo2_3_ROM_START = __romPos; + omo2_3_VRAM = ADDR(.omo2_3); + omo2_3_alloc_VRAM = .; + + .omo2_3 battle_area2_VRAM_CLASS_START : AT(omo2_3_ROM_START) SUBALIGN(16) + { + FILL(0x00000000); + omo2_3_TEXT_START = .; + build/segments/omo2_3.o(.text*); + . = ALIGN(., 0x10); + omo2_3_TEXT_END = .; + omo2_3_TEXT_SIZE = ABSOLUTE(omo2_3_TEXT_END - omo2_3_TEXT_START); + + omo2_3_DATA_START = .; + build/segments/omo2_3.o(.data*); + . = ALIGN(., 0x10); + omo2_3_DATA_END = .; + omo2_3_DATA_SIZE = ABSOLUTE(omo2_3_DATA_END - omo2_3_DATA_START); + + omo2_3_RODATA_START = .; + build/segments/omo2_3.o(.rodata*); + . = ALIGN(., 0x10); + omo2_3_RODATA_END = .; + omo2_3_RODATA_SIZE = ABSOLUTE(omo2_3_RODATA_END - omo2_3_RODATA_START); + + omo2_3_SDATA_START = .; + build/segments/omo2_3.o(.sdata*); + . = ALIGN(., 0x10); + omo2_3_SDATA_END = .; + omo2_3_SDATA_SIZE = ABSOLUTE(omo2_3_SDATA_END - omo2_3_SDATA_START); + } + + omo2_3_alloc_VRAM_END = .; + omo2_3_alloc_VRAM_SIZE = ABSOLUTE(omo2_3_alloc_VRAM_END - omo2_3_alloc_VRAM); + + omo2_3_noload_VRAM = .; + + .omo2_3.noload (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + omo2_3_SBSS_START = .; + build/segments/omo2_3.o(.sbss*); + . = ALIGN(., 0x10); + omo2_3_SBSS_END = .; + omo2_3_SBSS_SIZE = ABSOLUTE(omo2_3_SBSS_END - omo2_3_SBSS_START); + + omo2_3_SCOMMON_START = .; + build/segments/omo2_3.o(.scommon*); + . = ALIGN(., 0x10); + omo2_3_SCOMMON_END = .; + omo2_3_SCOMMON_SIZE = ABSOLUTE(omo2_3_SCOMMON_END - omo2_3_SCOMMON_START); + + omo2_3_BSS_START = .; + build/segments/omo2_3.o(.bss*); + . = ALIGN(., 0x10); + omo2_3_BSS_END = .; + omo2_3_BSS_SIZE = ABSOLUTE(omo2_3_BSS_END - omo2_3_BSS_START); + + omo2_3COMMON_START = .; + build/segments/omo2_3.o(COMMON*); + . = ALIGN(., 0x10); + omo2_3COMMON_END = .; + omo2_3COMMON_SIZE = ABSOLUTE(omo2_3COMMON_END - omo2_3COMMON_START); + } + + omo2_3_noload_VRAM_END = .; + omo2_3_noload_VRAM_SIZE = ABSOLUTE(omo2_3_noload_VRAM_END - omo2_3_noload_VRAM); + omo2_3_VRAM_END = .; + omo2_3_VRAM_SIZE = ABSOLUTE(omo2_3_VRAM_END - omo2_3_VRAM); + __romPos += SIZEOF(.omo2_3); + omo2_3_ROM_END = __romPos; + omo2_3_ROM_SIZE = ABSOLUTE(omo2_3_ROM_END - omo2_3_ROM_START); + + battle_area2_VRAM_CLASS_END = MAX(battle_area2_VRAM_CLASS_END, omo2_3_VRAM_END); + battle_partner_VRAM_CLASS_START = 0x80238000; battle_partner_VRAM_CLASS_END = 0x00000000; @@ -925,6 +1153,7 @@ SECTIONS segment_06_VRAM_CLASS_END = MAX(segment_06_VRAM_CLASS_END, assets4_VRAM_END); + battle_area2_VRAM_CLASS_SIZE = battle_area2_VRAM_CLASS_END - battle_area2_VRAM_CLASS_START; battle_partner_VRAM_CLASS_SIZE = battle_partner_VRAM_CLASS_END - battle_partner_VRAM_CLASS_START; battle_code_VRAM_CLASS_SIZE = battle_code_VRAM_CLASS_END - battle_code_VRAM_CLASS_START; heaps2_VRAM_CLASS_SIZE = heaps2_VRAM_CLASS_END - heaps2_VRAM_CLASS_START; diff --git a/tests/partial_linking/vram_classes.yaml b/tests/partial_linking/vram_classes.yaml index 38c7454..d8b4414 100644 --- a/tests/partial_linking/vram_classes.yaml +++ b/tests/partial_linking/vram_classes.yaml @@ -7,6 +7,8 @@ settings: partial_build_segments_folder: segments vram_classes: + - { name: battle_area2, fixed_symbol: Vine1Base } + - { name: battle_partner, fixed_vram: 0x80238000 } - { name: battle_code, follows_classes: [battle_partner] } @@ -26,6 +28,22 @@ segments: - { path: src/boot/dmadata.o } + - name: omo2_1 + dir: src/battle/area/omo2_1 + vram_class: battle_area2 + files: + - { path: actor/shy_squad.o } + - name: omo2_2 + dir: src/battle/area/omo2_2 + vram_class: battle_area2 + files: + - { path: actor/stilt_guy.o } + - name: omo2_3 + dir: src/battle/area/omo2_3 + vram_class: battle_area2 + files: + - { path: actor/shy_stack.o } + - name: battle_partner_goompa vram_class: battle_partner files: diff --git a/tests/partial_linking/vram_classes/omo2_1.ld b/tests/partial_linking/vram_classes/omo2_1.ld new file mode 100644 index 0000000..c7d25d1 --- /dev/null +++ b/tests/partial_linking/vram_classes/omo2_1.ld @@ -0,0 +1,66 @@ +SECTIONS +{ + .text : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_1/actor/shy_squad.o(.text*); + } + + .data : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_1/actor/shy_squad.o(.data*); + } + + .rodata : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_1/actor/shy_squad.o(.rodata*); + } + + .sdata : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_1/actor/shy_squad.o(.sdata*); + } + + .sbss (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_1/actor/shy_squad.o(.sbss*); + } + + .scommon (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_1/actor/shy_squad.o(.scommon*); + } + + .bss (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_1/actor/shy_squad.o(.bss*); + } + + COMMON (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_1/actor/shy_squad.o(COMMON*); + } + + .shstrtab 0 : + { + *(.shstrtab); + } + + /DISCARD/ : + { + *(.reginfo); + *(.MIPS.abiflags); + *(.MIPS.options); + *(.note.gnu.build-id); + *(.interp); + *(.eh_frame); + *(*); + } +} diff --git a/tests/partial_linking/vram_classes/omo2_2.ld b/tests/partial_linking/vram_classes/omo2_2.ld new file mode 100644 index 0000000..2704bf1 --- /dev/null +++ b/tests/partial_linking/vram_classes/omo2_2.ld @@ -0,0 +1,66 @@ +SECTIONS +{ + .text : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.text*); + } + + .data : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.data*); + } + + .rodata : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.rodata*); + } + + .sdata : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.sdata*); + } + + .sbss (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.sbss*); + } + + .scommon (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.scommon*); + } + + .bss (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.bss*); + } + + COMMON (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_2/actor/stilt_guy.o(COMMON*); + } + + .shstrtab 0 : + { + *(.shstrtab); + } + + /DISCARD/ : + { + *(.reginfo); + *(.MIPS.abiflags); + *(.MIPS.options); + *(.note.gnu.build-id); + *(.interp); + *(.eh_frame); + *(*); + } +} diff --git a/tests/partial_linking/vram_classes/omo2_3.ld b/tests/partial_linking/vram_classes/omo2_3.ld new file mode 100644 index 0000000..ea16acf --- /dev/null +++ b/tests/partial_linking/vram_classes/omo2_3.ld @@ -0,0 +1,66 @@ +SECTIONS +{ + .text : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_3/actor/shy_stack.o(.text*); + } + + .data : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_3/actor/shy_stack.o(.data*); + } + + .rodata : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_3/actor/shy_stack.o(.rodata*); + } + + .sdata : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_3/actor/shy_stack.o(.sdata*); + } + + .sbss (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_3/actor/shy_stack.o(.sbss*); + } + + .scommon (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_3/actor/shy_stack.o(.scommon*); + } + + .bss (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_3/actor/shy_stack.o(.bss*); + } + + COMMON (NOLOAD) : SUBALIGN(16) + { + FILL(0x00000000); + build/src/battle/area/omo2_3/actor/shy_stack.o(COMMON*); + } + + .shstrtab 0 : + { + *(.shstrtab); + } + + /DISCARD/ : + { + *(.reginfo); + *(.MIPS.abiflags); + *(.MIPS.options); + *(.note.gnu.build-id); + *(.interp); + *(.eh_frame); + *(*); + } +} diff --git a/tests/test_cases/vram_classes.ld b/tests/test_cases/vram_classes.ld index 15d3010..d034fd6 100644 --- a/tests/test_cases/vram_classes.ld +++ b/tests/test_cases/vram_classes.ld @@ -94,25 +94,25 @@ SECTIONS { FILL(0x00000000); omo2_1_TEXT_START = .; - build/actor/shy_squad.o(.text*); + build/src/battle/area/omo2_1/actor/shy_squad.o(.text*); . = ALIGN(., 0x10); omo2_1_TEXT_END = .; omo2_1_TEXT_SIZE = ABSOLUTE(omo2_1_TEXT_END - omo2_1_TEXT_START); omo2_1_DATA_START = .; - build/actor/shy_squad.o(.data*); + build/src/battle/area/omo2_1/actor/shy_squad.o(.data*); . = ALIGN(., 0x10); omo2_1_DATA_END = .; omo2_1_DATA_SIZE = ABSOLUTE(omo2_1_DATA_END - omo2_1_DATA_START); omo2_1_RODATA_START = .; - build/actor/shy_squad.o(.rodata*); + build/src/battle/area/omo2_1/actor/shy_squad.o(.rodata*); . = ALIGN(., 0x10); omo2_1_RODATA_END = .; omo2_1_RODATA_SIZE = ABSOLUTE(omo2_1_RODATA_END - omo2_1_RODATA_START); omo2_1_SDATA_START = .; - build/actor/shy_squad.o(.sdata*); + build/src/battle/area/omo2_1/actor/shy_squad.o(.sdata*); . = ALIGN(., 0x10); omo2_1_SDATA_END = .; omo2_1_SDATA_SIZE = ABSOLUTE(omo2_1_SDATA_END - omo2_1_SDATA_START); @@ -127,25 +127,25 @@ SECTIONS { FILL(0x00000000); omo2_1_SBSS_START = .; - build/actor/shy_squad.o(.sbss*); + build/src/battle/area/omo2_1/actor/shy_squad.o(.sbss*); . = ALIGN(., 0x10); omo2_1_SBSS_END = .; omo2_1_SBSS_SIZE = ABSOLUTE(omo2_1_SBSS_END - omo2_1_SBSS_START); omo2_1_SCOMMON_START = .; - build/actor/shy_squad.o(.scommon*); + build/src/battle/area/omo2_1/actor/shy_squad.o(.scommon*); . = ALIGN(., 0x10); omo2_1_SCOMMON_END = .; omo2_1_SCOMMON_SIZE = ABSOLUTE(omo2_1_SCOMMON_END - omo2_1_SCOMMON_START); omo2_1_BSS_START = .; - build/actor/shy_squad.o(.bss*); + build/src/battle/area/omo2_1/actor/shy_squad.o(.bss*); . = ALIGN(., 0x10); omo2_1_BSS_END = .; omo2_1_BSS_SIZE = ABSOLUTE(omo2_1_BSS_END - omo2_1_BSS_START); omo2_1COMMON_START = .; - build/actor/shy_squad.o(COMMON*); + build/src/battle/area/omo2_1/actor/shy_squad.o(COMMON*); . = ALIGN(., 0x10); omo2_1COMMON_END = .; omo2_1COMMON_SIZE = ABSOLUTE(omo2_1COMMON_END - omo2_1COMMON_START); @@ -169,25 +169,25 @@ SECTIONS { FILL(0x00000000); omo2_2_TEXT_START = .; - build/actor/stilt_guy.o(.text*); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.text*); . = ALIGN(., 0x10); omo2_2_TEXT_END = .; omo2_2_TEXT_SIZE = ABSOLUTE(omo2_2_TEXT_END - omo2_2_TEXT_START); omo2_2_DATA_START = .; - build/actor/stilt_guy.o(.data*); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.data*); . = ALIGN(., 0x10); omo2_2_DATA_END = .; omo2_2_DATA_SIZE = ABSOLUTE(omo2_2_DATA_END - omo2_2_DATA_START); omo2_2_RODATA_START = .; - build/actor/stilt_guy.o(.rodata*); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.rodata*); . = ALIGN(., 0x10); omo2_2_RODATA_END = .; omo2_2_RODATA_SIZE = ABSOLUTE(omo2_2_RODATA_END - omo2_2_RODATA_START); omo2_2_SDATA_START = .; - build/actor/stilt_guy.o(.sdata*); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.sdata*); . = ALIGN(., 0x10); omo2_2_SDATA_END = .; omo2_2_SDATA_SIZE = ABSOLUTE(omo2_2_SDATA_END - omo2_2_SDATA_START); @@ -202,25 +202,25 @@ SECTIONS { FILL(0x00000000); omo2_2_SBSS_START = .; - build/actor/stilt_guy.o(.sbss*); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.sbss*); . = ALIGN(., 0x10); omo2_2_SBSS_END = .; omo2_2_SBSS_SIZE = ABSOLUTE(omo2_2_SBSS_END - omo2_2_SBSS_START); omo2_2_SCOMMON_START = .; - build/actor/stilt_guy.o(.scommon*); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.scommon*); . = ALIGN(., 0x10); omo2_2_SCOMMON_END = .; omo2_2_SCOMMON_SIZE = ABSOLUTE(omo2_2_SCOMMON_END - omo2_2_SCOMMON_START); omo2_2_BSS_START = .; - build/actor/stilt_guy.o(.bss*); + build/src/battle/area/omo2_2/actor/stilt_guy.o(.bss*); . = ALIGN(., 0x10); omo2_2_BSS_END = .; omo2_2_BSS_SIZE = ABSOLUTE(omo2_2_BSS_END - omo2_2_BSS_START); omo2_2COMMON_START = .; - build/actor/stilt_guy.o(COMMON*); + build/src/battle/area/omo2_2/actor/stilt_guy.o(COMMON*); . = ALIGN(., 0x10); omo2_2COMMON_END = .; omo2_2COMMON_SIZE = ABSOLUTE(omo2_2COMMON_END - omo2_2COMMON_START); @@ -244,25 +244,25 @@ SECTIONS { FILL(0x00000000); omo2_3_TEXT_START = .; - build/actor/shy_stack.o(.text*); + build/src/battle/area/omo2_3/actor/shy_stack.o(.text*); . = ALIGN(., 0x10); omo2_3_TEXT_END = .; omo2_3_TEXT_SIZE = ABSOLUTE(omo2_3_TEXT_END - omo2_3_TEXT_START); omo2_3_DATA_START = .; - build/actor/shy_stack.o(.data*); + build/src/battle/area/omo2_3/actor/shy_stack.o(.data*); . = ALIGN(., 0x10); omo2_3_DATA_END = .; omo2_3_DATA_SIZE = ABSOLUTE(omo2_3_DATA_END - omo2_3_DATA_START); omo2_3_RODATA_START = .; - build/actor/shy_stack.o(.rodata*); + build/src/battle/area/omo2_3/actor/shy_stack.o(.rodata*); . = ALIGN(., 0x10); omo2_3_RODATA_END = .; omo2_3_RODATA_SIZE = ABSOLUTE(omo2_3_RODATA_END - omo2_3_RODATA_START); omo2_3_SDATA_START = .; - build/actor/shy_stack.o(.sdata*); + build/src/battle/area/omo2_3/actor/shy_stack.o(.sdata*); . = ALIGN(., 0x10); omo2_3_SDATA_END = .; omo2_3_SDATA_SIZE = ABSOLUTE(omo2_3_SDATA_END - omo2_3_SDATA_START); @@ -277,25 +277,25 @@ SECTIONS { FILL(0x00000000); omo2_3_SBSS_START = .; - build/actor/shy_stack.o(.sbss*); + build/src/battle/area/omo2_3/actor/shy_stack.o(.sbss*); . = ALIGN(., 0x10); omo2_3_SBSS_END = .; omo2_3_SBSS_SIZE = ABSOLUTE(omo2_3_SBSS_END - omo2_3_SBSS_START); omo2_3_SCOMMON_START = .; - build/actor/shy_stack.o(.scommon*); + build/src/battle/area/omo2_3/actor/shy_stack.o(.scommon*); . = ALIGN(., 0x10); omo2_3_SCOMMON_END = .; omo2_3_SCOMMON_SIZE = ABSOLUTE(omo2_3_SCOMMON_END - omo2_3_SCOMMON_START); omo2_3_BSS_START = .; - build/actor/shy_stack.o(.bss*); + build/src/battle/area/omo2_3/actor/shy_stack.o(.bss*); . = ALIGN(., 0x10); omo2_3_BSS_END = .; omo2_3_BSS_SIZE = ABSOLUTE(omo2_3_BSS_END - omo2_3_BSS_START); omo2_3COMMON_START = .; - build/actor/shy_stack.o(COMMON*); + build/src/battle/area/omo2_3/actor/shy_stack.o(COMMON*); . = ALIGN(., 0x10); omo2_3COMMON_END = .; omo2_3COMMON_SIZE = ABSOLUTE(omo2_3COMMON_END - omo2_3COMMON_START); diff --git a/tests/test_cases/vram_classes.yaml b/tests/test_cases/vram_classes.yaml index e59a5da..bdaa159 100644 --- a/tests/test_cases/vram_classes.yaml +++ b/tests/test_cases/vram_classes.yaml @@ -26,17 +26,17 @@ segments: - name: omo2_1 - # dir: src/battle/area/omo2_1 + dir: src/battle/area/omo2_1 vram_class: battle_area2 files: - { path: actor/shy_squad.o } - name: omo2_2 - # dir: src/battle/area/omo2_2 + dir: src/battle/area/omo2_2 vram_class: battle_area2 files: - { path: actor/stilt_guy.o } - name: omo2_3 - # dir: src/battle/area/omo2_3 + dir: src/battle/area/omo2_3 vram_class: battle_area2 files: - { path: actor/shy_stack.o }