diff options
Diffstat (limited to 'vendor/object')
-rw-r--r-- | vendor/object/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/object/CHANGELOG.md | 58 | ||||
-rw-r--r-- | vendor/object/Cargo.toml | 28 | ||||
-rw-r--r-- | vendor/object/README.md | 4 | ||||
-rw-r--r-- | vendor/object/clippy.toml | 2 | ||||
-rw-r--r-- | vendor/object/src/common.rs | 2 | ||||
-rw-r--r-- | vendor/object/src/elf.rs | 18 | ||||
-rw-r--r-- | vendor/object/src/pe.rs | 4 | ||||
-rw-r--r-- | vendor/object/src/read/any.rs | 125 | ||||
-rw-r--r-- | vendor/object/src/read/coff/import.rs | 209 | ||||
-rw-r--r-- | vendor/object/src/read/coff/mod.rs | 3 | ||||
-rw-r--r-- | vendor/object/src/read/elf/file.rs | 1 | ||||
-rw-r--r-- | vendor/object/src/read/elf/note.rs | 23 | ||||
-rw-r--r-- | vendor/object/src/read/elf/relocation.rs | 5 | ||||
-rw-r--r-- | vendor/object/src/read/elf/symbol.rs | 8 | ||||
-rw-r--r-- | vendor/object/src/read/mod.rs | 11 | ||||
-rw-r--r-- | vendor/object/src/write/elf/object.rs | 12 | ||||
-rw-r--r-- | vendor/object/src/write/macho.rs | 30 | ||||
-rw-r--r-- | vendor/object/tests/round_trip/macho.rs | 43 | ||||
-rw-r--r-- | vendor/object/tests/round_trip/mod.rs | 1 |
20 files changed, 466 insertions, 123 deletions
diff --git a/vendor/object/.cargo-checksum.json b/vendor/object/.cargo-checksum.json index ce528e08f..a8b6bddc5 100644 --- a/vendor/object/.cargo-checksum.json +++ b/vendor/object/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"a12476c54f1e333d5817e9e542c7279a6406f8e67ddfc9beaad43ef2f107fadb","Cargo.toml":"d94e2863d8916b8e9758813d0324ed3d7b4596b7d39b57341dddc0eca3267e7b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0b74dfa0bcee5c420c6b7f67b4b2658f9ab8388c97b8e733975f2cecbdd668a6","README.md":"18a8fae32349bfc7f3099a4b74c1e3df5407d049283fa0ff0a095798dca7b419","clippy.toml":"372224591422419a0e397ee2f4b4b27443b3ad9c692be9c6c2f320696dc43a8a","src/archive.rs":"d6cead723242c26db2967b63385b79ed2008980a8c64b123a5eecffd7ed388fc","src/common.rs":"90d1d62405e5eabc09640387d5186ed7f386f910cd5ce38f30e33d695e54957a","src/elf.rs":"cb6ac69773eaef8881450b3cf39abc37511ef83ddcb1fa3042209d23dfa575ad","src/endian.rs":"b4f63a85ccd3d5c11615baf5ba946c82046c221a1b8c74ee8c6fa4360782980c","src/lib.rs":"7f1261ebed84cd10169c1846a70dcafa7c8b25c06f32981335a9a676f45856a4","src/macho.rs":"e62808b0c84494b68e7e69b2f7fd9c0620b2ef61b6a2af3403de30284cf6b898","src/pe.rs":"5fd77bc9728bce87f12b849081cd72a56f23ed59225bbebb0fee9725ae111494","src/pod.rs":"d2967732f0052e6cfa18a2dd62c57bc3b640a20eb9a6db9f39836000ceabb399","src/read/any.rs":"c8bf4d6f0617b9433ef294494d04c4b16d1dd9afd45cb1ab5a6798268d70bff8","src/read/archive.rs":"479574cff125a74fc5512d75c1531da3bb006005fe544ffd2531a7d4f35a9bb4","src/read/coff/comdat.rs":"5204e6e44a33d1fe04ae551892d9dae2bd8ca4a0d9f1b46dd06a9e512b8ec6cc","src/read/coff/file.rs":"007c52c0a2d6f763a3c74e13f5cc15cf870a0701b87f01346ad550e52c5e5146","src/read/coff/mod.rs":"5eed1c0ca7cf044b3173223b06afacc4961a0515ef2478fffa35641f4ee364ee","src/read/coff/relocation.rs":"57deb22ed0c9c31de0fe0bb483ded94459bcfd93b9f979191500d223a8517fe2","src/read/coff/section.rs":"de023dc46d4e1a37e77ab8e7080ff9fc9588633d790ae664e138d70e8fc8a39f","src/read/coff/symbol.rs":"e3b629112fe73e4627daa45093df1a1a2844ffe395d1c4de479f0f4c2bdac624","src/read/elf/attributes.rs":"1a5bc8dc081903d6b318761f50010ab08dee74b7f2d68ffbbd1aff7ed7b7c538","src/read/elf/comdat.rs":"253e00621d9a5249cfa20a2ebda76127113b42fc960235308333c9d35acdd628","src/read/elf/compression.rs":"097ff8bdc78d01a1532b11c1c0cae3b35905128c7d98b471de188d46da3ff970","src/read/elf/dynamic.rs":"8f59bd6d352f6810be6b6dc02c2f88229f15aa02a42f8fc09bcf3f284d4b1021","src/read/elf/file.rs":"48bbeeda6814b280485021009b3755ebca63f2a00c8bfdb0ac64276ed0157b12","src/read/elf/hash.rs":"b330af7e2356512cfdf162986437c81a3b149a91e26bf82455a6976e2571a618","src/read/elf/mod.rs":"fceb322ac4e2cb182e0abd93f794622e58ae7c64e83c8703c9c888af5d93889d","src/read/elf/note.rs":"f1aadb81268e28d5ad25033f58b7d96af6323e6d2e238489f13b5ce4409e7bae","src/read/elf/relocation.rs":"f710c7a6f8e743f8f4172141e03294399ea4d59f4726650168e3c66544fe2f5f","src/read/elf/section.rs":"c626a53afa196ba5b81a3d6278956f1d1ddf04ff2ac81f934425cfaef870aafd","src/read/elf/segment.rs":"ebcefba06c6f4a3e60403a1112c59f3390c39840aac011a8b040c77f8d29d655","src/read/elf/symbol.rs":"57735265876d1dc73a94a47356f65b998553dc91ea1a1dd3ad178d602cb1b616","src/read/elf/version.rs":"2c5f63e526cf26f83bdaaead4124949fc53b6198983e4681b6a3895794ad8754","src/read/macho/dyld_cache.rs":"c5247e9121a57fd411c86aea435b9c3d6d03d3cbb3fb7dfe6e75576013d71f14","src/read/macho/fat.rs":"d27a1052f2e47cd5b798a6359f33c3bfe7f7971b13259f6545118213ace7f5dd","src/read/macho/file.rs":"2531c245722202173ff762179af2c88af0108156457c848e7d756e348e72bc80","src/read/macho/load_command.rs":"d8c0ebc8f65dafa4fbb1f9a3c944fdeee96fddacfcc863650b94d9a62e8fe37a","src/read/macho/mod.rs":"23b353da3b7e076c68a067776e6a5b346a746116ac42c2c90bafd95ad54a90b3","src/read/macho/relocation.rs":"477d98b507550c29ceceba49308d14e1f086cb01a4ea9af691e995d1d29767a4","src/read/macho/section.rs":"9b21b3a02f509bb09983d116d7f0938cd61d5293e5e31907964611495b8a575e","src/read/macho/segment.rs":"0dee483eb9b6c731e69a9fe0bd9ef84b2a797a8203e5e870e15a6a2165326cc3","src/read/macho/symbol.rs":"3d3ad557c205d834ba305a9eaf3b97b2ed05f1906cd8430ad2fadabf81f14b9f","src/read/mod.rs":"7251d93159c3288c0fac791f2183ac94deae5e6faf693b393744f6952e33cffa","src/read/pe/data_directory.rs":"c08c095a4287c55bf7d7774bbade1d7610d8e82433b0de23af8c4c7ef23d75e3","src/read/pe/export.rs":"07ac5ec7b67d4a09037d8f11eb4426d96515687ee299df2a3d8cd4fd93eb2036","src/read/pe/file.rs":"507d800775adae687ca9ac7dca1a6f42463103af0731a5fe548d4745a9bee686","src/read/pe/import.rs":"ea20dfc0d462ba20e149bf9408f4ec1d0b202abf1f15536f6d091f0c0e756ac8","src/read/pe/mod.rs":"69832b7f4ccd93b59e08bafcbd0d3226c450d7801ad49ab554b38b660c8997fd","src/read/pe/relocation.rs":"0335c06b6d37df4939c8b88044313e88661ee45e5a57d2eec40143f2fe481838","src/read/pe/resource.rs":"0209eb96391bc367633b6d868505cb30947157702b0c85ef6677e5a1283d448f","src/read/pe/rich.rs":"ae9b2fc927bab2661e8d200a10128aebde37d26b50cb9069e9af9eb7bacee591","src/read/pe/section.rs":"bafde5a1584f6ce0456e32756e825c1b2b9dc0ec220ab29e668c2ff700600b87","src/read/read_cache.rs":"e9dbaa385435f5ef6ca5951c26ed1f6793ad3a8f3aee918257a5df6783d4b36d","src/read/read_ref.rs":"14966a1da9951633a7e73aedccfeadbbed4a977a8fb9d415d572250f6ebaf438","src/read/traits.rs":"8d094ba6ac06639bad448c70378d5154195d4ab36b13588b72105a869dfc053e","src/read/util.rs":"7ed8c5c88a52549734df67d2cbd3f0ea1a571728cae62152e57018f3140f9ebc","src/read/wasm.rs":"31c755ce17bba20ba287f53af7b7787bdbb5f8920333412fb11d81239102b423","src/read/xcoff/comdat.rs":"9a0a8a16682a28a54b51d28d382578e4b1e0212a34460eb93b50e8f97e4bf745","src/read/xcoff/file.rs":"17f751578d052cb8f74ee56a4e17b053b06e82e4efbe943907943bc561fb301e","src/read/xcoff/mod.rs":"d0179d3f95797464ca5919563454d1123ce8c35dfc5f40ecd6ca0d002a9824a8","src/read/xcoff/relocation.rs":"84993f477231cd1b8c79c385bc0e892640de89ddae268b845bc82c41999953b4","src/read/xcoff/section.rs":"c5ce72c214398125c7a4bc160fc5a7b27a6d92035dadcc84fd2852b73c75c123","src/read/xcoff/segment.rs":"627dabf3003aa1442bb4a2292cd68e1f572c3b95864a99e50a505b2894ffc804","src/read/xcoff/symbol.rs":"23be12b614937f8ea5de90d097fb8034f82bff798aa09636cd53a0670e39a984","src/write/coff.rs":"1dcb1c6c939af192591d44e135e6d139b82563d8bca07249e93fa3d434b1f6c7","src/write/elf/mod.rs":"1bb945edad539b4f19dda5d46c9b86fa4ea3721eedda77ca2595b5519c3e30f2","src/write/elf/object.rs":"68acaa137e32217b85d28ef4e6033c64b3ef4621289ae53bd012e1ba03316c2d","src/write/elf/writer.rs":"84336230a24413a41e342735c153c3421c70707ec92c2df02e7d3536e5d41b55","src/write/macho.rs":"4561d0b3257b2570a9952521a016586de9e873e4ce6c574ecf620ecfad9da703","src/write/mod.rs":"c6c9a54ef807a3bee0c3074be86b0aed90872e1e703f39f2fa5c06bc9ed89767","src/write/pe.rs":"6c72185705a3e067c481f2b9f81c64a84e062e67781928e58fd1150314dad8f9","src/write/string.rs":"0033a6f5137b42988ac41dbaa2efb94a4d74d8b043c9a34c40125e8ee6912420","src/write/util.rs":"7a1083d305e9446767ce2d5f69be2c4c155495cf97e595f8fa53c4e153ccf186","src/write/xcoff.rs":"f192dd34fb442cd53a004e50508f6a787c9e9cd9089a15f63fdf6054eb6bd63f","src/xcoff.rs":"fbd50fc4b61ccfdf218185ea4eafe8cf9793e8d034e7ce243fb54ecae12af5ce","tests/integration.rs":"0fa704827e4da1be38dac2e3820d92f6b20c4d415803b04f67c3516020b1de97","tests/parse_self.rs":"81b44b2dd1de9a5d8c18d9bd8926156e39fb83931837afa8ca344da0d309aeee","tests/read/coff.rs":"d3ec2079f00237640d01cb66eb24c55c85d7a775bb94f9f5c9f77e21cb7a785d","tests/read/mod.rs":"7833826f169ac3be2b4f274e5fc8cf4a51742bd0010803ff0dc20ea5643a7e61","tests/round_trip/bss.rs":"849d69b063fd757fed02219dd81e9d13b82068a2025d2cc5cfd40cf557e31bda","tests/round_trip/coff.rs":"8a25aab7164a5c8aa7a21279f8bae1f4d5f68a8d09c29a4ecd0d0c14564851cc","tests/round_trip/comdat.rs":"a8f729e218fee21e90b9f39b5cfcb4f80bc3ce26d3a297323667e6eb14f882cc","tests/round_trip/common.rs":"ced08ff559ca4d343ceef54bb4c581a3405cd96d6a1628ba43b7aab82070800b","tests/round_trip/elf.rs":"d7351d888ccad246a646ab3bea1afc3d445adeb28c5d3c8f157f7cde3717281c","tests/round_trip/macho.rs":"b23931f506345b26ce3b4908dc2ce02f704603c622d39f5e9e7c8529f2882818","tests/round_trip/mod.rs":"b0eaaf6a0a282839525150d043205ecc4467f8e2270c448ac03dbdccf4b764f6","tests/round_trip/section_flags.rs":"0e17639e5f86d576f039a294c274ce8db2e2a8add31a2fffc33a6e93a6d2791e","tests/round_trip/tls.rs":"23a49a1036b9173ece82a3080745930e5925e745280ab38866c9d3c29f463e63"},"package":"8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"19f059b47fe070336813f4561b7da9be7f8dc1968daf3b1565b1a55900673469","Cargo.toml":"8075e73eb31b58aacb542434e0f21851895a335efc6cc23724411c478716c213","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0b74dfa0bcee5c420c6b7f67b4b2658f9ab8388c97b8e733975f2cecbdd668a6","README.md":"3772fdfd89e6321cc298413b8c0ba847bd125dfe64785e8faeaac05a87cbb2d3","clippy.toml":"e1e95839ba8e8bbf07f99ff49e2f151b9048c7981301a5480571842bbaf78ca2","src/archive.rs":"d6cead723242c26db2967b63385b79ed2008980a8c64b123a5eecffd7ed388fc","src/common.rs":"27a01eb0a1efcd10a988bc3922a2159e97fd133fbc07ff90faca4ff1722bd605","src/elf.rs":"ceb4f748b65ea092cf057db45193b0b2c7f9204a1e677848aaf0463f9dd3ac6a","src/endian.rs":"b4f63a85ccd3d5c11615baf5ba946c82046c221a1b8c74ee8c6fa4360782980c","src/lib.rs":"7f1261ebed84cd10169c1846a70dcafa7c8b25c06f32981335a9a676f45856a4","src/macho.rs":"e62808b0c84494b68e7e69b2f7fd9c0620b2ef61b6a2af3403de30284cf6b898","src/pe.rs":"8432e949a5bbf7ca28ba27f6a8ee926fe2e8632ffd88845714a6f64d6f7c0a40","src/pod.rs":"d2967732f0052e6cfa18a2dd62c57bc3b640a20eb9a6db9f39836000ceabb399","src/read/any.rs":"8ef08da67f083ee3f2758b5d64349d8032d5c63198d0c55815cd17054281a207","src/read/archive.rs":"479574cff125a74fc5512d75c1531da3bb006005fe544ffd2531a7d4f35a9bb4","src/read/coff/comdat.rs":"5204e6e44a33d1fe04ae551892d9dae2bd8ca4a0d9f1b46dd06a9e512b8ec6cc","src/read/coff/file.rs":"007c52c0a2d6f763a3c74e13f5cc15cf870a0701b87f01346ad550e52c5e5146","src/read/coff/import.rs":"1de0db515a0a6b1eee355d93a715f6d2ff152d1b815e1e859af0b0e5ded36efc","src/read/coff/mod.rs":"66bdcc772291cb53be378a66723e3c246e30df5aa4e4d4ce8e55bfeb156849a9","src/read/coff/relocation.rs":"57deb22ed0c9c31de0fe0bb483ded94459bcfd93b9f979191500d223a8517fe2","src/read/coff/section.rs":"de023dc46d4e1a37e77ab8e7080ff9fc9588633d790ae664e138d70e8fc8a39f","src/read/coff/symbol.rs":"e3b629112fe73e4627daa45093df1a1a2844ffe395d1c4de479f0f4c2bdac624","src/read/elf/attributes.rs":"1a5bc8dc081903d6b318761f50010ab08dee74b7f2d68ffbbd1aff7ed7b7c538","src/read/elf/comdat.rs":"253e00621d9a5249cfa20a2ebda76127113b42fc960235308333c9d35acdd628","src/read/elf/compression.rs":"097ff8bdc78d01a1532b11c1c0cae3b35905128c7d98b471de188d46da3ff970","src/read/elf/dynamic.rs":"8f59bd6d352f6810be6b6dc02c2f88229f15aa02a42f8fc09bcf3f284d4b1021","src/read/elf/file.rs":"860f6ed4e98e8672daef71065ea885f47d25593f6adeb7907545dadb9d398768","src/read/elf/hash.rs":"b330af7e2356512cfdf162986437c81a3b149a91e26bf82455a6976e2571a618","src/read/elf/mod.rs":"fceb322ac4e2cb182e0abd93f794622e58ae7c64e83c8703c9c888af5d93889d","src/read/elf/note.rs":"4b7e33582bff27918240d34d70f0099260dfd3122345c12ce10e6f7fcdf79e35","src/read/elf/relocation.rs":"7b95b7fbac280645f6d5900cc0158653bc8fb3adc9beeeae1b3f61eb77ada5d0","src/read/elf/section.rs":"c626a53afa196ba5b81a3d6278956f1d1ddf04ff2ac81f934425cfaef870aafd","src/read/elf/segment.rs":"ebcefba06c6f4a3e60403a1112c59f3390c39840aac011a8b040c77f8d29d655","src/read/elf/symbol.rs":"d50755b3acd34b9c77dd51f94d436265e79ed8f6f167b593e2a482543abde30b","src/read/elf/version.rs":"2c5f63e526cf26f83bdaaead4124949fc53b6198983e4681b6a3895794ad8754","src/read/macho/dyld_cache.rs":"c5247e9121a57fd411c86aea435b9c3d6d03d3cbb3fb7dfe6e75576013d71f14","src/read/macho/fat.rs":"d27a1052f2e47cd5b798a6359f33c3bfe7f7971b13259f6545118213ace7f5dd","src/read/macho/file.rs":"2531c245722202173ff762179af2c88af0108156457c848e7d756e348e72bc80","src/read/macho/load_command.rs":"d8c0ebc8f65dafa4fbb1f9a3c944fdeee96fddacfcc863650b94d9a62e8fe37a","src/read/macho/mod.rs":"23b353da3b7e076c68a067776e6a5b346a746116ac42c2c90bafd95ad54a90b3","src/read/macho/relocation.rs":"477d98b507550c29ceceba49308d14e1f086cb01a4ea9af691e995d1d29767a4","src/read/macho/section.rs":"9b21b3a02f509bb09983d116d7f0938cd61d5293e5e31907964611495b8a575e","src/read/macho/segment.rs":"0dee483eb9b6c731e69a9fe0bd9ef84b2a797a8203e5e870e15a6a2165326cc3","src/read/macho/symbol.rs":"3d3ad557c205d834ba305a9eaf3b97b2ed05f1906cd8430ad2fadabf81f14b9f","src/read/mod.rs":"b1224dc6654be52b8c2f6403503ffa662b576d05c0382146a386915d23c894dd","src/read/pe/data_directory.rs":"c08c095a4287c55bf7d7774bbade1d7610d8e82433b0de23af8c4c7ef23d75e3","src/read/pe/export.rs":"07ac5ec7b67d4a09037d8f11eb4426d96515687ee299df2a3d8cd4fd93eb2036","src/read/pe/file.rs":"507d800775adae687ca9ac7dca1a6f42463103af0731a5fe548d4745a9bee686","src/read/pe/import.rs":"ea20dfc0d462ba20e149bf9408f4ec1d0b202abf1f15536f6d091f0c0e756ac8","src/read/pe/mod.rs":"69832b7f4ccd93b59e08bafcbd0d3226c450d7801ad49ab554b38b660c8997fd","src/read/pe/relocation.rs":"0335c06b6d37df4939c8b88044313e88661ee45e5a57d2eec40143f2fe481838","src/read/pe/resource.rs":"0209eb96391bc367633b6d868505cb30947157702b0c85ef6677e5a1283d448f","src/read/pe/rich.rs":"ae9b2fc927bab2661e8d200a10128aebde37d26b50cb9069e9af9eb7bacee591","src/read/pe/section.rs":"bafde5a1584f6ce0456e32756e825c1b2b9dc0ec220ab29e668c2ff700600b87","src/read/read_cache.rs":"e9dbaa385435f5ef6ca5951c26ed1f6793ad3a8f3aee918257a5df6783d4b36d","src/read/read_ref.rs":"14966a1da9951633a7e73aedccfeadbbed4a977a8fb9d415d572250f6ebaf438","src/read/traits.rs":"8d094ba6ac06639bad448c70378d5154195d4ab36b13588b72105a869dfc053e","src/read/util.rs":"7ed8c5c88a52549734df67d2cbd3f0ea1a571728cae62152e57018f3140f9ebc","src/read/wasm.rs":"31c755ce17bba20ba287f53af7b7787bdbb5f8920333412fb11d81239102b423","src/read/xcoff/comdat.rs":"9a0a8a16682a28a54b51d28d382578e4b1e0212a34460eb93b50e8f97e4bf745","src/read/xcoff/file.rs":"17f751578d052cb8f74ee56a4e17b053b06e82e4efbe943907943bc561fb301e","src/read/xcoff/mod.rs":"d0179d3f95797464ca5919563454d1123ce8c35dfc5f40ecd6ca0d002a9824a8","src/read/xcoff/relocation.rs":"84993f477231cd1b8c79c385bc0e892640de89ddae268b845bc82c41999953b4","src/read/xcoff/section.rs":"c5ce72c214398125c7a4bc160fc5a7b27a6d92035dadcc84fd2852b73c75c123","src/read/xcoff/segment.rs":"627dabf3003aa1442bb4a2292cd68e1f572c3b95864a99e50a505b2894ffc804","src/read/xcoff/symbol.rs":"23be12b614937f8ea5de90d097fb8034f82bff798aa09636cd53a0670e39a984","src/write/coff.rs":"1dcb1c6c939af192591d44e135e6d139b82563d8bca07249e93fa3d434b1f6c7","src/write/elf/mod.rs":"1bb945edad539b4f19dda5d46c9b86fa4ea3721eedda77ca2595b5519c3e30f2","src/write/elf/object.rs":"2176f0f640eed5a05be77208301a10667533b495551662186e6c708bd02c9c18","src/write/elf/writer.rs":"84336230a24413a41e342735c153c3421c70707ec92c2df02e7d3536e5d41b55","src/write/macho.rs":"bd6afba576273a162f6d2e9658c8258a664c38d0169864310dffbf1fd7582a43","src/write/mod.rs":"c6c9a54ef807a3bee0c3074be86b0aed90872e1e703f39f2fa5c06bc9ed89767","src/write/pe.rs":"6c72185705a3e067c481f2b9f81c64a84e062e67781928e58fd1150314dad8f9","src/write/string.rs":"0033a6f5137b42988ac41dbaa2efb94a4d74d8b043c9a34c40125e8ee6912420","src/write/util.rs":"7a1083d305e9446767ce2d5f69be2c4c155495cf97e595f8fa53c4e153ccf186","src/write/xcoff.rs":"f192dd34fb442cd53a004e50508f6a787c9e9cd9089a15f63fdf6054eb6bd63f","src/xcoff.rs":"fbd50fc4b61ccfdf218185ea4eafe8cf9793e8d034e7ce243fb54ecae12af5ce","tests/integration.rs":"0fa704827e4da1be38dac2e3820d92f6b20c4d415803b04f67c3516020b1de97","tests/parse_self.rs":"81b44b2dd1de9a5d8c18d9bd8926156e39fb83931837afa8ca344da0d309aeee","tests/read/coff.rs":"d3ec2079f00237640d01cb66eb24c55c85d7a775bb94f9f5c9f77e21cb7a785d","tests/read/mod.rs":"7833826f169ac3be2b4f274e5fc8cf4a51742bd0010803ff0dc20ea5643a7e61","tests/round_trip/bss.rs":"849d69b063fd757fed02219dd81e9d13b82068a2025d2cc5cfd40cf557e31bda","tests/round_trip/coff.rs":"8a25aab7164a5c8aa7a21279f8bae1f4d5f68a8d09c29a4ecd0d0c14564851cc","tests/round_trip/comdat.rs":"a8f729e218fee21e90b9f39b5cfcb4f80bc3ce26d3a297323667e6eb14f882cc","tests/round_trip/common.rs":"ced08ff559ca4d343ceef54bb4c581a3405cd96d6a1628ba43b7aab82070800b","tests/round_trip/elf.rs":"d7351d888ccad246a646ab3bea1afc3d445adeb28c5d3c8f157f7cde3717281c","tests/round_trip/macho.rs":"8cf6297f1b9e31153b15f2e409e68b561f135a233d32b601a47f5fd4dfa014cc","tests/round_trip/mod.rs":"14db36fae698b75fedc4dc832465394350049f54b01b1215022a44ebe920f7e9","tests/round_trip/section_flags.rs":"0e17639e5f86d576f039a294c274ce8db2e2a8add31a2fffc33a6e93a6d2791e","tests/round_trip/tls.rs":"23a49a1036b9173ece82a3080745930e5925e745280ab38866c9d3c29f463e63"},"package":"77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe"}
\ No newline at end of file diff --git a/vendor/object/CHANGELOG.md b/vendor/object/CHANGELOG.md index 8aa502e8f..451fcb106 100644 --- a/vendor/object/CHANGELOG.md +++ b/vendor/object/CHANGELOG.md @@ -2,6 +2,64 @@ -------------------------------------------------------------------------------- +## 0.32.0 + +Released 2023/08/12. + +### Breaking changes + +* Changed `read::elf::Note::name` to exclude all trailing null bytes. + [#549](https://github.com/gimli-rs/object/pull/549) + +* Updated dependencies, and changed some optional dependencies to use the `dep:` + feature syntax. + [#558](https://github.com/gimli-rs/object/pull/558) + [#569](https://github.com/gimli-rs/object/pull/569) + +### Changed + +* The minimum supported rust version for the `read` feature and its dependencies + has changed to 1.60.0. + +* The minimum supported rust version for other features has changed to 1.65.0. + +* Changed many definitions from `static` to `const`. + [#549](https://github.com/gimli-rs/object/pull/549) + +* Fixed Mach-O section alignment padding in `write::Object`. + [#553](https://github.com/gimli-rs/object/pull/553) + +* Changed `read::File` to an enum. + [#564](https://github.com/gimli-rs/object/pull/564) + +### Added + +* Added `elf::ELF_NOTE_GO`, `elf::NT_GO_BUILD_ID`, and `read::elf::Note::name_bytes`. + [#549](https://github.com/gimli-rs/object/pull/549) + +* Added `read::FileKind::CoffImport` and `read::coff::ImportFile`. + [#555](https://github.com/gimli-rs/object/pull/555) + [#556](https://github.com/gimli-rs/object/pull/556) + +* Added `Architecture::Csky` and basic ELF support for C-SKY. + [#561](https://github.com/gimli-rs/object/pull/561) + +* Added `read::elf::ElfSymbol::raw_symbol`. + [#562](https://github.com/gimli-rs/object/pull/562) + +-------------------------------------------------------------------------------- + +## 0.30.4 + +Released 2023/06/05. + +### Changed + +* Fixed Mach-O section alignment padding in `write::Object`. + [#553](https://github.com/gimli-rs/object/pull/553) + +-------------------------------------------------------------------------------- + ## 0.31.1 Released 2023/05/09. diff --git a/vendor/object/Cargo.toml b/vendor/object/Cargo.toml index 4ea28afcc..385666a10 100644 --- a/vendor/object/Cargo.toml +++ b/vendor/object/Cargo.toml @@ -11,8 +11,9 @@ [package] edition = "2018" +rust-version = "1.60" name = "object" -version = "0.31.1" +version = "0.32.0" exclude = [ "/.github", "/testfiles", @@ -57,25 +58,26 @@ version = "1" optional = true [dependencies.hashbrown] -version = "0.13.1" +version = "0.14.0" features = ["ahash"] optional = true default-features = false [dependencies.indexmap] -version = "1.6" +version = "2.0" optional = true +default-features = false [dependencies.memchr] version = "2.4.1" default-features = false [dependencies.ruzstd] -version = "0.3.1" +version = "0.4.0" optional = true [dependencies.wasmparser] -version = "0.102.0" +version = "0.110.0" optional = true [features] @@ -90,8 +92,8 @@ archive = [] cargo-all = [] coff = [] compression = [ - "flate2", - "ruzstd", + "dep:flate2", + "dep:ruzstd", "std", ] default = [ @@ -138,7 +140,7 @@ unstable-all = [ "all", "unstable", ] -wasm = ["wasmparser"] +wasm = ["dep:wasmparser"] write = [ "write_std", "coff", @@ -148,14 +150,14 @@ write = [ "xcoff", ] write_core = [ - "crc32fast", - "indexmap", - "hashbrown", + "dep:crc32fast", + "dep:indexmap", + "dep:hashbrown", ] write_std = [ "write_core", "std", - "indexmap/std", - "crc32fast/std", + "indexmap?/std", + "crc32fast?/std", ] xcoff = [] diff --git a/vendor/object/README.md b/vendor/object/README.md index 804cc7c1c..5b90fca30 100644 --- a/vendor/object/README.md +++ b/vendor/object/README.md @@ -39,8 +39,8 @@ See [`crates/examples`](crates/examples) for more examples. Changes to MSRV are considered breaking changes. We are conservative about changing the MSRV, but sometimes are required to due to dependencies. The MSRV is: - * 1.52.0 for the `read` feature and its dependencies. - * 1.61.0 for the `write` feature and its dependencies. + * 1.60.0 for the `read` feature and its dependencies. + * 1.65.0 for other features. ## License diff --git a/vendor/object/clippy.toml b/vendor/object/clippy.toml index 935336a41..16caf02ee 100644 --- a/vendor/object/clippy.toml +++ b/vendor/object/clippy.toml @@ -1 +1 @@ -msrv = "1.52.0" +msrv = "1.60.0" diff --git a/vendor/object/src/common.rs b/vendor/object/src/common.rs index 7d789a71d..0e6af091c 100644 --- a/vendor/object/src/common.rs +++ b/vendor/object/src/common.rs @@ -10,6 +10,7 @@ pub enum Architecture { Arm, Avr, Bpf, + Csky, I386, X86_64, #[allow(non_camel_case_types)] @@ -43,6 +44,7 @@ impl Architecture { Architecture::Arm => Some(AddressSize::U32), Architecture::Avr => Some(AddressSize::U8), Architecture::Bpf => Some(AddressSize::U64), + Architecture::Csky => Some(AddressSize::U32), Architecture::I386 => Some(AddressSize::U32), Architecture::X86_64 => Some(AddressSize::U64), Architecture::X86_64_X32 => Some(AddressSize::U32), diff --git a/vendor/object/src/elf.rs b/vendor/object/src/elf.rs index 202b3a2cc..da68ec2d4 100644 --- a/vendor/object/src/elf.rs +++ b/vendor/object/src/elf.rs @@ -1308,11 +1308,11 @@ pub const PF_MASKOS: u32 = 0x0ff0_0000; pub const PF_MASKPROC: u32 = 0xf000_0000; /// Note name for core files. -pub static ELF_NOTE_CORE: &[u8] = b"CORE"; +pub const ELF_NOTE_CORE: &[u8] = b"CORE"; /// Note name for linux core files. /// /// Notes in linux core files may also use `ELF_NOTE_CORE`. -pub static ELF_NOTE_LINUX: &[u8] = b"LINUX"; +pub const ELF_NOTE_LINUX: &[u8] = b"LINUX"; // Values for `NoteHeader*::n_type` in core files. // @@ -1826,14 +1826,18 @@ pub struct NoteHeader64<E: Endian> { } /// Solaris entries in the note section have this name. -pub static ELF_NOTE_SOLARIS: &[u8] = b"SUNW Solaris"; +pub const ELF_NOTE_SOLARIS: &[u8] = b"SUNW Solaris"; // Values for `n_type` when the name is `ELF_NOTE_SOLARIS`. /// Desired pagesize for the binary. pub const NT_SOLARIS_PAGESIZE_HINT: u32 = 1; /// GNU entries in the note section have this name. -pub static ELF_NOTE_GNU: &[u8] = b"GNU"; +pub const ELF_NOTE_GNU: &[u8] = b"GNU"; + +/// Go entries in the note section have this name. +// See https://go-review.googlesource.com/9520 and https://go-review.googlesource.com/10704. +pub const ELF_NOTE_GO: &[u8] = b"Go"; // Note types for `ELF_NOTE_GNU`. @@ -1870,6 +1874,12 @@ pub const NT_GNU_HWCAP: u32 = 2; /// The descriptor consists of any nonzero number of bytes. pub const NT_GNU_BUILD_ID: u32 = 3; +/// Build ID bits as generated by Go's gc compiler. +/// +/// The descriptor consists of any nonzero number of bytes. +// See https://go-review.googlesource.com/10707. +pub const NT_GO_BUILD_ID: u32 = 4; + /// Version note generated by GNU gold containing a version string. pub const NT_GNU_GOLD_VERSION: u32 = 4; diff --git a/vendor/object/src/pe.rs b/vendor/object/src/pe.rs index bac101ea0..f274d2270 100644 --- a/vendor/object/src/pe.rs +++ b/vendor/object/src/pe.rs @@ -2873,10 +2873,14 @@ pub struct ImportObjectHeader { pub name_type: U16<LE>, } +pub const IMPORT_OBJECT_TYPE_MASK: u16 = 0b11; +pub const IMPORT_OBJECT_TYPE_SHIFT: u16 = 0; pub const IMPORT_OBJECT_CODE: u16 = 0; pub const IMPORT_OBJECT_DATA: u16 = 1; pub const IMPORT_OBJECT_CONST: u16 = 2; +pub const IMPORT_OBJECT_NAME_MASK: u16 = 0b111; +pub const IMPORT_OBJECT_NAME_SHIFT: u16 = 2; /// Import by ordinal pub const IMPORT_OBJECT_ORDINAL: u16 = 0; /// Import name == public symbol name. diff --git a/vendor/object/src/read/any.rs b/vendor/object/src/read/any.rs index 342ad75fd..2e147c672 100644 --- a/vendor/object/src/read/any.rs +++ b/vendor/object/src/read/any.rs @@ -208,12 +208,9 @@ macro_rules! next_inner { /// /// Most functionality is provided by the `Object` trait implementation. #[derive(Debug)] -pub struct File<'data, R: ReadRef<'data> = &'data [u8]> { - inner: FileInternal<'data, R>, -} - -#[derive(Debug)] -enum FileInternal<'data, R: ReadRef<'data>> { +#[non_exhaustive] +#[allow(missing_docs)] +pub enum File<'data, R: ReadRef<'data> = &'data [u8]> { #[cfg(feature = "coff")] Coff(coff::CoffFile<'data, R>), #[cfg(feature = "coff")] @@ -241,33 +238,32 @@ enum FileInternal<'data, R: ReadRef<'data>> { impl<'data, R: ReadRef<'data>> File<'data, R> { /// Parse the raw file data. pub fn parse(data: R) -> Result<Self> { - let inner = match FileKind::parse(data)? { + Ok(match FileKind::parse(data)? { #[cfg(feature = "elf")] - FileKind::Elf32 => FileInternal::Elf32(elf::ElfFile32::parse(data)?), + FileKind::Elf32 => File::Elf32(elf::ElfFile32::parse(data)?), #[cfg(feature = "elf")] - FileKind::Elf64 => FileInternal::Elf64(elf::ElfFile64::parse(data)?), + FileKind::Elf64 => File::Elf64(elf::ElfFile64::parse(data)?), #[cfg(feature = "macho")] - FileKind::MachO32 => FileInternal::MachO32(macho::MachOFile32::parse(data)?), + FileKind::MachO32 => File::MachO32(macho::MachOFile32::parse(data)?), #[cfg(feature = "macho")] - FileKind::MachO64 => FileInternal::MachO64(macho::MachOFile64::parse(data)?), + FileKind::MachO64 => File::MachO64(macho::MachOFile64::parse(data)?), #[cfg(feature = "wasm")] - FileKind::Wasm => FileInternal::Wasm(wasm::WasmFile::parse(data)?), + FileKind::Wasm => File::Wasm(wasm::WasmFile::parse(data)?), #[cfg(feature = "pe")] - FileKind::Pe32 => FileInternal::Pe32(pe::PeFile32::parse(data)?), + FileKind::Pe32 => File::Pe32(pe::PeFile32::parse(data)?), #[cfg(feature = "pe")] - FileKind::Pe64 => FileInternal::Pe64(pe::PeFile64::parse(data)?), + FileKind::Pe64 => File::Pe64(pe::PeFile64::parse(data)?), #[cfg(feature = "coff")] - FileKind::Coff => FileInternal::Coff(coff::CoffFile::parse(data)?), + FileKind::Coff => File::Coff(coff::CoffFile::parse(data)?), #[cfg(feature = "coff")] - FileKind::CoffBig => FileInternal::CoffBig(coff::CoffBigFile::parse(data)?), + FileKind::CoffBig => File::CoffBig(coff::CoffBigFile::parse(data)?), #[cfg(feature = "xcoff")] - FileKind::Xcoff32 => FileInternal::Xcoff32(xcoff::XcoffFile32::parse(data)?), + FileKind::Xcoff32 => File::Xcoff32(xcoff::XcoffFile32::parse(data)?), #[cfg(feature = "xcoff")] - FileKind::Xcoff64 => FileInternal::Xcoff64(xcoff::XcoffFile64::parse(data)?), + FileKind::Xcoff64 => File::Xcoff64(xcoff::XcoffFile64::parse(data)?), #[allow(unreachable_patterns)] _ => return Err(Error("Unsupported file format")), - }; - Ok(File { inner }) + }) } /// Parse a Mach-O image from the dyld shared cache. @@ -275,33 +271,32 @@ impl<'data, R: ReadRef<'data>> File<'data, R> { pub fn parse_dyld_cache_image<'cache, E: Endian>( image: &macho::DyldCacheImage<'data, 'cache, E, R>, ) -> Result<Self> { - let inner = match image.cache.architecture().address_size() { + Ok(match image.cache.architecture().address_size() { Some(AddressSize::U64) => { - FileInternal::MachO64(macho::MachOFile64::parse_dyld_cache_image(image)?) + File::MachO64(macho::MachOFile64::parse_dyld_cache_image(image)?) } Some(AddressSize::U32) => { - FileInternal::MachO32(macho::MachOFile32::parse_dyld_cache_image(image)?) + File::MachO32(macho::MachOFile32::parse_dyld_cache_image(image)?) } _ => return Err(Error("Unsupported file format")), - }; - Ok(File { inner }) + }) } /// Return the file format. pub fn format(&self) -> BinaryFormat { - match self.inner { + match self { #[cfg(feature = "coff")] - FileInternal::Coff(_) | FileInternal::CoffBig(_) => BinaryFormat::Coff, + File::Coff(_) | File::CoffBig(_) => BinaryFormat::Coff, #[cfg(feature = "elf")] - FileInternal::Elf32(_) | FileInternal::Elf64(_) => BinaryFormat::Elf, + File::Elf32(_) | File::Elf64(_) => BinaryFormat::Elf, #[cfg(feature = "macho")] - FileInternal::MachO32(_) | FileInternal::MachO64(_) => BinaryFormat::MachO, + File::MachO32(_) | File::MachO64(_) => BinaryFormat::MachO, #[cfg(feature = "pe")] - FileInternal::Pe32(_) | FileInternal::Pe64(_) => BinaryFormat::Pe, + File::Pe32(_) | File::Pe64(_) => BinaryFormat::Pe, #[cfg(feature = "wasm")] - FileInternal::Wasm(_) => BinaryFormat::Wasm, + File::Wasm(_) => BinaryFormat::Wasm, #[cfg(feature = "xcoff")] - FileInternal::Xcoff32(_) | FileInternal::Xcoff64(_) => BinaryFormat::Xcoff, + File::Xcoff32(_) | File::Xcoff64(_) => BinaryFormat::Xcoff, } } } @@ -325,56 +320,52 @@ where type DynamicRelocationIterator = DynamicRelocationIterator<'data, 'file, R>; fn architecture(&self) -> Architecture { - with_inner!(self.inner, FileInternal, |x| x.architecture()) + with_inner!(self, File, |x| x.architecture()) } fn is_little_endian(&self) -> bool { - with_inner!(self.inner, FileInternal, |x| x.is_little_endian()) + with_inner!(self, File, |x| x.is_little_endian()) } fn is_64(&self) -> bool { - with_inner!(self.inner, FileInternal, |x| x.is_64()) + with_inner!(self, File, |x| x.is_64()) } fn kind(&self) -> ObjectKind { - with_inner!(self.inner, FileInternal, |x| x.kind()) + with_inner!(self, File, |x| x.kind()) } fn segments(&'file self) -> SegmentIterator<'data, 'file, R> { SegmentIterator { - inner: map_inner!(self.inner, FileInternal, SegmentIteratorInternal, |x| x - .segments()), + inner: map_inner!(self, File, SegmentIteratorInternal, |x| x.segments()), } } fn section_by_name_bytes(&'file self, section_name: &[u8]) -> Option<Section<'data, 'file, R>> { - map_inner_option!(self.inner, FileInternal, SectionInternal, |x| x + map_inner_option!(self, File, SectionInternal, |x| x .section_by_name_bytes(section_name)) .map(|inner| Section { inner }) } fn section_by_index(&'file self, index: SectionIndex) -> Result<Section<'data, 'file, R>> { - map_inner_option!(self.inner, FileInternal, SectionInternal, |x| x - .section_by_index(index)) - .map(|inner| Section { inner }) + map_inner_option!(self, File, SectionInternal, |x| x.section_by_index(index)) + .map(|inner| Section { inner }) } fn sections(&'file self) -> SectionIterator<'data, 'file, R> { SectionIterator { - inner: map_inner!(self.inner, FileInternal, SectionIteratorInternal, |x| x - .sections()), + inner: map_inner!(self, File, SectionIteratorInternal, |x| x.sections()), } } fn comdats(&'file self) -> ComdatIterator<'data, 'file, R> { ComdatIterator { - inner: map_inner!(self.inner, FileInternal, ComdatIteratorInternal, |x| x - .comdats()), + inner: map_inner!(self, File, ComdatIteratorInternal, |x| x.comdats()), } } fn symbol_by_index(&'file self, index: SymbolIndex) -> Result<Symbol<'data, 'file, R>> { - map_inner_option!(self.inner, FileInternal, SymbolInternal, |x| x + map_inner_option!(self, File, SymbolInternal, |x| x .symbol_by_index(index) .map(|x| (x, PhantomData))) .map(|inner| Symbol { inner }) @@ -382,7 +373,7 @@ where fn symbols(&'file self) -> SymbolIterator<'data, 'file, R> { SymbolIterator { - inner: map_inner!(self.inner, FileInternal, SymbolIteratorInternal, |x| ( + inner: map_inner!(self, File, SymbolIteratorInternal, |x| ( x.symbols(), PhantomData )), @@ -390,7 +381,7 @@ where } fn symbol_table(&'file self) -> Option<SymbolTable<'data, 'file, R>> { - map_inner_option!(self.inner, FileInternal, SymbolTableInternal, |x| x + map_inner_option!(self, File, SymbolTableInternal, |x| x .symbol_table() .map(|x| (x, PhantomData))) .map(|inner| SymbolTable { inner }) @@ -398,7 +389,7 @@ where fn dynamic_symbols(&'file self) -> SymbolIterator<'data, 'file, R> { SymbolIterator { - inner: map_inner!(self.inner, FileInternal, SymbolIteratorInternal, |x| ( + inner: map_inner!(self, File, SymbolIteratorInternal, |x| ( x.dynamic_symbols(), PhantomData )), @@ -406,7 +397,7 @@ where } fn dynamic_symbol_table(&'file self) -> Option<SymbolTable<'data, 'file, R>> { - map_inner_option!(self.inner, FileInternal, SymbolTableInternal, |x| x + map_inner_option!(self, File, SymbolTableInternal, |x| x .dynamic_symbol_table() .map(|x| (x, PhantomData))) .map(|inner| SymbolTable { inner }) @@ -414,11 +405,11 @@ where #[cfg(feature = "elf")] fn dynamic_relocations(&'file self) -> Option<DynamicRelocationIterator<'data, 'file, R>> { - let inner = match self.inner { - FileInternal::Elf32(ref elf) => { + let inner = match self { + File::Elf32(ref elf) => { DynamicRelocationIteratorInternal::Elf32(elf.dynamic_relocations()?) } - FileInternal::Elf64(ref elf) => { + File::Elf64(ref elf) => { DynamicRelocationIteratorInternal::Elf64(elf.dynamic_relocations()?) } #[allow(unreachable_patterns)] @@ -433,60 +424,60 @@ where } fn symbol_map(&self) -> SymbolMap<SymbolMapName<'data>> { - with_inner!(self.inner, FileInternal, |x| x.symbol_map()) + with_inner!(self, File, |x| x.symbol_map()) } fn object_map(&self) -> ObjectMap<'data> { - with_inner!(self.inner, FileInternal, |x| x.object_map()) + with_inner!(self, File, |x| x.object_map()) } fn imports(&self) -> Result<Vec<Import<'data>>> { - with_inner!(self.inner, FileInternal, |x| x.imports()) + with_inner!(self, File, |x| x.imports()) } fn exports(&self) -> Result<Vec<Export<'data>>> { - with_inner!(self.inner, FileInternal, |x| x.exports()) + with_inner!(self, File, |x| x.exports()) } fn has_debug_symbols(&self) -> bool { - with_inner!(self.inner, FileInternal, |x| x.has_debug_symbols()) + with_inner!(self, File, |x| x.has_debug_symbols()) } #[inline] fn mach_uuid(&self) -> Result<Option<[u8; 16]>> { - with_inner!(self.inner, FileInternal, |x| x.mach_uuid()) + with_inner!(self, File, |x| x.mach_uuid()) } #[inline] fn build_id(&self) -> Result<Option<&'data [u8]>> { - with_inner!(self.inner, FileInternal, |x| x.build_id()) + with_inner!(self, File, |x| x.build_id()) } #[inline] fn gnu_debuglink(&self) -> Result<Option<(&'data [u8], u32)>> { - with_inner!(self.inner, FileInternal, |x| x.gnu_debuglink()) + with_inner!(self, File, |x| x.gnu_debuglink()) } #[inline] fn gnu_debugaltlink(&self) -> Result<Option<(&'data [u8], &'data [u8])>> { - with_inner!(self.inner, FileInternal, |x| x.gnu_debugaltlink()) + with_inner!(self, File, |x| x.gnu_debugaltlink()) } #[inline] fn pdb_info(&self) -> Result<Option<CodeView<'_>>> { - with_inner!(self.inner, FileInternal, |x| x.pdb_info()) + with_inner!(self, File, |x| x.pdb_info()) } fn relative_address_base(&self) -> u64 { - with_inner!(self.inner, FileInternal, |x| x.relative_address_base()) + with_inner!(self, File, |x| x.relative_address_base()) } fn entry(&self) -> u64 { - with_inner!(self.inner, FileInternal, |x| x.entry()) + with_inner!(self, File, |x| x.entry()) } fn flags(&self) -> FileFlags { - with_inner!(self.inner, FileInternal, |x| x.flags()) + with_inner!(self, File, |x| x.flags()) } } diff --git a/vendor/object/src/read/coff/import.rs b/vendor/object/src/read/coff/import.rs new file mode 100644 index 000000000..d635e7592 --- /dev/null +++ b/vendor/object/src/read/coff/import.rs @@ -0,0 +1,209 @@ +//! Support for reading short import files. +//! +//! These are used by some Windows linkers as a more compact way to describe +//! dynamically imported symbols. + +use crate::read::{Architecture, Error, ReadError, ReadRef, Result}; +use crate::{pe, ByteString, Bytes, LittleEndian as LE}; + +/// A Windows short form description of a symbol to import. +/// +/// Used in Windows import libraries to provide a mapping from +/// a symbol name to a DLL export. This is not an object file. +#[derive(Debug, Clone)] +pub struct ImportFile<'data> { + header: &'data pe::ImportObjectHeader, + kind: ImportType, + dll: ByteString<'data>, + symbol: ByteString<'data>, + import: Option<ByteString<'data>>, +} + +impl<'data> ImportFile<'data> { + /// Parse it. + pub fn parse<R: ReadRef<'data>>(data: R) -> Result<Self> { + let mut offset = 0; + let header = pe::ImportObjectHeader::parse(data, &mut offset)?; + let data = header.parse_data(data, &mut offset)?; + + // Unmangles a name by removing a `?`, `@` or `_` prefix. + fn strip_prefix(s: &[u8]) -> &[u8] { + match s.split_first() { + Some((b, rest)) if [b'?', b'@', b'_'].contains(b) => rest, + _ => s, + } + } + Ok(Self { + header, + dll: data.dll, + symbol: data.symbol, + kind: match header.import_type() { + pe::IMPORT_OBJECT_CODE => ImportType::Code, + pe::IMPORT_OBJECT_DATA => ImportType::Data, + pe::IMPORT_OBJECT_CONST => ImportType::Const, + _ => return Err(Error("Invalid COFF import library import type")), + }, + import: match header.name_type() { + pe::IMPORT_OBJECT_ORDINAL => None, + pe::IMPORT_OBJECT_NAME => Some(data.symbol()), + pe::IMPORT_OBJECT_NAME_NO_PREFIX => Some(strip_prefix(data.symbol())), + pe::IMPORT_OBJECT_NAME_UNDECORATE => Some( + strip_prefix(data.symbol()) + .split(|&b| b == b'@') + .next() + .unwrap(), + ), + pe::IMPORT_OBJECT_NAME_EXPORTAS => data.export(), + _ => return Err(Error("Unknown COFF import library name type")), + } + .map(ByteString), + }) + } + + /// Get the machine type. + pub fn architecture(&self) -> Architecture { + match self.header.machine.get(LE) { + pe::IMAGE_FILE_MACHINE_ARMNT => Architecture::Arm, + pe::IMAGE_FILE_MACHINE_ARM64 => Architecture::Aarch64, + pe::IMAGE_FILE_MACHINE_I386 => Architecture::I386, + pe::IMAGE_FILE_MACHINE_AMD64 => Architecture::X86_64, + _ => Architecture::Unknown, + } + } + + /// The public symbol name. + pub fn symbol(&self) -> &'data [u8] { + self.symbol.0 + } + + /// The name of the DLL to import the symbol from. + pub fn dll(&self) -> &'data [u8] { + self.dll.0 + } + + /// The name exported from the DLL. + pub fn import(&self) -> ImportName<'data> { + match self.import { + Some(name) => ImportName::Name(name.0), + None => ImportName::Ordinal(self.header.ordinal_or_hint.get(LE)), + } + } + + /// The type of import. Usually either a function or data. + pub fn import_type(&self) -> ImportType { + self.kind + } +} + +/// The name or ordinal to import from a DLL. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ImportName<'data> { + /// Import by ordinal. Ordinarily this is a 1-based index. + Ordinal(u16), + /// Import by name. + Name(&'data [u8]), +} + +/// The kind of import symbol. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum ImportType { + /// An executable code symbol. + Code, + /// A data symbol. + Data, + /// A constant value. + Const, +} + +impl pe::ImportObjectHeader { + /// Read the short import header. + /// + /// Also checks that the signature and version are valid. + /// Directly following this header will be the string data. + pub fn parse<'data, R: ReadRef<'data>>(data: R, offset: &mut u64) -> Result<&'data Self> { + let header = data + .read::<pe::ImportObjectHeader>(offset) + .read_error("Invalid COFF import library header size")?; + if header.sig1.get(LE) != 0 || header.sig2.get(LE) != pe::IMPORT_OBJECT_HDR_SIG2 { + Err(Error("Invalid COFF import library header")) + } else if header.version.get(LE) != 0 { + Err(Error("Unknown COFF import library header version")) + } else { + Ok(header) + } + } + + /// Parse the data following the header. + pub fn parse_data<'data, R: ReadRef<'data>>( + &self, + data: R, + offset: &mut u64, + ) -> Result<ImportObjectData<'data>> { + let mut data = Bytes( + data.read_bytes(offset, u64::from(self.size_of_data.get(LE))) + .read_error("Invalid COFF import library data size")?, + ); + let symbol = data + .read_string() + .map(ByteString) + .read_error("Could not read COFF import library symbol name")?; + let dll = data + .read_string() + .map(ByteString) + .read_error("Could not read COFF import library DLL name")?; + let export = if self.name_type() == pe::IMPORT_OBJECT_NAME_EXPORTAS { + data.read_string() + .map(ByteString) + .map(Some) + .read_error("Could not read COFF import library export name")? + } else { + None + }; + Ok(ImportObjectData { + symbol, + dll, + export, + }) + } + + /// The type of import. + /// + /// This is one of the `IMPORT_OBJECT_*` constants. + pub fn import_type(&self) -> u16 { + self.name_type.get(LE) & pe::IMPORT_OBJECT_TYPE_MASK + } + + /// The type of import name. + /// + /// This is one of the `IMPORT_OBJECT_*` constants. + pub fn name_type(&self) -> u16 { + (self.name_type.get(LE) >> pe::IMPORT_OBJECT_NAME_SHIFT) & pe::IMPORT_OBJECT_NAME_MASK + } +} + +/// The data following `ImportObjectHeader`. +#[derive(Debug, Clone)] +pub struct ImportObjectData<'data> { + symbol: ByteString<'data>, + dll: ByteString<'data>, + export: Option<ByteString<'data>>, +} + +impl<'data> ImportObjectData<'data> { + /// The public symbol name. + pub fn symbol(&self) -> &'data [u8] { + self.symbol.0 + } + + /// The name of the DLL to import the symbol from. + pub fn dll(&self) -> &'data [u8] { + self.dll.0 + } + + /// The name exported from the DLL. + /// + /// This is only set if the name is not derived from the symbol name. + pub fn export(&self) -> Option<&'data [u8]> { + self.export.map(|export| export.0) + } +} diff --git a/vendor/object/src/read/coff/mod.rs b/vendor/object/src/read/coff/mod.rs index d5b3caf32..26020d797 100644 --- a/vendor/object/src/read/coff/mod.rs +++ b/vendor/object/src/read/coff/mod.rs @@ -16,3 +16,6 @@ pub use relocation::*; mod comdat; pub use comdat::*; + +mod import; +pub use import::*; diff --git a/vendor/object/src/read/elf/file.rs b/vendor/object/src/read/elf/file.rs index aac66e7cc..67be37e21 100644 --- a/vendor/object/src/read/elf/file.rs +++ b/vendor/object/src/read/elf/file.rs @@ -161,6 +161,7 @@ where (elf::EM_ARM, _) => Architecture::Arm, (elf::EM_AVR, _) => Architecture::Avr, (elf::EM_BPF, _) => Architecture::Bpf, + (elf::EM_CSKY, _) => Architecture::Csky, (elf::EM_386, _) => Architecture::I386, (elf::EM_X86_64, false) => Architecture::X86_64_X32, (elf::EM_X86_64, true) => Architecture::X86_64, diff --git a/vendor/object/src/read/elf/note.rs b/vendor/object/src/read/elf/note.rs index fc5aa7753..84d4179de 100644 --- a/vendor/object/src/read/elf/note.rs +++ b/vendor/object/src/read/elf/note.rs @@ -113,21 +113,24 @@ impl<'data, Elf: FileHeader> Note<'data, Elf> { self.header.n_descsz(endian) } - /// Return the bytes for the name field following the `NoteHeader`, - /// excluding any null terminator. + /// Return the bytes for the name field following the `NoteHeader`. /// - /// This field is usually a string including a null terminator + /// This field is usually a string including one or more trailing null bytes /// (but it is not required to be). /// - /// The length of this field (including any null terminator) is given by - /// `n_namesz`. + /// The length of this field is given by `n_namesz`. + pub fn name_bytes(&self) -> &'data [u8] { + self.name + } + + /// Return the bytes for the name field following the `NoteHeader`, + /// excluding all trailing null bytes. pub fn name(&self) -> &'data [u8] { - if let Some((last, name)) = self.name.split_last() { - if *last == 0 { - return name; - } + let mut name = self.name; + while let [rest @ .., 0] = name { + name = rest; } - self.name + name } /// Return the bytes for the desc field following the `NoteHeader`. diff --git a/vendor/object/src/read/elf/relocation.rs b/vendor/object/src/read/elf/relocation.rs index 8443dbc75..78032dfdb 100644 --- a/vendor/object/src/read/elf/relocation.rs +++ b/vendor/object/src/read/elf/relocation.rs @@ -276,6 +276,11 @@ fn parse_relocation<Elf: FileHeader>( elf::R_BPF_64_32 => (RelocationKind::Absolute, 32), r_type => (RelocationKind::Elf(r_type), 0), }, + elf::EM_CSKY => match reloc.r_type(endian, false) { + elf::R_CKCORE_ADDR32 => (RelocationKind::Absolute, 32), + elf::R_CKCORE_PCREL32 => (RelocationKind::Relative, 32), + r_type => (RelocationKind::Elf(r_type), 0), + }, elf::EM_386 => match reloc.r_type(endian, false) { elf::R_386_32 => (RelocationKind::Absolute, 32), elf::R_386_PC32 => (RelocationKind::Relative, 32), diff --git a/vendor/object/src/read/elf/symbol.rs b/vendor/object/src/read/elf/symbol.rs index ac1095705..ee5aa37f1 100644 --- a/vendor/object/src/read/elf/symbol.rs +++ b/vendor/object/src/read/elf/symbol.rs @@ -309,6 +309,14 @@ where pub(super) symbol: &'data Elf::Sym, } +impl<'data, 'file, Elf: FileHeader, R: ReadRef<'data>> ElfSymbol<'data, 'file, Elf, R> { + /// Return a reference to the raw symbol structure. + #[inline] + pub fn raw_symbol(&self) -> &'data Elf::Sym { + self.symbol + } +} + impl<'data, 'file, Elf: FileHeader, R: ReadRef<'data>> read::private::Sealed for ElfSymbol<'data, 'file, Elf, R> { diff --git a/vendor/object/src/read/mod.rs b/vendor/object/src/read/mod.rs index 0a450359f..8230d43ba 100644 --- a/vendor/object/src/read/mod.rs +++ b/vendor/object/src/read/mod.rs @@ -156,6 +156,9 @@ pub enum FileKind { /// This supports a larger number of sections. #[cfg(feature = "coff")] CoffBig, + /// A Windows short import file. + #[cfg(feature = "coff")] + CoffImport, /// A dyld cache file containing Mach-O images. #[cfg(feature = "macho")] DyldCache, @@ -232,6 +235,7 @@ impl FileKind { [0x00, b'a', b's', b'm', ..] => FileKind::Wasm, #[cfg(feature = "pe")] [b'M', b'Z', ..] if offset == 0 => { + // offset == 0 restriction is because optional_header_magic only looks at offset 0 match pe::optional_header_magic(data) { Ok(crate::pe::IMAGE_NT_OPTIONAL_HDR32_MAGIC) => { FileKind::Pe32 @@ -253,16 +257,19 @@ impl FileKind { // COFF x86-64 | [0x64, 0x86, ..] => FileKind::Coff, #[cfg(feature = "coff")] + [0x00, 0x00, 0xff, 0xff, 0x00, 0x00, ..] => FileKind::CoffImport, + #[cfg(feature = "coff")] [0x00, 0x00, 0xff, 0xff, 0x02, 0x00, ..] if offset == 0 => { + // offset == 0 restriction is because anon_object_class_id only looks at offset 0 match coff::anon_object_class_id(data) { Ok(crate::pe::ANON_OBJECT_HEADER_BIGOBJ_CLASS_ID) => FileKind::CoffBig, _ => return Err(Error("Unknown anon object file")), } } #[cfg(feature = "xcoff")] - [0x01, 0xDF, ..] => FileKind::Xcoff32, + [0x01, 0xdf, ..] => FileKind::Xcoff32, #[cfg(feature = "xcoff")] - [0x01, 0xF7, ..] => FileKind::Xcoff64, + [0x01, 0xf7, ..] => FileKind::Xcoff64, _ => return Err(Error("Unknown file magic")), }; Ok(kind) diff --git a/vendor/object/src/write/elf/object.rs b/vendor/object/src/write/elf/object.rs index 8b9eadaf8..acc820c9e 100644 --- a/vendor/object/src/write/elf/object.rs +++ b/vendor/object/src/write/elf/object.rs @@ -126,6 +126,7 @@ impl<'a> Object<'a> { Architecture::Arm => false, Architecture::Avr => true, Architecture::Bpf => false, + Architecture::Csky => true, Architecture::I386 => false, Architecture::X86_64 => true, Architecture::X86_64_X32 => true, @@ -329,6 +330,7 @@ impl<'a> Object<'a> { Architecture::Arm => elf::EM_ARM, Architecture::Avr => elf::EM_AVR, Architecture::Bpf => elf::EM_BPF, + Architecture::Csky => elf::EM_CSKY, Architecture::I386 => elf::EM_386, Architecture::X86_64 => elf::EM_X86_64, Architecture::X86_64_X32 => elf::EM_X86_64, @@ -548,6 +550,16 @@ impl<'a> Object<'a> { return Err(Error(format!("unimplemented relocation {:?}", reloc))); } }, + Architecture::Csky => match (reloc.kind, reloc.encoding, reloc.size) { + (RelocationKind::Absolute, _, 32) => elf::R_CKCORE_ADDR32, + (RelocationKind::Relative, RelocationEncoding::Generic, 32) => { + elf::R_CKCORE_PCREL32 + } + (RelocationKind::Elf(x), _, _) => x, + _ => { + return Err(Error(format!("unimplemented relocation {:?}", reloc))); + } + }, Architecture::I386 => match (reloc.kind, reloc.size) { (RelocationKind::Absolute, 32) => elf::R_386_32, (RelocationKind::Relative, 32) => elf::R_386_PC32, diff --git a/vendor/object/src/write/macho.rs b/vendor/object/src/write/macho.rs index 0e082b69d..e3ce55bb4 100644 --- a/vendor/object/src/write/macho.rs +++ b/vendor/object/src/write/macho.rs @@ -303,39 +303,29 @@ impl<'a> Object<'a> { let sizeofcmds = offset - command_offset; // Calculate size of section data. - let mut segment_file_offset = None; + // Section data can immediately follow the load commands without any alignment padding. + let segment_file_offset = offset; let mut section_offsets = vec![SectionOffsets::default(); self.sections.len()]; let mut address = 0; for (index, section) in self.sections.iter().enumerate() { section_offsets[index].index = 1 + index; if !section.is_bss() { - let len = section.data.len(); - if len != 0 { - offset = align(offset, section.align as usize); - section_offsets[index].offset = offset; - if segment_file_offset.is_none() { - segment_file_offset = Some(offset); - } - offset += len; - } else { - section_offsets[index].offset = offset; - } address = align_u64(address, section.align); section_offsets[index].address = address; + section_offsets[index].offset = segment_file_offset + address as usize; address += section.size; } } + let segment_file_size = address as usize; + offset += address as usize; for (index, section) in self.sections.iter().enumerate() { - if section.kind.is_bss() { - assert!(section.data.is_empty()); + if section.is_bss() { + debug_assert!(section.data.is_empty()); address = align_u64(address, section.align); section_offsets[index].address = address; address += section.size; } } - let segment_file_offset = segment_file_offset.unwrap_or(offset); - let segment_file_size = offset - segment_file_offset; - debug_assert!(segment_file_size as u64 <= address); // Count symbols and add symbol strings to strtab. let mut strtab = StringTable::default(); @@ -537,10 +527,8 @@ impl<'a> Object<'a> { // Write section data. for (index, section) in self.sections.iter().enumerate() { - let len = section.data.len(); - if len != 0 { - write_align(buffer, section.align as usize); - debug_assert_eq!(section_offsets[index].offset, buffer.len()); + if !section.is_bss() { + buffer.resize(section_offsets[index].offset); buffer.write_bytes(§ion.data); } } diff --git a/vendor/object/tests/round_trip/macho.rs b/vendor/object/tests/round_trip/macho.rs index ca3ad5ca2..f45d3db12 100644 --- a/vendor/object/tests/round_trip/macho.rs +++ b/vendor/object/tests/round_trip/macho.rs @@ -1,8 +1,9 @@ use object::read::macho::MachHeader; -use object::{macho, write, Architecture, BinaryFormat, Endianness}; +use object::read::{Object, ObjectSection}; +use object::{macho, read, write, Architecture, BinaryFormat, Endianness}; -#[test] // Test that segment size is valid when the first section needs alignment. +#[test] fn issue_286_segment_file_size() { let mut object = write::Object::new( BinaryFormat::MachO, @@ -22,3 +23,41 @@ fn issue_286_segment_file_size() { assert_eq!(segment.vmsize.get(endian), 30); assert_eq!(segment.filesize.get(endian), 30); } + +// We were emitting section file alignment padding that didn't match the address alignment padding. +#[test] +fn issue_552_section_file_alignment() { + let mut object = write::Object::new( + BinaryFormat::MachO, + Architecture::X86_64, + Endianness::Little, + ); + + // Odd number of sections ensures that the starting file offset is not a multiple of 32. + // Length of 32 ensures that the file offset of the end of this section is still not a + // multiple of 32. + let section = object.add_section(vec![], vec![], object::SectionKind::ReadOnlyDataWithRel); + object.append_section_data(section, &vec![0u8; 32], 1); + + // Address is already aligned correctly, so there must not any padding, + // even though file offset is not aligned. + let section = object.add_section(vec![], vec![], object::SectionKind::ReadOnlyData); + object.append_section_data(section, &vec![0u8; 1], 32); + + let section = object.add_section(vec![], vec![], object::SectionKind::Text); + object.append_section_data(section, &vec![0u8; 1], 1); + + let bytes = &*object.write().unwrap(); + let object = read::File::parse(bytes).unwrap(); + let mut sections = object.sections(); + + let section = sections.next().unwrap(); + assert_eq!(section.file_range(), Some((368, 32))); + assert_eq!(section.address(), 0); + assert_eq!(section.size(), 32); + + let section = sections.next().unwrap(); + assert_eq!(section.file_range(), Some((400, 1))); + assert_eq!(section.address(), 32); + assert_eq!(section.size(), 1); +} diff --git a/vendor/object/tests/round_trip/mod.rs b/vendor/object/tests/round_trip/mod.rs index 8f8dd79c9..cd696f608 100644 --- a/vendor/object/tests/round_trip/mod.rs +++ b/vendor/object/tests/round_trip/mod.rs @@ -235,6 +235,7 @@ fn elf_any() { (Architecture::Arm, Endianness::Little), (Architecture::Avr, Endianness::Little), (Architecture::Bpf, Endianness::Little), + (Architecture::Csky, Endianness::Little), (Architecture::I386, Endianness::Little), (Architecture::X86_64, Endianness::Little), (Architecture::X86_64_X32, Endianness::Little), |