diff --git a/Cargo.lock b/Cargo.lock index d571066..99ac3da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,9 +77,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -89,14 +89,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "console" -version = "0.15.4" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b6515d269224923b26b5febea2ed42b2d5f2ce37284a4dd670fedd6cb8347a" +checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" dependencies = [ "encode_unicode", "lazy_static", "libc", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" dependencies = [ "cfg-if", "crossbeam-utils", @@ -125,9 +125,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.13" +version = "0.9.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" dependencies = [ "autocfg", "cfg-if", @@ -159,9 +159,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ "cfg-if", ] @@ -201,15 +201,15 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "ena" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" +checksum = "b2e5d13ca2353ab7d0230988629def93914a8c4015f621f9b13ed2955614731d" dependencies = [ "log", ] @@ -220,11 +220,32 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] @@ -300,14 +321,15 @@ dependencies = [ [[package]] name = "indoc" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2d6f23ffea9d7e76c53eee25dfb67bcd8fde7f1198b0855350698c9f07c780" +checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" [[package]] name = "inkwell" -version = "0.1.0" -source = "git+https://github.com/TheDan64/inkwell.git#3c5d7706861aac0750b4f0c98d6fcf8a91a2ca0a" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbac11e485159a525867fb7e6aa61981453e6a72f625fde6a4ab3047b0c6dec9" dependencies = [ "either", "inkwell_internals", @@ -319,8 +341,9 @@ dependencies = [ [[package]] name = "inkwell_internals" -version = "0.6.0" -source = "git+https://github.com/TheDan64/inkwell.git#3c5d7706861aac0750b4f0c98d6fcf8a91a2ca0a" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87d00c17e264ce02be5bc23d7bff959188ec7137beddd06b8b6b05a7c680ea85" dependencies = [ "proc-macro2", "quote", @@ -350,6 +373,16 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -361,9 +394,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "lalrpop" @@ -425,11 +458,17 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + [[package]] name = "llvm-sys" -version = "140.0.3" +version = "150.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9eda9cc6f86672152125b1e112d66ab8797b7917fb202e2faee912caa76413" +checksum = "64be8a29d08e3165e4ed989b80cbc6b52104c543f16e272b83e2dedb749e81e6" dependencies = [ "cc", "lazy_static", @@ -465,9 +504,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] @@ -563,9 +602,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "parking_lot" @@ -579,22 +618,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "petgraph" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", "indexmap", @@ -665,9 +704,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] @@ -757,9 +796,9 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "rayon" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" dependencies = [ "either", "rayon-core", @@ -767,9 +806,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -815,32 +854,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +name = "runkernel" +version = "0.1.0" dependencies = [ - "winapi", + "libloading", ] [[package]] -name = "runkernel" -version = "0.1.0" +name = "rustix" +version = "0.36.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" dependencies = [ - "libloading", + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.45.0", ] [[package]] name = "rustversion" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "scopeguard" @@ -856,18 +900,18 @@ checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "3a382c72b4ba118526e187430bb4963cd6d55051ebf13d9b25574d379cc98d20" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "1ef476a5790f0f6decbc66726b6e5d63680ed518283e64c7df415989d880954f" dependencies = [ "proc-macro2", "quote", @@ -876,9 +920,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" dependencies = [ "itoa", "ryu", @@ -928,9 +972,9 @@ dependencies = [ [[package]] name = "string_cache" -version = "0.8.4" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ "new_debug_unreachable", "once_cell", @@ -941,9 +985,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -952,22 +996,21 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d" +checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" [[package]] name = "tempfile" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" dependencies = [ "cfg-if", "fastrand", - "libc", "redox_syscall", - "remove_dir_all", - "winapi", + "rustix", + "windows-sys 0.42.0", ] [[package]] @@ -996,18 +1039,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" dependencies = [ "proc-macro2", "quote", @@ -1077,9 +1120,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-xid" @@ -1148,47 +1191,71 @@ dependencies = [ "windows_x86_64_msvc", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "yaml-rust" diff --git a/flake.lock b/flake.lock index 0998426..94c4dda 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1673345971, - "narHash": "sha256-4DfFcKLRfVUTyuGrGNNmw37IeIZSoku9tgTVmu/iD98=", + "lastModified": 1678137616, + "narHash": "sha256-T+lWTRdcYaOnZQW+Ehdlg+YldC2l9cq2GXJFPq22Nxc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "54644f409ab471e87014bb305eac8c50190bcf48", + "rev": "7edcdf7b169c33cd3eef9aba50521ce93ee666b8", "type": "github" }, "original": { diff --git a/nac3artiq/Cargo.toml b/nac3artiq/Cargo.toml index 9ccea86..588188c 100644 --- a/nac3artiq/Cargo.toml +++ b/nac3artiq/Cargo.toml @@ -17,9 +17,9 @@ nac3core = { path = "../nac3core" } nac3ld = { path = "../nac3ld" } [dependencies.inkwell] -git = "https://github.com/TheDan64/inkwell.git" +version = "0.1.1" default-features = false -features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] +features = ["llvm15-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] [features] init-llvm-profile = [] diff --git a/nac3core/Cargo.toml b/nac3core/Cargo.toml index 9108360..b2e7611 100644 --- a/nac3core/Cargo.toml +++ b/nac3core/Cargo.toml @@ -13,9 +13,9 @@ nac3parser = { path = "../nac3parser" } lazy_static = "1.4" [dependencies.inkwell] -git = "https://github.com/TheDan64/inkwell.git" +version = "0.1.1" default-features = false -features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] +features = ["llvm15-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] [dev-dependencies] test-case = "1.2.0" diff --git a/nac3core/src/codegen/expr.rs b/nac3core/src/codegen/expr.rs index faff3e4..21b9447 100644 --- a/nac3core/src/codegen/expr.rs +++ b/nac3core/src/codegen/expr.rs @@ -119,6 +119,7 @@ impl<'ctx, 'a> CodeGenContext<'ctx, 'a> { unsafe { for (i, val) in vals.into_iter().enumerate() { let p = self.builder.build_in_bounds_gep( + ptr.get_type(), ptr, &[zero, self.ctx.i32_type().const_int(i as u64, false)], "elemptr", @@ -126,7 +127,7 @@ impl<'ctx, 'a> CodeGenContext<'ctx, 'a> { self.builder.build_store(p, val); } } - self.builder.build_load(ptr, "tup_val") + self.builder.build_load(ptr.get_type(), ptr, "tup_val") } SymbolValue::OptionSome(v) => { let ty = match self.unifier.get_ty_immutable(ty).as_ref() { @@ -396,7 +397,7 @@ impl<'ctx, 'a> CodeGenContext<'ctx, 'a> { self.builder.build_call(fun, ¶m, call_name).try_as_basic_value().left() }; if let Some(slot) = return_slot { - Some(self.builder.build_load(slot, call_name)) + Some(self.builder.build_load(slot.get_type(), slot, call_name)) } else { result } @@ -424,10 +425,11 @@ impl<'ctx, 'a> CodeGenContext<'ctx, 'a> { let int32 = self.ctx.i32_type(); let zero = int32.const_zero(); unsafe { - let id_ptr = self.builder.build_in_bounds_gep(zelf, &[zero, zero], "exn.id"); + let id_ptr = self.builder.build_in_bounds_gep(zelf.get_type(), zelf, &[zero, zero], "exn.id"); let id = self.resolver.get_string_id(name); self.builder.build_store(id_ptr, int32.const_int(id as u64, false)); let ptr = self.builder.build_in_bounds_gep( + zelf.get_type(), zelf, &[zero, int32.const_int(5, false)], "exn.msg", @@ -436,6 +438,7 @@ impl<'ctx, 'a> CodeGenContext<'ctx, 'a> { let i64_zero = self.ctx.i64_type().const_zero(); for (i, attr_ind) in [6, 7, 8].iter().enumerate() { let ptr = self.builder.build_in_bounds_gep( + zelf.get_type(), zelf, &[zero, int32.const_int(*attr_ind, false)], "exn.param", @@ -779,6 +782,7 @@ pub fn allocate_list<'ctx, 'a, G: CodeGenerator>( let arr_str_ptr = ctx.builder.build_alloca(arr_ty, "tmparrstr"); unsafe { let len_ptr = ctx.builder.build_in_bounds_gep( + arr_str_ptr.get_type(), arr_str_ptr, &[zero, i32_t.const_int(1, false)], "len_ptr", @@ -786,7 +790,7 @@ pub fn allocate_list<'ctx, 'a, G: CodeGenerator>( let length = ctx.builder.build_int_z_extend(length, size_t, "zext"); ctx.builder.build_store(len_ptr, length); let ptr_to_arr = - ctx.builder.build_in_bounds_gep(arr_str_ptr, &[zero, i32_t.const_zero()], "ptr_to_arr"); + ctx.builder.build_in_bounds_gep(arr_str_ptr.get_type(), arr_str_ptr, &[zero, i32_t.const_zero()], "ptr_to_arr"); ctx.builder.build_store(ptr_to_arr, arr_ptr); arr_str_ptr } @@ -861,7 +865,7 @@ pub fn gen_comprehension<'ctx, 'a, G: CodeGenerator>( ctx.builder.build_int_compare(inkwell::IntPredicate::SGT, step, zero_32, "sign"); // add and test let tmp = ctx.builder.build_int_add( - ctx.builder.build_load(i, "i").into_int_value(), + ctx.builder.build_load(i.get_type(), i, "i").into_int_value(), step, "start_loop", ); @@ -893,7 +897,7 @@ pub fn gen_comprehension<'ctx, 'a, G: CodeGenerator>( ctx.builder.build_store(counter, size_t.const_int(u64::max_value(), true)); ctx.builder.build_unconditional_branch(test_bb); ctx.builder.position_at_end(test_bb); - let tmp = ctx.builder.build_load(counter, "i").into_int_value(); + let tmp = ctx.builder.build_load(counter.get_type(), counter, "i").into_int_value(); let tmp = ctx.builder.build_int_add(tmp, size_t.const_int(1, false), "inc"); ctx.builder.build_store(counter, tmp); let cmp = ctx.builder.build_int_compare(inkwell::IntPredicate::SLT, tmp, length, "cmp"); @@ -916,8 +920,8 @@ pub fn gen_comprehension<'ctx, 'a, G: CodeGenerator>( ctx.builder.position_at_end(succ); } let elem = generator.gen_expr(ctx, elt)?.unwrap(); - let i = ctx.builder.build_load(index, "i").into_int_value(); - let elem_ptr = unsafe { ctx.builder.build_gep(list_content, &[i], "elem_ptr") }; + let i = ctx.builder.build_load(index.get_type(), index, "i").into_int_value(); + let elem_ptr = unsafe { ctx.builder.build_gep(list_content.get_type(), list_content, &[i], "elem_ptr") }; let val = elem.to_basic_value_enum(ctx, generator, elt.custom.unwrap())?; ctx.builder.build_store(elem_ptr, val); ctx.builder @@ -925,9 +929,9 @@ pub fn gen_comprehension<'ctx, 'a, G: CodeGenerator>( ctx.builder.build_unconditional_branch(test_bb); ctx.builder.position_at_end(cont_bb); let len_ptr = unsafe { - ctx.builder.build_gep(list, &[zero_size_t, int32.const_int(1, false)], "length") + ctx.builder.build_gep(list.get_type(), list, &[zero_size_t, int32.const_int(1, false)], "length") }; - ctx.builder.build_store(len_ptr, ctx.builder.build_load(index, "index")); + ctx.builder.build_store(len_ptr, ctx.builder.build_load(index.get_type(), index, "index")); Ok(list.into()) } else { unreachable!() @@ -1046,7 +1050,7 @@ pub fn gen_expr<'ctx, 'a, G: CodeGenerator>( ctx.debug_info.2, None, ); - ctx.builder.set_current_debug_location(ctx.ctx, loc); + ctx.builder.set_current_debug_location(loc); Ok(Some(match &expr.node { ExprKind::Constant { value, .. } => { @@ -1070,7 +1074,7 @@ pub fn gen_expr<'ctx, 'a, G: CodeGenerator>( } } ExprKind::Name { id, .. } => match ctx.var_assignment.get(id) { - Some((ptr, None, _)) => ctx.builder.build_load(*ptr, "load").into(), + Some((ptr, None, _)) => ctx.builder.build_load(ptr.get_type(), *ptr, "load").into(), Some((_, Some(static_value), _)) => ValueEnum::Static(static_value.clone()), None => { let resolver = ctx.resolver.clone(); @@ -1106,6 +1110,7 @@ pub fn gen_expr<'ctx, 'a, G: CodeGenerator>( unsafe { for (i, v) in elements.iter().enumerate() { let elem_ptr = ctx.builder.build_gep( + arr_ptr.get_type(), arr_ptr, &[int32.const_int(i as u64, false)], "elem_ptr", @@ -1130,6 +1135,7 @@ pub fn gen_expr<'ctx, 'a, G: CodeGenerator>( for (i, v) in element_val.into_iter().enumerate() { unsafe { let ptr = ctx.builder.build_in_bounds_gep( + tuple_ptr.get_type(), tuple_ptr, &[zero, int32.const_int(i as u64, false)], "ptr", @@ -1137,7 +1143,7 @@ pub fn gen_expr<'ctx, 'a, G: CodeGenerator>( ctx.builder.build_store(ptr, v); } } - ctx.builder.build_load(tuple_ptr, "tup_val").into() + ctx.builder.build_load(tuple_ptr.get_type(), tuple_ptr, "tup_val").into() } ExprKind::Attribute { value, attr, .. } => { // note that we would handle class methods directly in calls @@ -1370,7 +1376,7 @@ pub fn gen_expr<'ctx, 'a, G: CodeGenerator>( ctx.builder.position_at_end(cont_bb); match result { None => return Ok(None), - Some(v) => return Ok(Some(ctx.builder.build_load(v, "if_exp_val_load").into())) + Some(v) => return Ok(Some(ctx.builder.build_load(v.get_type(), v, "if_exp_val_load").into())) } } ExprKind::Call { func, args, keywords } => { @@ -1467,6 +1473,7 @@ pub fn gen_expr<'ctx, 'a, G: CodeGenerator>( .into_pointer_type() .const_null(); return Ok(Some(ctx.builder.build_load( + ptr.get_type(), ptr, "unwrap_none_unreachable_load" ).into())); @@ -1484,6 +1491,7 @@ pub fn gen_expr<'ctx, 'a, G: CodeGenerator>( expr.location, ); return Ok(Some(ctx.builder.build_load( + ptr.get_type(), ptr, "unwrap_some_load" ).into())) diff --git a/nac3core/src/codegen/irrt/mod.rs b/nac3core/src/codegen/irrt/mod.rs index ca2d836..e707312 100644 --- a/nac3core/src/codegen/irrt/mod.rs +++ b/nac3core/src/codegen/irrt/mod.rs @@ -426,7 +426,7 @@ pub fn list_slice_assignment<'ctx, 'a>( let cont_bb = ctx.ctx.append_basic_block(current, "cont"); ctx.builder.build_conditional_branch(need_update, update_bb, cont_bb); ctx.builder.position_at_end(update_bb); - let dest_len_ptr = unsafe { ctx.builder.build_gep(dest_arr, &[zero, one], "dest_len_ptr") }; + let dest_len_ptr = unsafe { ctx.builder.build_gep(dest_arr.get_type(), dest_arr, &[zero, one], "dest_len_ptr") }; let new_len = ctx.builder.build_int_z_extend_or_bit_cast(new_len, size_ty, "new_len"); ctx.builder.build_store(dest_len_ptr, new_len); ctx.builder.build_unconditional_branch(cont_bb); diff --git a/nac3core/src/codegen/mod.rs b/nac3core/src/codegen/mod.rs index c5ba07e..72ba85e 100644 --- a/nac3core/src/codegen/mod.rs +++ b/nac3core/src/codegen/mod.rs @@ -695,7 +695,7 @@ pub fn gen_func_impl<'ctx, G: CodeGenerator, F: FnOnce(&mut G, &mut CodeGenConte func_scope.as_debug_info_scope(), None ); - code_gen_context.builder.set_current_debug_location(context, loc); + code_gen_context.builder.set_current_debug_location(loc); let result = codegen_function(generator, &mut code_gen_context); diff --git a/nac3core/src/codegen/stmt.rs b/nac3core/src/codegen/stmt.rs index c5758cb..76c546e 100644 --- a/nac3core/src/codegen/stmt.rs +++ b/nac3core/src/codegen/stmt.rs @@ -69,6 +69,7 @@ pub fn gen_store_target<'ctx, 'a, G: CodeGenerator>( }; unsafe { ctx.builder.build_in_bounds_gep( + ptr.get_type(), ptr, &[ ctx.ctx.i32_type().const_zero(), @@ -135,7 +136,7 @@ pub fn gen_store_target<'ctx, 'a, G: CodeGenerator>( let arr_ptr = ctx .build_gep_and_load(v, &[i32_type.const_zero(), i32_type.const_zero()]) .into_pointer_value(); - ctx.builder.build_gep(arr_ptr, &[index], "loadarrgep") + ctx.builder.build_gep(arr_ptr.get_type(), arr_ptr, &[index], "loadarrgep") } } _ => unreachable!(), @@ -251,7 +252,7 @@ pub fn gen_for<'ctx, 'a, G: CodeGenerator>( ); // add and test let tmp = ctx.builder.build_int_add( - ctx.builder.build_load(i, "i").into_int_value(), + ctx.builder.build_load(i.get_type(), i, "i").into_int_value(), step, "start_loop", ); @@ -281,7 +282,7 @@ pub fn gen_for<'ctx, 'a, G: CodeGenerator>( .into_int_value(); ctx.builder.build_unconditional_branch(test_bb); ctx.builder.position_at_end(test_bb); - let tmp = ctx.builder.build_load(counter, "i").into_int_value(); + let tmp = ctx.builder.build_load(counter.get_type(), counter, "i").into_int_value(); let tmp = ctx.builder.build_int_add(tmp, size_t.const_int(1, false), "inc"); ctx.builder.build_store(counter, tmp); let cmp = ctx.builder.build_int_compare(inkwell::IntPredicate::SLT, tmp, len, "cmp"); @@ -528,12 +529,12 @@ pub fn exn_constructor<'ctx, 'a>( if let TopLevelDef::Class { name, .. } = &*def { *name } else { unreachable!() }; let exception_name = format!("{}:{}", ctx.resolver.get_exception_id(zelf_id), zelf_name); unsafe { - let id_ptr = ctx.builder.build_in_bounds_gep(zelf, &[zero, zero], "exn.id"); + let id_ptr = ctx.builder.build_in_bounds_gep(zelf.get_type(), zelf, &[zero, zero], "exn.id"); let id = ctx.resolver.get_string_id(&exception_name); ctx.builder.build_store(id_ptr, int32.const_int(id as u64, false)); let empty_string = ctx.gen_const(generator, &Constant::Str("".into()), ctx.primitives.str); let ptr = - ctx.builder.build_in_bounds_gep(zelf, &[zero, int32.const_int(5, false)], "exn.msg"); + ctx.builder.build_in_bounds_gep(zelf.get_type(), zelf, &[zero, int32.const_int(5, false)], "exn.msg"); let msg = if !args.is_empty() { args.remove(0).1.to_basic_value_enum(ctx, generator, ctx.primitives.str)? } else { @@ -547,6 +548,7 @@ pub fn exn_constructor<'ctx, 'a>( ctx.ctx.i64_type().const_zero().into() }; let ptr = ctx.builder.build_in_bounds_gep( + zelf.get_type(), zelf, &[zero, int32.const_int(*i, false)], "exn.param", @@ -556,6 +558,7 @@ pub fn exn_constructor<'ctx, 'a>( // set file, func to empty string for i in [1, 4].iter() { let ptr = ctx.builder.build_in_bounds_gep( + zelf.get_type(), zelf, &[zero, int32.const_int(*i, false)], "exn.str", @@ -565,6 +568,7 @@ pub fn exn_constructor<'ctx, 'a>( // set ints to zero for i in [2, 3].iter() { let ptr = ctx.builder.build_in_bounds_gep( + zelf.get_type(), zelf, &[zero, int32.const_int(*i, false)], "exn.ints", @@ -587,6 +591,7 @@ pub fn gen_raise<'ctx, 'a>( let zero = int32.const_zero(); let exception = exception.into_pointer_value(); let file_ptr = ctx.builder.build_in_bounds_gep( + exception.get_type(), exception, &[zero, int32.const_int(1, false)], "file_ptr", @@ -594,12 +599,14 @@ pub fn gen_raise<'ctx, 'a>( let filename = ctx.gen_string(generator, loc.file.0); ctx.builder.build_store(file_ptr, filename); let row_ptr = ctx.builder.build_in_bounds_gep( + exception.get_type(), exception, &[zero, int32.const_int(2, false)], "row_ptr", ); ctx.builder.build_store(row_ptr, int32.const_int(loc.row as u64, false)); let col_ptr = ctx.builder.build_in_bounds_gep( + exception.get_type(), exception, &[zero, int32.const_int(3, false)], "col_ptr", @@ -609,6 +616,7 @@ pub fn gen_raise<'ctx, 'a>( let current_fun = ctx.builder.get_insert_block().unwrap().get_parent().unwrap(); let fun_name = ctx.gen_string(generator, current_fun.get_name().to_str().unwrap()); let name_ptr = ctx.builder.build_in_bounds_gep( + exception.get_type(), exception, &[zero, int32.const_int(4, false)], "name_ptr", @@ -670,7 +678,7 @@ pub fn gen_try<'ctx, 'a, G: CodeGenerator>( } else { let return_target = ctx.ctx.append_basic_block(current_fun, "try.return_target"); ctx.builder.position_at_end(return_target); - let return_value = ctx.return_buffer.map(|v| ctx.builder.build_load(v, "$ret")); + let return_value = ctx.return_buffer.map(|v| ctx.builder.build_load(v.get_type(), v, "$ret")); ctx.builder.build_return(return_value.as_ref().map(|v| v as &dyn BasicValue)); ctx.builder.position_at_end(current_block); final_proxy(ctx, return_target, return_proxy, final_data.as_mut().unwrap()); @@ -790,7 +798,7 @@ pub fn gen_try<'ctx, 'a, G: CodeGenerator>( let return_target = ctx.return_target.take().unwrap_or_else(|| { let doreturn = ctx.ctx.append_basic_block(current_fun, "try.doreturn"); ctx.builder.position_at_end(doreturn); - let return_value = ctx.return_buffer.map(|v| ctx.builder.build_load(v, "$ret")); + let return_value = ctx.return_buffer.map(|v| ctx.builder.build_load(v.get_type(), v, "$ret")); ctx.builder.build_return(return_value.as_ref().map(|v| v as &dyn BasicValue)); doreturn }); @@ -805,11 +813,12 @@ pub fn gen_try<'ctx, 'a, G: CodeGenerator>( unsafe { let zero = ctx.ctx.i32_type().const_zero(); let exnid_ptr = ctx.builder.build_gep( + exn.as_basic_value().get_type(), exn.as_basic_value().into_pointer_value(), &[zero, zero], "exnidptr", ); - Some(ctx.builder.build_load(exnid_ptr, "exnid")) + Some(ctx.builder.build_load(exnid_ptr.get_type(), exnid_ptr, "exnid")) } } else { None @@ -840,7 +849,7 @@ pub fn gen_try<'ctx, 'a, G: CodeGenerator>( let actual_id = exnid.unwrap().into_int_value(); let expected_id = ctx .builder - .build_load(exn_type.into_pointer_value(), "expected_id") + .build_load(exn_type.get_type(), exn_type.into_pointer_value(), "expected_id") .into_int_value(); let result = ctx.builder.build_int_compare(EQ, actual_id, expected_id, "exncheck"); ctx.builder.build_conditional_branch(result, handler_bb, dispatcher_cont); @@ -922,7 +931,7 @@ pub fn gen_try<'ctx, 'a, G: CodeGenerator>( ctx.builder.position_at_end(finalizer); gen_block(generator, ctx, finalbody.iter())?; if !ctx.is_terminated() { - let dest = ctx.builder.build_load(final_state, "final_dest"); + let dest = ctx.builder.build_load(final_state.get_type(), final_state, "final_dest"); ctx.builder.build_indirect_branch(dest, &final_targets); } for block in final_paths.iter() { @@ -1000,7 +1009,7 @@ pub fn gen_stmt<'ctx, 'a, G: CodeGenerator>( ctx.debug_info.2, None, ); - ctx.builder.set_current_debug_location(ctx.ctx, loc); + ctx.builder.set_current_debug_location(loc); match &stmt.node { StmtKind::Pass { .. } => {} diff --git a/nac3core/src/toplevel/builtins.rs b/nac3core/src/toplevel/builtins.rs index 15fa2e0..34bf0be 100644 --- a/nac3core/src/toplevel/builtins.rs +++ b/nac3core/src/toplevel/builtins.rs @@ -712,13 +712,15 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { let ty = int32.array_type(3); let ptr = ctx.builder.build_alloca(ty, "range"); unsafe { - let a = ctx.builder.build_in_bounds_gep(ptr, &[zero, zero], "start"); + let a = ctx.builder.build_in_bounds_gep(ty, ptr, &[zero, zero], "start"); let b = ctx.builder.build_in_bounds_gep( + ty, ptr, &[zero, int32.const_int(1, false)], "end", ); let c = ctx.builder.build_in_bounds_gep( + ty, ptr, &[zero, int32.const_int(2, false)], "step", diff --git a/nac3standalone/Cargo.toml b/nac3standalone/Cargo.toml index d814e70..fb48b2e 100644 --- a/nac3standalone/Cargo.toml +++ b/nac3standalone/Cargo.toml @@ -10,6 +10,6 @@ nac3parser = { path = "../nac3parser" } nac3core = { path = "../nac3core" } [dependencies.inkwell] -git = "https://github.com/TheDan64/inkwell.git" +version = "0.1.1" default-features = false -features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] +features = ["llvm15-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] diff --git a/nix/llvm/default.nix b/nix/llvm/default.nix index f33c16c..b99718a 100644 --- a/nix/llvm/default.nix +++ b/nix/llvm/default.nix @@ -1,7 +1,7 @@ { lib, stdenv , pkgsBuildBuild -, fetchurl -, fetchpatch +, fetchFromGitHub +, runCommand , cmake , python3 , libbfd @@ -17,15 +17,16 @@ let inherit (lib) optional optionals optionalString; - release_version = "14.0.6"; + release_version = "15.0.7"; candidate = ""; # empty or "rcN" dash-candidate = lib.optionalString (candidate != "") "-${candidate}"; version = "${release_version}${dash-candidate}"; # differentiating these (variables) is important for RCs - fetch = name: sha256: fetchurl { - url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/${name}-${release_version}${candidate}.src.tar.xz"; - inherit sha256; + monorepoSrc = fetchFromGitHub { + owner = "llvm"; + repo = "llvm-project"; + rev = "llvmorg-${version}"; + sha256 = "sha256-wjuZQyXQ/jsmvy6y1aksCcEDXGBjuhpgngF3XQJ/T4s="; }; - # Used when creating a version-suffixed symlink of libLLVM.dylib shortVersion = with lib; concatStringsSep "." (take 1 (splitString "." release_version)); @@ -34,14 +35,15 @@ in stdenv.mkDerivation (rec { pname = "llvm"; inherit version; - src = fetch pname "sha256-BQki7KrKV4H99mMeqSvHFRg/IC+dLxUUcibwI0FPYZo="; - - unpackPhase = '' - unpackFile $src - mv llvm-${release_version}* llvm - sourceRoot=$PWD/llvm + src = runCommand "${pname}-src-${version}" {} '' + mkdir -p "$out" + cp -r ${monorepoSrc}/cmake "$out" + cp -r ${monorepoSrc}/${pname} "$out" + cp -r ${monorepoSrc}/third-party "$out" ''; + sourceRoot = "${src.name}/${pname}"; + outputs = [ "out" "lib" "dev" "python" ]; nativeBuildInputs = [ cmake python3 ] @@ -106,13 +108,14 @@ in stdenv.mkDerivation (rec { LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1"; cmakeFlags = with stdenv; [ - "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/" + "-DLLVM_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/llvm" "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}" "-DLLVM_BUILD_TESTS=${if stdenv.targetPlatform.isMinGW then "OFF" else "ON"}" "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_UNWIND_TABLES=OFF" - "-DLLVM_ENABLE_THREADS=OFF" + # broken with LLVM 15.0.7: llvm/lib/Debuginfod/Debuginfod.cpp:298:23: error: 'sleep_for' is not a member of 'std::this_thread' + #"-DLLVM_ENABLE_THREADS=OFF" "-DLLVM_INCLUDE_BENCHMARKS=OFF" "-DLLVM_BUILD_TOOLS=OFF" "-DLLVM_TARGETS_TO_BUILD=X86;ARM;RISCV" @@ -164,7 +167,7 @@ in stdenv.mkDerivation (rec { --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \ --replace "$out/bin/llvm-config" "$dev/bin/llvm-config" substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \ - --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")' + --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "'"$lib"'")' '' + optionalString (stdenv.isDarwin && enableSharedLibraries) '' ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib diff --git a/nix/llvm/gnu-install-dirs.patch b/nix/llvm/gnu-install-dirs.patch index 55862ab..0ef317a 100644 --- a/nix/llvm/gnu-install-dirs.patch +++ b/nix/llvm/gnu-install-dirs.patch @@ -1,22 +1,21 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index fec956091cd5..5a766f5c5d7c 100644 +index 45399dc0537e..5d946e9e6583 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -303,6 +303,9 @@ set(LLVM_EXAMPLES_INSTALL_DIR "examples" CACHE STRING - "Path for examples subdirectory (enabled by LLVM_BUILD_EXAMPLES=ON) (defaults to 'examples')") - mark_as_advanced(LLVM_EXAMPLES_INSTALL_DIR) - -+set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING -+ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" ) -+ - # They are used as destination of target generators. - set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) - set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) +@@ -942,7 +942,7 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "") + add_subdirectory(${TENSORFLOW_AOT_PATH}/xla_aot_runtime_src + ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime) + install(TARGETS tf_xla_runtime EXPORT LLVMExports +- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime) ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime) + set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS tf_xla_runtime) + # Once we add more modules, we should handle this more automatically. + if (DEFINED LLVM_OVERRIDE_MODEL_HEADER_INLINERSIZEMODEL) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake -index fed1fec7d72e..4baed19b9e98 100644 +index 057431208322..56f0dcb258da 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake -@@ -838,8 +838,8 @@ macro(add_llvm_library name) +@@ -844,8 +844,8 @@ macro(add_llvm_library name) get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella}) install(TARGETS ${name} ${export_to_llvmexports} @@ -27,58 +26,28 @@ index fed1fec7d72e..4baed19b9e98 100644 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name}) if (NOT LLVM_ENABLE_IDE) -@@ -1056,7 +1056,7 @@ function(process_llvm_pass_plugins) - "set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})") - install(FILES - ${llvm_cmake_builddir}/LLVMConfigExtensions.cmake -- DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} -+ DESTINATION ${LLVM_INSTALL_CMAKE_DIR} - COMPONENT cmake-exports) - - set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def") -@@ -1902,7 +1902,7 @@ function(llvm_install_library_symlink name dest type) +@@ -2007,7 +2007,7 @@ function(llvm_install_library_symlink name dest type) set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX}) set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX}) - set(output_dir lib${LLVM_LIBDIR_SUFFIX}) + set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}) if(WIN32 AND "${type}" STREQUAL "SHARED") - set(output_dir bin) + set(output_dir "${CMAKE_INSTALL_BINDIR}") endif() -@@ -1913,7 +1913,7 @@ function(llvm_install_library_symlink name dest type) - - endfunction() - --function(llvm_install_symlink name dest) -+function(llvm_install_symlink name dest output_dir) - cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN}) - foreach(path ${CMAKE_MODULE_PATH}) - if(EXISTS ${path}/LLVMInstallSymlink.cmake) -@@ -1936,7 +1936,7 @@ function(llvm_install_symlink name dest) - set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX}) - - install(SCRIPT ${INSTALL_SYMLINK} -- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})" -+ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})" - COMPONENT ${component}) - - if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE) -@@ -2019,7 +2019,8 @@ function(add_llvm_tool_symlink link_name target) - endif() - - if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS) -- llvm_install_symlink(${link_name} ${target}) -+ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR) -+ llvm_install_symlink(${link_name} ${target} ${output_dir}) - endif() - endif() - endfunction() -@@ -2148,9 +2149,9 @@ function(llvm_setup_rpath name) +@@ -2271,15 +2271,15 @@ function(llvm_setup_rpath name) + + if (APPLE) + set(_install_name_dir INSTALL_NAME_DIR "@rpath") +- set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) ++ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND BUILD_SHARED_LIBS) + # $ORIGIN is not interpreted at link time by aix ld. # Since BUILD_SHARED_LIBS is only recommended for use by developers, # hardcode the rpath to build/install lib dir first in this mode. # FIXME: update this when there is better solution. - set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) -+ set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) ++ set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) elseif(UNIX) - set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) + set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) @@ -102,19 +71,10 @@ index 891c9e6d618c..8d963f3b0069 100644 list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}") diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt -index cea0c1df0a14..eedcd9450312 100644 +index d4b0ab959148..26ed981fd09f 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt -@@ -2,7 +2,7 @@ include(ExtendPath) - include(LLVMDistributionSupport) - include(FindPrefixFromConfig) - --set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) -+set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')") - set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") - - # First for users who use an installed LLVM, create the LLVMExports.cmake file. -@@ -122,7 +122,7 @@ set(LLVM_CONFIG_INCLUDE_DIRS +@@ -128,7 +128,7 @@ set(LLVM_CONFIG_INCLUDE_DIRS ) list(REMOVE_DUPLICATES LLVM_CONFIG_INCLUDE_DIRS) @@ -123,24 +83,11 @@ index cea0c1df0a14..eedcd9450312 100644 set(LLVM_CONFIG_LIBRARY_DIRS "${LLVM_CONFIG_LIBRARY_DIR}" # FIXME: Should there be other entries here? -diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake -index b5c35f706cb7..9261ab797de6 100644 ---- a/cmake/modules/LLVMInstallSymlink.cmake -+++ b/cmake/modules/LLVMInstallSymlink.cmake -@@ -6,7 +6,7 @@ include(GNUInstallDirs) - - function(install_symlink name target outdir) - set(DESTDIR $ENV{DESTDIR}) -- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}") -+ set(bindir "${DESTDIR}${outdir}/") - - message(STATUS "Creating ${name}") - diff --git a/docs/CMake.rst b/docs/CMake.rst -index 044ec8a4d39d..504d0eac3ade 100644 +index 879b7b231d4c..9c31d14e8950 100644 --- a/docs/CMake.rst +++ b/docs/CMake.rst -@@ -224,7 +224,7 @@ description is in `LLVM-related variables`_ below. +@@ -250,7 +250,7 @@ description is in `LLVM-related variables`_ below. **LLVM_LIBDIR_SUFFIX**:STRING Extra suffix to append to the directory where libraries are to be installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64`` @@ -149,72 +96,43 @@ index 044ec8a4d39d..504d0eac3ade 100644 **LLVM_PARALLEL_{COMPILE,LINK}_JOBS**:STRING Building the llvm toolchain can use a lot of resources, particularly -@@ -910,9 +910,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``). - - This file is available in two different locations. - --* ``/lib/cmake/llvm/LLVMConfig.cmake`` where -- ```` is the install prefix of an installed version of LLVM. -- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``. -+* ``LLVMConfig.cmake`` where -+ ```` is the location where LLVM CMake modules are -+ installed as part of an installed version of LLVM. This is typically -+ ``cmake/llvm/`` within the lib directory. On Linux, this is typically -+ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``. +@@ -284,6 +284,10 @@ manual, or execute ``cmake --help-variable VARIABLE_NAME``. + The path to install executables, relative to the *CMAKE_INSTALL_PREFIX*. + Defaults to "bin". - * ``/lib/cmake/llvm/LLVMConfig.cmake`` where - ```` is the root of the LLVM build tree. **Note: this is only -diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt -index b46319f24fc8..2feabd1954e4 100644 ---- a/include/llvm/CMakeLists.txt -+++ b/include/llvm/CMakeLists.txt -@@ -5,5 +5,5 @@ add_subdirectory(Frontend) - # If we're doing an out-of-tree build, copy a module map for generated - # header files into the build area. - if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") -- configure_file(module.modulemap.build module.modulemap COPYONLY) -+ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY) - endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") ++**CMAKE_INSTALL_LIBDIR**:PATH ++ The path to install libraries, relative to the *CMAKE_INSTALL_PREFIX*. ++ Defaults to "lib". ++ + **CMAKE_INSTALL_INCLUDEDIR**:PATH + The path to install header files, relative to the *CMAKE_INSTALL_PREFIX*. + Defaults to "include". diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in -index abbb8a450da6..70c497be12f5 100644 +index 370005cd8d7d..7e790bc52111 100644 --- a/tools/llvm-config/BuildVariables.inc.in +++ b/tools/llvm-config/BuildVariables.inc.in -@@ -23,7 +23,10 @@ +@@ -23,6 +23,7 @@ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@" #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@" -+#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@" +#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@" #define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@" -+#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@" + #define LLVM_INSTALL_PACKAGE_DIR "@LLVM_INSTALL_PACKAGE_DIR@" #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" - #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" - #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@" diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp -index 8ed88f33ead4..5e7184bab90d 100644 +index 2c6c55f89d38..f6d2068a0827 100644 --- a/tools/llvm-config/llvm-config.cpp +++ b/tools/llvm-config/llvm-config.cpp -@@ -363,12 +363,20 @@ int main(int argc, char **argv) { - ActiveIncludeDir = std::string(Path.str()); - } - { -- SmallString<256> Path(LLVM_TOOLS_INSTALL_DIR); -+ SmallString<256> Path(LLVM_INSTALL_BINDIR); +@@ -369,7 +369,11 @@ int main(int argc, char **argv) { sys::fs::make_absolute(ActivePrefix, Path); ActiveBinDir = std::string(Path.str()); } - ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; -- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm"; + { + SmallString<256> Path(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX); + sys::fs::make_absolute(ActivePrefix, Path); + ActiveLibDir = std::string(Path.str()); + } -+ { -+ SmallString<256> Path(LLVM_INSTALL_CMAKEDIR); -+ sys::fs::make_absolute(ActivePrefix, Path); -+ ActiveCMakeDir = std::string(Path.str()); -+ } - ActiveIncludeOption = "-I" + ActiveIncludeDir; - } - + { + SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR); + sys::fs::make_absolute(ActivePrefix, Path); diff --git a/nix/llvm/llvm-future-riscv-abi.diff b/nix/llvm/llvm-future-riscv-abi.diff index 2427ed0..c7d4c45 100644 --- a/nix/llvm/llvm-future-riscv-abi.diff +++ b/nix/llvm/llvm-future-riscv-abi.diff @@ -1,28 +1,12 @@ -diff --git a/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp b/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp -index 0aba18b20..9bb75e7f4 100644 ---- a/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp -+++ b/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp -@@ -33,6 +33,8 @@ ABI computeTargetABI(const Triple &TT, FeatureBitset FeatureBits, - auto TargetABI = getTargetABI(ABIName); - bool IsRV64 = TT.isArch64Bit(); - bool IsRV32E = FeatureBits[RISCV::FeatureRV32E]; -+ bool IsRV32D = FeatureBits[RISCV::FeatureStdExtD]; -+ bool IsRV32F = FeatureBits[RISCV::FeatureStdExtF]; - - if (!ABIName.empty() && TargetABI == ABI_Unknown) { - errs() -@@ -56,10 +58,10 @@ ABI computeTargetABI(const Triple &TT, FeatureBitset FeatureBits, - if (TargetABI != ABI_Unknown) - return TargetABI; - -- // For now, default to the ilp32/ilp32e/lp64 ABI if no explicit ABI is given -- // or an invalid/unrecognised string is given. In the future, it might be -- // worth changing this to default to ilp32f/lp64f and ilp32d/lp64d when -- // hardware support for floating point is present. -+ if (IsRV32D) -+ return ABI_ILP32D; -+ if (IsRV32F) -+ return ABI_ILP32F; - if (IsRV32E) - return ABI_ILP32E; - if (IsRV64) +diff '--color=auto' -Naur llvm-old/lib/Support/RISCVISAInfo.cpp llvm-new/lib/Support/RISCVISAInfo.cpp +--- llvm-old/lib/Support/RISCVISAInfo.cpp 1970-01-01 08:00:01.000000000 +0800 ++++ llvm-new/lib/Support/RISCVISAInfo.cpp 2023-03-08 13:11:46.732606844 +0800 +@@ -972,6 +972,8 @@ + if (XLen == 32) { + if (hasExtension("d")) + return "ilp32d"; ++ if (hasExtension("f")) ++ return "ilp32f"; + if (hasExtension("e")) + return "ilp32e"; + return "ilp32";