Skip to content

Commit 496360a

Browse files
committed
up
1 parent ffa56da commit 496360a

20 files changed

Lines changed: 310 additions & 25 deletions

src/dustlink.ds

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
// DustLink top-level linker orchestration for the internal Dust pipeline.
1+
// File: dustlink.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// DustLink top-level linker orchestration for the internal Dust pipeline.
5+
// Provides:
6+
// - VERSION_MAJOR, VERSION_MINOR: Version info
7+
// - FORMAT_ELF64, FORMAT_FLAT, FORMAT_MBR, FORMAT_PE64: Output formats
8+
// - Link configuration and execution
9+
// - Host runtime integration
210

311
forge DustLink {
412
const VERSION_MAJOR: UInt8 = 0;
@@ -582,6 +590,16 @@ forge DustLink {
582590
return host_linker_aarch64_tls_synth_reloc_value(object_index, symbol_index, reloc_type, addend, place_addr);
583591
}
584592

593+
proc K::x86_64_tls_got_reloc_value(
594+
object_index: UInt32,
595+
symbol_index: UInt32,
596+
reloc_type: UInt32,
597+
addend: UInt64,
598+
place_addr: UInt64
599+
) -> UInt64 {
600+
return host_linker_x86_64_tls_got_reloc_value(object_index, symbol_index, reloc_type, addend, place_addr);
601+
}
602+
585603
proc K::apply_script(path: UInt64) -> UInt32 {
586604
if path == 0 {
587605
return ERR_FILE_NOT_FOUND;

src/dustlink_tests.ds

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
// DustLink tests focused on deterministic linker behavior.
1+
// File: dustlink_tests.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// DustLink tests focused on deterministic linker behavior.
5+
// Provides test cases for:
6+
// - Top-level linker orchestration
7+
// - Version information
8+
// - Format handling
9+
// - Error conditions
210

311
forge DustLinkTests {
412
const ERR_OK: UInt32 = 0;

src/linker_archive.ds

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
// Archive (.a) ingestion and deterministic -L/-l resolution.
1+
// File: linker_archive.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// Archive (.a) ingestion and deterministic -L/-l resolution.
5+
// Provides:
6+
// - Archive parsing (ELF, COFF, Mach-O)
7+
// - Library search path resolution
8+
// - Member extraction and loading
9+
// - Static library linking
210

311
forge LinkerArchive {
412
const ERR_OK: UInt32 = 0;

src/linker_buildid_z_tests.ds

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
// Build-id and -z semantic behavior tests.
1+
// File: linker_buildid_z_tests.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// Build-id and -z semantic behavior tests.
5+
// Provides test cases for:
6+
// - BUILD_ID_MODE_NONE, BUILD_ID_MODE_SHA1, BUILD_ID_MODE_SHA256
7+
// - z_relro, z_now, z_execstack options
8+
// - Build ID generation and embedding
29

310
forge LinkerBuildIdZTests {
411
const ERR_OK: UInt32 = 0;

src/linker_cli.ds

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
// DustLink CLI compatibility profile.
2-
// Canonical option IDs are intentionally linker-agnostic and map to gcc/ld/lld spellings.
1+
// File: linker_cli.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// DustLink CLI compatibility profile.
5+
// Canonical option IDs map to gcc/ld/lld spellings.
6+
// Provides:
7+
// - FLAG_OUTPUT, FLAG_ENTRY, FLAG_MAP, etc.
8+
// - CLI option parsing
9+
// - Compatibility flag handling
310

411
forge LinkerCli {
512
const FLAG_NONE: UInt32 = 0;

src/linker_elf.ds

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
// ELF64/System-V constants and parsing/validation helpers for DustLink.
1+
// File: linker_elf.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// ELF64/System-V constants and parsing/validation helpers for DustLink.
5+
// Provides:
6+
// - ELF header constants (EI_*, EM_*, ET_*, etc.)
7+
// - Section header constants (SHT_*, SHF_*, etc.)
8+
// - Program header constants (PT_*, PF_*, etc.)
9+
// - Symbol table constants (ST_*, STB_*, STT_*)
10+
// - Relocation type constants (R_* for x86_64, AArch64)
11+
// - ELF parsing and validation helpers
212

313
forge ElfFormat {
414
const EI_MAG0: UInt8 = 127;
@@ -58,6 +68,12 @@ forge ElfFormat {
5868
const R_X86_64_PC64: UInt32 = 24;
5969
const R_X86_64_GOTPCRELX: UInt32 = 41;
6070
const R_X86_64_REX_GOTPCRELX: UInt32 = 42;
71+
const R_X86_64_TPOFF64: UInt32 = 18;
72+
const R_X86_64_TPOFF32: UInt32 = 19;
73+
const R_X86_64_GOTTPOFF: UInt32 = 20;
74+
const R_X86_64_DTPOFF64: UInt32 = 17;
75+
const R_X86_64_DTPOFF32: UInt32 = 16;
76+
const R_X86_64_IRELATIVE: UInt32 = 42;
6177
const R_AARCH64_NONE: UInt32 = 0;
6278
const R_AARCH64_ABS64: UInt32 = 257;
6379
const R_AARCH64_ABS32: UInt32 = 258;

src/linker_errors.ds

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
// DustLink Error Codes - ABI-stable linker statuses.
1+
// File: linker_errors.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// DustLink Error Codes - ABI-stable linker statuses.
5+
// Provides:
6+
// - ERR_OK, ERR_FILE_NOT_FOUND, ERR_INVALID_FORMAT
7+
// - ERR_INVALID_SECTION, ERR_UNDEFINED_SYMBOL
8+
// - ERR_MULTIPLE_DEFINITION, ERR_INVALID_RELOCATION
9+
// - ERR_NOT_IMPLEMENTED_YET
210

311
forge LinkerErrors {
412
const ERR_OK: UInt32 = 0;

src/linker_flat.ds

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
// Flat binary and boot-image helpers.
1+
// File: linker_flat.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// Flat binary and boot-image helpers.
5+
// Provides:
6+
// - MBR_SIZE, MBR_SIGNATURE
7+
// - BOOT_LOADER_ADDRESS, KERNEL_LOAD_ADDRESS
8+
// - Flat binary layout
9+
// - Boot sector generation
210

311
forge FlatFormat {
412
const MBR_SIZE: UInt32 = 512;

src/linker_fs.ds

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
// Filesystem and host-bridge operations for DustLink.
2-
// These calls are linker-generic and provide byte-level IO for object/archive parsing
3-
// and output image emission.
1+
// File: linker_fs.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// Filesystem and host-bridge operations for DustLink.
5+
// Provides byte-level IO for object/archive parsing and output image emission.
6+
// Provides:
7+
// - File operations (open, read, write, close)
8+
// - Path resolution
9+
// - Error codes (ERR_OK, ERR_FILE_NOT_FOUND, ERR_WRITE_FAILED)
410

511
forge LinkerFs {
612
const ERR_OK: UInt32 = 0;

src/linker_host_cli.ds

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
// Host CLI dispatch for dustlink.
1+
// File: linker_host_cli.ds - This file is part of the DPL Toolchain
2+
// Copyright (c) 2026 Dust LLC, and Contributors
3+
// Description:
4+
// Host CLI dispatch for dustlink.
5+
// Provides:
6+
// - args_count(), arg_at(): Command line argument access
7+
// - env_get(): Environment variable access
8+
// - path operations: exists, is_file, find_executable
9+
// - File I/O operations
210

311
forge LinkerHost {
412
proc K::args_count() -> UInt32 {

0 commit comments

Comments
 (0)