Skip to content

Commit

Permalink
Add TargetProperties::custom_properties
Browse files Browse the repository at this point in the history
  • Loading branch information
chorman0773 committed Oct 5, 2024
1 parent f07f3c1 commit 5aa68a3
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 5 deletions.
3 changes: 3 additions & 0 deletions lccc/src/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod builtin {
pub mod clever;
pub mod elf;
pub mod holeybytes;
pub mod lilium;
pub mod linux;
pub mod w65;
pub mod x86;
Expand Down Expand Up @@ -34,6 +35,8 @@ pub fn get_properties(targ: StringView) -> Option<&'static TargetProperties<'sta
w65-*-snes-elf => Some(&builtin::elf::W65_ELF),
i86-*-near => Some(&builtin::elf::I86_NEAR_ELF),
holeybytes-*-elf => Some(&builtin::elf::HOLEYBYTES_ELF),
x86_64-*-lilium-std => Some(&builtin::lilium::X86_64_LILIUM),
clever-*-lilium-std => Some(&builtin::lilium::CLEVER_LILIUM),
* => None
}
}
Expand Down
23 changes: 23 additions & 0 deletions lccc/src/targets/builtin/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ pub static X86_64_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("SysV64"),
default_tag_name: const_sv!("SysV64"),
custom_properties: span![],
};

pub static X32_ELF: TargetProperties = TargetProperties {
Expand All @@ -207,6 +208,7 @@ pub static X32_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("SysV64"),
default_tag_name: const_sv!("SysV64"),
custom_properties: span![],
};

pub static I386_ELF: TargetProperties = TargetProperties {
Expand All @@ -218,6 +220,7 @@ pub static I386_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("cdecl"),
default_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};

pub static I486_ELF: TargetProperties = TargetProperties {
Expand All @@ -229,6 +232,7 @@ pub static I486_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("cdecl"),
default_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};
pub static I586_ELF: TargetProperties = TargetProperties {
primitives: &X86_32_PRIMITIVES,
Expand All @@ -239,6 +243,7 @@ pub static I586_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("cdecl"),
default_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};
pub static I686_ELF: TargetProperties = TargetProperties {
primitives: &X86_32_PRIMITIVES,
Expand All @@ -249,6 +254,7 @@ pub static I686_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("cdecl"),
default_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};

pub static I86_NEAR_ELF: TargetProperties = TargetProperties {
Expand All @@ -260,6 +266,7 @@ pub static I86_NEAR_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("cdecl"),
default_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};

pub static I86_FAR_ELF: TargetProperties = TargetProperties {
Expand All @@ -271,6 +278,7 @@ pub static I86_FAR_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("cdecl"),
default_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};

pub static I86_NEAR_DATA_FAR_FN_ELF: TargetProperties = TargetProperties {
Expand All @@ -282,6 +290,7 @@ pub static I86_NEAR_DATA_FAR_FN_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("cdecl"),
default_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};

pub static I86_FAR_DATA_NEAR_FN_ELF: TargetProperties = TargetProperties {
Expand All @@ -293,6 +302,7 @@ pub static I86_FAR_DATA_NEAR_FN_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
system_tag_name: const_sv!("cdecl"),
default_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};

pub static CLEVER_ELF_LINK: LinkProperties = LinkProperties {
Expand Down Expand Up @@ -337,6 +347,10 @@ pub static CLEVER_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("C"),
system_tag_name: const_sv!("C"),
custom_properties: span![Pair(
const_sv!("lcrust:abi-v0/simd-adjustment-required"),
const_sv!("false")
)],
};

pub static CLEVERILP32_ELF: TargetProperties = TargetProperties {
Expand All @@ -348,6 +362,10 @@ pub static CLEVERILP32_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("C"),
system_tag_name: const_sv!("C"),
custom_properties: span![Pair(
const_sv!("lcrust:abi-v0/simd-adjustment-required"),
const_sv!("false")
)],
};

pub static W65_ELF_LINK: LinkProperties = LinkProperties {
Expand All @@ -373,6 +391,10 @@ pub static W65_ELF: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("C"),
system_tag_name: const_sv!("C"),
custom_properties: span![Pair(
const_sv!("lcrust:abi-v0/simd-adjustment-required"),
const_sv!("false")
)],
};

pub static HOLEYBYTES_ELF_LINK: LinkProperties = LinkProperties {
Expand All @@ -398,4 +420,5 @@ pub static HOLEYBYTES_ELF: TargetProperties = TargetProperties {
abis: span![],
default_tag_name: const_sv!("C"),
system_tag_name: const_sv!("C"),
custom_properties: span![],
};
73 changes: 73 additions & 0 deletions lccc/src/targets/builtin/lilium.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
use xlang::prelude::v1::*;
use xlang::targets::properties::*;

use super::clever::*;
use super::x86::*;

pub static CLEVER_LILIUM_LINK: LinkProperties = LinkProperties {
libdirs: span![const_sv!("lib")],
default_libs: span![const_sv!("usi")],
startfiles: span![const_sv!("libusi-init.a")],
endfiles: span![],
available_formats: span![],
interp: const_sv!("ld-lilium-clever.so"),
obj_binfmt: const_sv!("elf64-clever"),
lib_binfmt: const_sv!("elf64-clever"),
exec_binfmt: const_sv!("elf64-clever"),
stack_attribute_control: StackAttributeControlStyle::NoExec,
uwtable_method: UnwindStyle::Itanium,
};

pub static X86_64_LILIUM_LINK: LinkProperties = LinkProperties {
libdirs: span![const_sv!("lib")],
default_libs: span![const_sv!("usi")],
startfiles: span![const_sv!("libusi-init.a")],
endfiles: span![],
available_formats: span![],
interp: const_sv!("ld-lilium-x86-64.so"),
obj_binfmt: const_sv!("elf64-x86_64"),
lib_binfmt: const_sv!("elf64-x86_64"),
exec_binfmt: const_sv!("elf64-x86_64"),
stack_attribute_control: StackAttributeControlStyle::NoExec,
uwtable_method: UnwindStyle::Itanium,
};

pub static LILIUM: OperatingSystemProperties = OperatingSystemProperties {
is_unix_like: false,
is_windows_like: false,
os_family: span![const_sv!("lilium")],
static_prefix: const_sv!("lib"),
static_suffix: const_sv!(".a"),
shared_prefix: const_sv!("lib"),
shared_suffix: const_sv!(".so"),
exec_suffix: const_sv!(""),
obj_suffix: const_sv!(".o"),
ld_flavour: LinkerFlavor::Ld,
ar_flavour: ArchiverFlavor::Ar,
base_dirs: span![const_sv!("/"), const_sv!("/usr"), const_sv!("/usr/local")],
so_kind: SharedLibraryStyle::Linkable,
};

pub static X86_64_LILIUM: TargetProperties = TargetProperties {
primitives: &X86_64_PRIMITIVES,
os: &LILIUM,
arch: &X86_64,
link: &X86_64_LILIUM_LINK,
abis: span![],
enabled_features: span![],
default_tag_name: const_sv!("SysV64"),
system_tag_name: const_sv!("SysV64"),
custom_properties: span![],
};

pub static CLEVER_LILIUM: TargetProperties = TargetProperties {
primitives: &CLEVER_PRIMITIVES,
os: &LILIUM,
arch: &CLEVER,
link: &CLEVER_LILIUM_LINK,
abis: span![],
enabled_features: span![],
default_tag_name: const_sv!("C"),
system_tag_name: const_sv!("C"),
custom_properties: span![],
};
10 changes: 10 additions & 0 deletions lccc/src/targets/builtin/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ pub static X86_64_LINUX_GNU: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("SysV64"),
system_tag_name: const_sv!("SysV64"),
custom_properties: span![],
};

pub static X86_64_V2_LINUX_GNU: TargetProperties = TargetProperties {
Expand All @@ -140,6 +141,7 @@ pub static X86_64_V2_LINUX_GNU: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("SysV64"),
system_tag_name: const_sv!("SysV64"),
custom_properties: span![],
};

pub static X86_64_V3_LINUX_GNU: TargetProperties = TargetProperties {
Expand All @@ -151,6 +153,7 @@ pub static X86_64_V3_LINUX_GNU: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("SysV64"),
system_tag_name: const_sv!("SysV64"),
custom_properties: span![],
};

pub static X86_64_V4_LINUX_GNU: TargetProperties = TargetProperties {
Expand All @@ -162,6 +165,7 @@ pub static X86_64_V4_LINUX_GNU: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("SysV64"),
system_tag_name: const_sv!("SysV64"),
custom_properties: span![],
};

pub static X32_LINUX_GNU: TargetProperties = TargetProperties {
Expand All @@ -173,6 +177,7 @@ pub static X32_LINUX_GNU: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("SysV64"),
system_tag_name: const_sv!("SysV64"),
custom_properties: span![],
};

pub static I686_LINUX_GNU: TargetProperties = TargetProperties {
Expand All @@ -184,6 +189,7 @@ pub static I686_LINUX_GNU: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("cdecl"),
system_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};

pub static I586_LINUX_GNU: TargetProperties = TargetProperties {
Expand All @@ -195,6 +201,7 @@ pub static I586_LINUX_GNU: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("cdecl"),
system_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};
pub static I486_LINUX_GNU: TargetProperties = TargetProperties {
primitives: &X86_32_PRIMITIVES,
Expand All @@ -205,6 +212,7 @@ pub static I486_LINUX_GNU: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("cdecl"),
system_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};
pub static I386_LINUX_GNU: TargetProperties = TargetProperties {
primitives: &X86_32_PRIMITIVES,
Expand All @@ -215,6 +223,7 @@ pub static I386_LINUX_GNU: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("cdecl"),
system_tag_name: const_sv!("cdecl"),
custom_properties: span![],
};

pub static X86_64_LINUX_MUSL: TargetProperties = TargetProperties {
Expand All @@ -226,4 +235,5 @@ pub static X86_64_LINUX_MUSL: TargetProperties = TargetProperties {
enabled_features: span![],
default_tag_name: const_sv!("SysV64"),
system_tag_name: const_sv!("SysV64"),
custom_properties: span![],
};
Loading

0 comments on commit 5aa68a3

Please sign in to comment.