diff --git a/Cargo.lock b/Cargo.lock index cdb05baa0f..30bfdff722 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2128,22 +2128,21 @@ dependencies = [ [[package]] name = "object" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" +checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" + +[[package]] +name = "object" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5b3dd1c072ee7963717671d1ca129f1048fda25edea6b752bfc71ac8854170" dependencies = [ "crc32fast", "flate2", "indexmap", - "wasmparser", ] -[[package]] -name = "object" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" - [[package]] name = "once_cell" version = "1.7.2" @@ -3185,7 +3184,7 @@ dependencies = [ "libc", "libloading 0.6.7", "maplit", - "object 0.22.0", + "object 0.24.0", "pretty_assertions 0.5.1", "quickcheck 0.8.5", "quickcheck_macros 0.8.0", @@ -4199,12 +4198,6 @@ version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" -[[package]] -name = "wasmparser" -version = "0.57.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6" - [[package]] name = "wayland-client" version = "0.28.5" diff --git a/cli/tests/fixtures/multi-dep-str/platform/Pkg-Config.roc b/cli/tests/fixtures/multi-dep-str/platform/Package-Config.roc similarity index 100% rename from cli/tests/fixtures/multi-dep-str/platform/Pkg-Config.roc rename to cli/tests/fixtures/multi-dep-str/platform/Package-Config.roc diff --git a/cli/tests/fixtures/multi-dep-thunk/platform/Pkg-Config.roc b/cli/tests/fixtures/multi-dep-thunk/platform/Package-Config.roc similarity index 100% rename from cli/tests/fixtures/multi-dep-thunk/platform/Pkg-Config.roc rename to cli/tests/fixtures/multi-dep-thunk/platform/Package-Config.roc diff --git a/compiler/build/src/lib.rs b/compiler/build/src/lib.rs index e2abf50874..7ee0e97721 100644 --- a/compiler/build/src/lib.rs +++ b/compiler/build/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] pub mod link; diff --git a/compiler/builtins/src/lib.rs b/compiler/builtins/src/lib.rs index a8e7c6cf08..a7bd2f3fe8 100644 --- a/compiler/builtins/src/lib.rs +++ b/compiler/builtins/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] pub mod bitcode; diff --git a/compiler/can/src/lib.rs b/compiler/can/src/lib.rs index 158426477e..7230ab1a36 100644 --- a/compiler/can/src/lib.rs +++ b/compiler/can/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] pub mod annotation; diff --git a/compiler/collections/src/lib.rs b/compiler/collections/src/lib.rs index 5f54b3f3a1..885d50b458 100644 --- a/compiler/collections/src/lib.rs +++ b/compiler/collections/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] diff --git a/compiler/constrain/src/lib.rs b/compiler/constrain/src/lib.rs index 2304b8a738..94067ab076 100644 --- a/compiler/constrain/src/lib.rs +++ b/compiler/constrain/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] pub mod builtins; diff --git a/compiler/fmt/src/lib.rs b/compiler/fmt/src/lib.rs index db3530b0aa..23b40379d5 100644 --- a/compiler/fmt/src/lib.rs +++ b/compiler/fmt/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] pub mod annotation; diff --git a/compiler/gen/src/lib.rs b/compiler/gen/src/lib.rs index a10c76ef63..092cf0b8a8 100644 --- a/compiler/gen/src/lib.rs +++ b/compiler/gen/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] // we actually want to compare against the literal float bits diff --git a/compiler/gen_dev/Cargo.toml b/compiler/gen_dev/Cargo.toml index 92534238f3..b960c7468e 100644 --- a/compiler/gen_dev/Cargo.toml +++ b/compiler/gen_dev/Cargo.toml @@ -23,7 +23,7 @@ bumpalo = { version = "3.6.1", features = ["collections"] } inlinable_string = "0.1" target-lexicon = "0.10" libloading = "0.6" -object = { version = "0.22", features = ["write"] } +object = { version = "0.24", features = ["write"] } [dev-dependencies] roc_can = { path = "../can" } diff --git a/compiler/gen_dev/src/lib.rs b/compiler/gen_dev/src/lib.rs index 8280efe65e..6f805efcca 100644 --- a/compiler/gen_dev/src/lib.rs +++ b/compiler/gen_dev/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant, clippy::upper_case_acronyms)] diff --git a/compiler/gen_dev/src/object_builder.rs b/compiler/gen_dev/src/object_builder.rs index 2c3398c2da..be16da281a 100644 --- a/compiler/gen_dev/src/object_builder.rs +++ b/compiler/gen_dev/src/object_builder.rs @@ -13,7 +13,9 @@ use roc_mono::ir::Proc; use roc_mono::layout::Layout; use target_lexicon::{Architecture as TargetArch, BinaryFormat as TargetBF, Triple}; -const VERSION: &str = env!("CARGO_PKG_VERSION"); +// This is used by some code below which is currently commented out. +// See that code for more details! +// const VERSION: &str = env!("CARGO_PKG_VERSION"); /// build_module is the high level builder/delegator. /// It takes the request to build a module and output the object file for the module. @@ -41,6 +43,28 @@ pub fn build_module<'a>( Object::new(BinaryFormat::Elf, Architecture::X86_64, Endianness::Little), ) } + Triple { + architecture: TargetArch::X86_64, + binary_format: TargetBF::Macho, + .. + } => { + let backend: Backend64Bit< + x86_64::X86_64GeneralReg, + x86_64::X86_64FloatReg, + x86_64::X86_64Assembler, + x86_64::X86_64SystemV, + > = Backend::new(env, target)?; + build_object( + env, + procedures, + backend, + Object::new( + BinaryFormat::MachO, + Architecture::X86_64, + Endianness::Little, + ), + ) + } Triple { architecture: TargetArch::Aarch64(_), binary_format: TargetBF::Elf, @@ -72,12 +96,16 @@ fn build_object<'a, B: Backend<'a>>( mut output: Object, ) -> Result { let data_section = output.section_id(StandardSection::Data); - let comment = output.add_section(vec![], b"comment".to_vec(), SectionKind::OtherString); + + /* + // Commented out because we couldn't figure out how to get it to work on mac - see https://github.com/rtfeldman/roc/pull/1323 + let comment = output.add_section(vec![], b".comment".to_vec(), SectionKind::OtherString); output.append_section_data( comment, format!("\0roc dev backend version {} \0", VERSION).as_bytes(), 1, ); + */ // Setup layout_ids for procedure calls. let mut layout_ids = roc_mono::layout::LayoutIds::default(); @@ -89,7 +117,7 @@ fn build_object<'a, B: Backend<'a>>( let section_id = output.add_section( output.segment_name(StandardSegment::Text).to_vec(), - format!(".text.{}", fn_name).as_bytes().to_vec(), + format!(".text.{:x}", sym.as_u64()).as_bytes().to_vec(), SectionKind::Text, ); @@ -182,7 +210,7 @@ fn build_object<'a, B: Backend<'a>>( offset: offset + proc_offset, size: 32, kind: RelocationKind::PltRelative, - encoding: RelocationEncoding::Generic, + encoding: RelocationEncoding::X86Branch, symbol: sym_id, addend: -4, } diff --git a/compiler/gen_dev/tests/gen_num.rs b/compiler/gen_dev/tests/gen_num.rs index 68b2dca31c..6110845818 100644 --- a/compiler/gen_dev/tests/gen_num.rs +++ b/compiler/gen_dev/tests/gen_num.rs @@ -10,7 +10,7 @@ extern crate libc; #[macro_use] mod helpers; -#[cfg(all(test, target_os = "linux", any(target_arch = "x86_64"/*, target_arch = "aarch64"*/)))] +#[cfg(all(test, any(target_os = "linux", target_os = "macos"), any(target_arch = "x86_64"/*, target_arch = "aarch64"*/)))] mod gen_num { #[test] fn i64_values() { diff --git a/compiler/load/src/file.rs b/compiler/load/src/file.rs index a8015f4b6f..aea50c1edb 100644 --- a/compiler/load/src/file.rs +++ b/compiler/load/src/file.rs @@ -51,7 +51,7 @@ const DEFAULT_APP_OUTPUT_PATH: &str = "app"; const ROC_FILE_EXTENSION: &str = "roc"; /// Roc-Config file name -const PKG_CONFIG_FILE_NAME: &str = "Pkg-Config"; +const PKG_CONFIG_FILE_NAME: &str = "Package-Config"; /// The . in between module names like Foo.Bar.Baz const MODULE_SEPARATOR: char = '.'; @@ -1892,7 +1892,7 @@ fn update<'a>( let work = state.dependencies.notify(module_id, Phase::SolveTypes); - // if there is a platform, the Pkg-Config module provides host-exposed, + // if there is a platform, the Package-Config module provides host-exposed, // otherwise the App module exposes host-exposed let is_host_exposed = match state.platform_id { None => module_id == state.root_id, @@ -2320,7 +2320,7 @@ fn load_pkg_config<'a>( let chomped = &bytes[..delta]; let header_src = unsafe { std::str::from_utf8_unchecked(chomped) }; - // make a Pkg-Config module that ultimately exposes `main` to the host + // make a Package-Config module that ultimately exposes `main` to the host let pkg_config_module_msg = fabricate_pkg_config_module( arena, shorthand, @@ -2559,7 +2559,7 @@ fn parse_header<'a>( }) => { match package_or_path { PackageOrPath::Path(StrLiteral::PlainLine(package)) => { - // check whether we can find a Pkg-Config.roc file + // check whether we can find a Package-Config.roc file let mut pkg_config_roc = pkg_config_dir; pkg_config_roc.push(package); pkg_config_roc.push(PKG_CONFIG_FILE_NAME); diff --git a/compiler/load/src/lib.rs b/compiler/load/src/lib.rs index 977b57afef..7b73ccefd5 100644 --- a/compiler/load/src/lib.rs +++ b/compiler/load/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] pub mod docs; diff --git a/compiler/module/src/lib.rs b/compiler/module/src/lib.rs index 2f88540f2d..0bd93ef98f 100644 --- a/compiler/module/src/lib.rs +++ b/compiler/module/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant, clippy::upper_case_acronyms)] diff --git a/compiler/module/src/symbol.rs b/compiler/module/src/symbol.rs index cb4fd13387..0999d013ef 100644 --- a/compiler/module/src/symbol.rs +++ b/compiler/module/src/symbol.rs @@ -86,6 +86,10 @@ impl Symbol { }) } + pub fn as_u64(self) -> u64 { + self.0 + } + pub fn fully_qualified(self, interns: &Interns, home: ModuleId) -> InlinableString { let module_id = self.module_id(); diff --git a/compiler/mono/src/lib.rs b/compiler/mono/src/lib.rs index c700d4ba01..831ff3d8c1 100644 --- a/compiler/mono/src/lib.rs +++ b/compiler/mono/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant, clippy::upper_case_acronyms)] diff --git a/compiler/parse/src/lib.rs b/compiler/parse/src/lib.rs index adb36adf78..4ebf534dd3 100644 --- a/compiler/parse/src/lib.rs +++ b/compiler/parse/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] diff --git a/compiler/problem/src/lib.rs b/compiler/problem/src/lib.rs index 333c9990a8..9da9d7b105 100644 --- a/compiler/problem/src/lib.rs +++ b/compiler/problem/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] pub mod can; diff --git a/compiler/region/src/lib.rs b/compiler/region/src/lib.rs index 5f54b3f3a1..885d50b458 100644 --- a/compiler/region/src/lib.rs +++ b/compiler/region/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] diff --git a/compiler/reporting/src/lib.rs b/compiler/reporting/src/lib.rs index c8550d9966..ff2791a5f8 100644 --- a/compiler/reporting/src/lib.rs +++ b/compiler/reporting/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] diff --git a/compiler/solve/src/lib.rs b/compiler/solve/src/lib.rs index 3d093e2c1e..3706c9d5dd 100644 --- a/compiler/solve/src/lib.rs +++ b/compiler/solve/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] diff --git a/compiler/test_gen/src/lib.rs b/compiler/test_gen/src/lib.rs index 723c3986dd..bcbe385cb3 100644 --- a/compiler/test_gen/src/lib.rs +++ b/compiler/test_gen/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] // we actually want to compare against the literal float bits diff --git a/compiler/types/src/lib.rs b/compiler/types/src/lib.rs index 7c85065bd6..780bed8621 100644 --- a/compiler/types/src/lib.rs +++ b/compiler/types/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] pub mod builtin_aliases; diff --git a/compiler/unify/src/lib.rs b/compiler/unify/src/lib.rs index 39437895b0..06addd9f5b 100644 --- a/compiler/unify/src/lib.rs +++ b/compiler/unify/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant)] diff --git a/editor/src/lib.rs b/editor/src/lib.rs index 45c2fbd68a..f94ac4ccc8 100644 --- a/editor/src/lib.rs +++ b/editor/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(clippy::all, clippy::dbg_macro)] +#![warn(clippy::dbg_macro)] // See github.com/rtfeldman/roc/issues/800 for discussion of the large_enum_variant check. #![allow(clippy::large_enum_variant, clippy::upper_case_acronyms)] diff --git a/examples/balance/platform/Pkg-Config.roc b/examples/balance/platform/Package-Config.roc similarity index 100% rename from examples/balance/platform/Pkg-Config.roc rename to examples/balance/platform/Package-Config.roc diff --git a/examples/benchmarks/platform/Pkg-Config.roc b/examples/benchmarks/platform/Package-Config.roc similarity index 100% rename from examples/benchmarks/platform/Pkg-Config.roc rename to examples/benchmarks/platform/Package-Config.roc diff --git a/examples/cli/platform/Pkg-Config.roc b/examples/cli/platform/Package-Config.roc similarity index 100% rename from examples/cli/platform/Pkg-Config.roc rename to examples/cli/platform/Package-Config.roc diff --git a/examples/custom-malloc/platform/Pkg-Config.roc b/examples/custom-malloc/platform/Package-Config.roc similarity index 100% rename from examples/custom-malloc/platform/Pkg-Config.roc rename to examples/custom-malloc/platform/Package-Config.roc diff --git a/examples/effect/thing/platform-dir/Pkg-Config.roc b/examples/effect/thing/platform-dir/Package-Config.roc similarity index 100% rename from examples/effect/thing/platform-dir/Pkg-Config.roc rename to examples/effect/thing/platform-dir/Package-Config.roc diff --git a/examples/hello-world/platform/Pkg-Config.roc b/examples/hello-world/platform/Package-Config.roc similarity index 100% rename from examples/hello-world/platform/Pkg-Config.roc rename to examples/hello-world/platform/Package-Config.roc diff --git a/examples/quicksort/platform/Pkg-Config.roc b/examples/quicksort/platform/Package-Config.roc similarity index 85% rename from examples/quicksort/platform/Pkg-Config.roc rename to examples/quicksort/platform/Package-Config.roc index 7df43c5c9a..9569118e7b 100644 --- a/examples/quicksort/platform/Pkg-Config.roc +++ b/examples/quicksort/platform/Package-Config.roc @@ -6,5 +6,5 @@ platform examples/quicksort provides [ mainForHost ] effects fx.Effect {} -mainForHost : List I64 -> List I64 +mainForHost : List I64 -> List I64 mainForHost = \list -> quicksort list diff --git a/examples/shared-quicksort/platform/Pkg-Config.roc b/examples/shared-quicksort/platform/Package-Config.roc similarity index 89% rename from examples/shared-quicksort/platform/Pkg-Config.roc rename to examples/shared-quicksort/platform/Package-Config.roc index 061e86aaa6..25f96b0da9 100644 --- a/examples/shared-quicksort/platform/Pkg-Config.roc +++ b/examples/shared-quicksort/platform/Package-Config.roc @@ -11,6 +11,5 @@ platform examples/shared-quicksort getLine : Effect Str } -mainForHost : List I64 -> List I64 +mainForHost : List I64 -> List I64 mainForHost = \list -> quicksort list - diff --git a/examples/task/platform/Pkg-Config.roc b/examples/task/platform/Package-Config.roc similarity index 100% rename from examples/task/platform/Pkg-Config.roc rename to examples/task/platform/Package-Config.roc diff --git a/examples/tea/platform/Pkg-Config.roc b/examples/tea/platform/Package-Config.roc similarity index 93% rename from examples/tea/platform/Pkg-Config.roc rename to examples/tea/platform/Package-Config.roc index 6e49599ae7..4cd85a5fd5 100644 --- a/examples/tea/platform/Pkg-Config.roc +++ b/examples/tea/platform/Package-Config.roc @@ -11,9 +11,9 @@ platform folkertdev/foo getLine : Effect Str } -mainForHost : +mainForHost : { init : ({} -> { model: I64 as Model, cmd : (Cmd.Cmd [ Line Str ]) as Fx }) as Init, update : ([ Line Str ], I64 -> { model: I64, cmd : Cmd.Cmd [ Line Str ] } ) as Update } -mainForHost = main +mainForHost = main