Compare commits
580 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fdce705e55 | |||
| 81268e7064 | |||
| f502f41359 | |||
| 34c9cfb6b0 | |||
| 6da1790c46 | |||
| d333c940da | |||
| c940d2906f | |||
| ac4b51ba85 | |||
| ea7a1ad2c7 | |||
| 45ddd6a68d | |||
| acd99364e0 | |||
| 14710dea55 | |||
| 5d3be8da1d | |||
| 3026821f9f | |||
| fba51dabd0 | |||
| c4da5e81fa | |||
| bc80d81432 | |||
| 67797efead | |||
| c7cb036536 | |||
| 0ccbc5f139 | |||
| 2a6bbcaf8f | |||
| d46a8438ba | |||
| cc9d19da19 | |||
| 6e6aa6fd6d | |||
| 61652a2989 | |||
| edd7503607 | |||
| c9d6dab401 | |||
| d303038bcb | |||
| 0a0e7c3b7c | |||
| 0b4ac35bc9 | |||
| c51864ca39 | |||
| a1cabd5a68 | |||
| 9c1bc99d7a | |||
| c05fedcb76 | |||
| e11beeae4b | |||
| 4749e0d71e | |||
| 1c01b77a71 | |||
| 1dd8ad3685 | |||
| d6f6350b54 | |||
| 4f3b85e604 | |||
| efd5bc24b0 | |||
| a1d5dfa1ac | |||
| 597c2ba180 | |||
| 2c2fb1b70b | |||
| fc1287659a | |||
| 1a76630594 | |||
| 322f682d32 | |||
| 0e329336fc | |||
| b33bdabbb6 | |||
| 27d30121ab | |||
| 345278f309 | |||
| 4953e77161 | |||
| 8d61e037f9 | |||
| 33a51e69bf | |||
| d5dd9bbf24 | |||
| 8772e52513 | |||
| 9e1631ad4f | |||
| 134b829d59 | |||
| 3df7d26101 | |||
| cf56086f06 | |||
| a72aca4379 | |||
| edb0b7519a | |||
| 3a3248c88c | |||
| 3f14b9dab7 | |||
| b1c07c22ce | |||
| 3b2c411274 | |||
| e418af1ccd | |||
| 7dc004acb3 | |||
| 2635472896 | |||
| 5c0340f9ae | |||
| c2c970ee33 | |||
| b52dabe091 | |||
| 3fa2db8d6f | |||
| 1e7950f671 | |||
| 8fde05191a | |||
| 2557de6c4e | |||
| 44328aee76 | |||
| f606b5879b | |||
| 83607119df | |||
| 9b86e68268 | |||
| d688a05ac7 | |||
| 97e975b4f6 | |||
| 9dd0e3ce4f | |||
| ca2293f6d3 | |||
| 0cd1ef0c7a | |||
| b0207ce524 | |||
| fab0c3b09d | |||
| 8b35dd3358 | |||
| cadcbb27eb | |||
| 297d44c614 | |||
| 22178f2224 | |||
| 554f8a376c | |||
| 4157affbd7 | |||
| 4b991203df | |||
| 38a265741c | |||
| 56eb02280f | |||
| ed900b0476 | |||
| 42206364e5 | |||
| 82d9bb8f51 | |||
| 923a9d3f9b | |||
| ae7660068b | |||
| f466c1d764 | |||
| 6e76f8ef3a | |||
| b3a8d02caf | |||
| 022ba32c1a | |||
| 8f5e89c900 | |||
| d335d7bafd | |||
| 1f51ef7df6 | |||
| ec082ee023 | |||
| a6bc271e0d | |||
| 791fd9199e | |||
| 9e8baf1914 | |||
| 64b7080532 | |||
| 8fd5479f32 | |||
| 04eb9c02c3 | |||
| 07b41b9bc3 | |||
| 8ebadfafe9 | |||
| 3283896e4b | |||
| b444bcf418 | |||
| 13034577fc | |||
| 9feefc2e7f | |||
| a5393e985d | |||
| e3fe0dc89b | |||
| 42d49e9d50 | |||
| 06eb244800 | |||
| 870cdfa51f | |||
| 93787c74ee | |||
| 945323fe15 | |||
| 5e41e69b27 | |||
| 9d14185f7d | |||
| 0f74162551 | |||
| 00b1ff1ff6 | |||
| 977024ea94 | |||
| 3534ed21d7 | |||
| ee093e5232 | |||
| 807ab8d19f | |||
| 81f3ff098f | |||
| 85a5759afb | |||
| 490e7a56a5 | |||
| e41c475671 | |||
| b0841268bd | |||
| b9b3b67b95 | |||
| 0d57d2cfe3 | |||
| 32de5d0d7f | |||
| 51eab2a4b7 | |||
| 93cf170253 | |||
| f7554374ab | |||
| b4870f62c9 | |||
| f1d713ebf6 | |||
| 4134a512b9 | |||
| cf998f945c | |||
| a7386238dd | |||
| 6b39d122a6 | |||
| a0582c5380 | |||
| 1f37112969 | |||
| 361958db76 | |||
| 8bc7880b19 | |||
| ceddf29586 | |||
| 3fc78e21bc | |||
| 48e00b371c | |||
| aee52d3880 | |||
| bd54499537 | |||
| e6da9e8d1a | |||
| 156ca03b67 | |||
| 3f4419b177 | |||
| 676f860d7d | |||
| 5ce93ae0c7 | |||
| 43231826b9 | |||
| 899b393fcc | |||
| 5c3e02d2f0 | |||
| a29064107e | |||
| 4cdc969801 | |||
| 68159d457e | |||
| daafc29d2b | |||
| 3c786acf2b | |||
| 53c3817d4d | |||
| 9109254488 | |||
| df19f0d5ec | |||
| 093362e479 | |||
| 7826a3652b | |||
| c27b7e52e1 | |||
| 6f79cbb2a6 | |||
| 6f33929f91 | |||
| 2e8b649195 | |||
| 3841be7e20 | |||
| 2c28521283 | |||
| 1c735cc204 | |||
| f0b13ae8e4 | |||
| b1a2f8fec0 | |||
| 83828aa8a3 | |||
| 4eb81b4d66 | |||
| 96d9968db5 | |||
| 2781e37ec0 | |||
| 6d61e773b5 | |||
| c5171114d1 | |||
| 0ca0a832de | |||
| aef54a4bfd | |||
| 4c473acfec | |||
| 0de41e97ac | |||
| 0e52ab3f90 | |||
| 797679b42c | |||
| 1bc8b6f46e | |||
| f322b580ff | |||
| 2b2f33e3f5 | |||
| ce29cd2fad | |||
| 0d5843f44e | |||
| e36e8e3b33 | |||
| e251a1ca19 | |||
| 4aedb00e43 | |||
| 10a0469221 | |||
| d3419acada | |||
| 65ea4117ca | |||
| 8b0101dcab | |||
| 188f67cfca | |||
| a89f4bd4b8 | |||
| 053c9dc0e1 | |||
| 493d9f1b9d | |||
| e28793f128 | |||
| ea2bddf245 | |||
| 763b3c05af | |||
| 473cfb54be | |||
| a7fd742c17 | |||
| b66ba140cb | |||
| 242f606a29 | |||
| 60a1214d7e | |||
| 189ab8c8e8 | |||
| 3765ca4e92 | |||
| df87d76070 | |||
| 8fbf0b406b | |||
| 633073803f | |||
| 104da198d3 | |||
| b3121e4534 | |||
| 3bb654cc85 | |||
| d2830db94d | |||
| ad6914b938 | |||
| 57ba965b93 | |||
| 544ec21fc2 | |||
| 1bb0fa1809 | |||
| ffa0efc898 | |||
| af6b4b8c27 | |||
| 3f7c1f966b | |||
| 535515f296 | |||
| 7af6c4b10e | |||
| 2076bef95b | |||
| 48ce1f1814 | |||
| 5151c8a505 | |||
| 44248f19b5 | |||
| 8d433f2580 | |||
| 272fe5488c | |||
| c97765de14 | |||
| 7acf150ac5 | |||
| 077bbdfc78 | |||
| 2fb38ce13a | |||
| 22dc183f25 | |||
| 3c492c3fc7 | |||
| d71db2978e | |||
| e4723e0bad | |||
| dc56c4e530 | |||
| 9579a51a8b | |||
| 71f897ebf5 | |||
| 09d9f71ae9 | |||
| c678ccdfb1 | |||
| bbbebe343b | |||
| 033cb4f0c2 | |||
| d750034b79 | |||
| a2063f0628 | |||
| acf2f2ffc4 | |||
| d14f484c4b | |||
| 695e515a65 | |||
| 61089feee7 | |||
| ddc9b10cd3 | |||
| f95c92b431 | |||
| eba65a94e6 | |||
| c28a0c6bb8 | |||
| d6bacd9b47 | |||
| 70b1657323 | |||
| 1ef08bd169 | |||
| da68cc6a78 | |||
| 45c75d42ad | |||
| d4e55af2c2 | |||
| 48791a329d | |||
| 9b26ebed75 | |||
| e2160fb6c9 | |||
| 345a1c64f9 | |||
| 7ad1e7756b | |||
| 90caf19e9e | |||
| 8d0b3b7d44 | |||
| 4c253d68d4 | |||
| 73d1b331f1 | |||
| af2fddfd6d | |||
| 3e065ead65 | |||
| 3774704326 | |||
| 4a1100b6a4 | |||
| 63dec77ed6 | |||
| 1d3a66f890 | |||
| c1da92ca22 | |||
| 13475002d7 | |||
| 5bb6f246ed | |||
| 89df7451ef | |||
| 1334d544f7 | |||
| 3fefaa7362 | |||
| 15d62f7b96 | |||
| 83e0aaa511 | |||
| ee06ce1148 | |||
| 16d6124bb4 | |||
| 1197beaa13 | |||
| 98b428a8be | |||
| 17f47d3c0a | |||
| a9cc3b2a89 | |||
| 199102c106 | |||
| c7d76fb7ab | |||
| ba9b86c0dc | |||
| 5de83a606e | |||
| 01a0c8672d | |||
| fa522c0ffc | |||
| 16241d010f | |||
| 9cb8fbf178 | |||
| bd7ef27628 | |||
| 42e520e841 | |||
| d8f9cd237f | |||
| 33065ecf04 | |||
| 718a1da262 | |||
| b89c3ebb42 | |||
| 9d7e44feff | |||
| e48a60a4f0 | |||
| 163e1907a4 | |||
| ac1ccaa246 | |||
| 53b45279ad | |||
| f80daf5de1 | |||
| 298ea1f0d3 | |||
| 1d13d8c4a0 | |||
| 2238c99b61 | |||
| 7d4dfbef2b | |||
| 759827b404 | |||
| fca627d1b0 | |||
| 404da18aed | |||
| 330fca722a | |||
| 8939cd120b | |||
| 63afeb7373 | |||
| 6ba68a6455 | |||
| 1579c74302 | |||
| 373ca15c71 | |||
| a8a3caed1c | |||
| cb35ba4543 | |||
| cdd152d015 | |||
| 83ce7dc62f | |||
| b182b50f24 | |||
| 71a9941b84 | |||
| c777da263e | |||
| 2cb7b56a41 | |||
| 52f9ef14b9 | |||
| 8d6c594240 | |||
| 7ad77ff540 | |||
| acede72e9b | |||
| 771fd732d1 | |||
| 2a79a69f59 | |||
| 8c0321697f | |||
| 0151b3f9b3 | |||
| 82a51f35ea | |||
| 35944cbfc1 | |||
| f0aef9b28b | |||
| ae37c3902c | |||
| d612585582 | |||
| 7ca14d209c | |||
| c37f582c10 | |||
| 6272fb3822 | |||
| 2582fbac59 | |||
| 5abb578e47 | |||
| 015ebf89a5 | |||
| c6724968f1 | |||
| 9fa1772ae4 | |||
| 4551937812 | |||
| 51ee664cae | |||
| fb611a98f9 | |||
| a3d5face38 | |||
| 424cd497d3 | |||
| d46eeffaaf | |||
| 6520f2061e | |||
| 5d93f86b4b | |||
| b3f63ce7ae | |||
| 56de770682 | |||
| 940341bc9d | |||
| 804a0ce601 | |||
| 41054a4c56 | |||
| 7b8e5d4180 | |||
| ca2369f1c1 | |||
| 129cb0b3cd | |||
| 632b2ae1ba | |||
| 18e55061e1 | |||
| e49b65723f | |||
| 8e52894763 | |||
| 07cba6c774 | |||
| 9cb639b505 | |||
| 4cf6eeeee2 | |||
| c0f692792f | |||
| bd77e0945b | |||
| f0eb171b2a | |||
| fb93662b5c | |||
| a26c982e93 | |||
| 7db3e98944 | |||
| 4a87834e04 | |||
| bf6ecaeeb9 | |||
| f70ef86dfa | |||
| cd3132667a | |||
| 1c459a7bea | |||
| 4f0bfeab4c | |||
| c5c9921b59 | |||
| 6b63aba1fc | |||
| 382331fb11 | |||
| caf9af7ae4 | |||
| 45d2adeb9c | |||
| 96708d7592 | |||
| 13090d1219 | |||
| 8ab229cca9 | |||
| 583cd078dc | |||
| aa2ac1bbb8 | |||
| 928b426672 | |||
| 6766b14415 | |||
| 9d0f9e967f | |||
| d7609088e5 | |||
| b2643b6926 | |||
| 07b65ca069 | |||
| 25727f7f99 | |||
| 880ae89307 | |||
| 1496df1989 | |||
| 7d8ae6b4b1 | |||
| 312d4cccaf | |||
| ce5f9f95ea | |||
| d9bf8a76d9 | |||
| f7a35fb9fe | |||
| 3ba691ded5 | |||
| 7a7277d56f | |||
| 76be5dd1d3 | |||
| 53dc63f3bc | |||
| 80da0bc9d5 | |||
| bce7af4e11 | |||
| 9da09b51ed | |||
| 86392f197f | |||
| 1c13046297 | |||
| fbc756b531 | |||
| 6c64b06453 | |||
| 241834029a | |||
| 5b8a9c0b47 | |||
| 037c29d24a | |||
| 893f26ac9a | |||
| d43f8e3100 | |||
| 2b42acf7b8 | |||
| f65b80ed42 | |||
| e84abbdc82 | |||
| 66269eabe9 | |||
| 36c0928483 | |||
| 9237e15adc | |||
| 0d3a2072b2 | |||
| aa2ee5dfc2 | |||
| b515fa39ec | |||
| 76e3f4eb92 | |||
| 4959e5c6c2 | |||
| 7082594bbc | |||
| 36dd35f238 | |||
| 9c9fb6a485 | |||
| 5438a4837b | |||
| 84996e8cb6 | |||
| 87a368a857 | |||
| 21412d93dd | |||
| 0b11ff22b4 | |||
| 8fafa78796 | |||
| c43158f8a2 | |||
| 92ad524947 | |||
| b362a61863 | |||
| 468fec38d7 | |||
| 89830a5ae0 | |||
| 5977c296bd | |||
| 47d5792d97 | |||
| 25d706a913 | |||
| 048236aaaa | |||
| d442c58fd1 | |||
| f890f6bb09 | |||
| 036d466790 | |||
| dee47ba2d8 | |||
| be96c28b77 | |||
| ad1c0f578e | |||
| c8f7b1b72c | |||
| c89702ae84 | |||
| 2d29a82250 | |||
| b36c65e654 | |||
| 09b072b908 | |||
| 0ae9fee350 | |||
| 1579182ed9 | |||
| 074671aa71 | |||
| 36b7c47247 | |||
| 424d5b3025 | |||
| 8a5d352733 | |||
| f383629282 | |||
| a6d717cb04 | |||
| 84a5753301 | |||
| 5d2d9c7e81 | |||
| 82801d1411 | |||
| 340c3963d8 | |||
| ef15cf9847 | |||
| 4d613ccfa7 | |||
| 43ce34d547 | |||
| eda074cd80 | |||
| a2396d82f6 | |||
| a38721db93 | |||
| a06e811717 | |||
| 86e534ff75 | |||
| 640d5b2dec | |||
| 57e9b27085 | |||
| c56eefc739 | |||
| cf28306997 | |||
| 10acf3ddd1 | |||
| fed3ed9f9a | |||
| 260138ba11 | |||
| 67f7e0089c | |||
| d4a22c7851 | |||
| 06cf986490 | |||
| adf9aa04ce | |||
| 69f66fbe52 | |||
| d061005c89 | |||
| f6ee8b9f04 | |||
| 31af22c2ff | |||
| c421e3f243 | |||
| 6e92902407 | |||
| 6256381dc3 | |||
| b247b051ea | |||
| afbd553622 | |||
| 36bc14e884 | |||
| 9c5d0ff2ff | |||
| cfa6c8ddf6 | |||
| 21924bf022 | |||
| eea33f6019 | |||
| 66d48ae808 | |||
| de9b9fd0b1 | |||
| ece7384be4 | |||
| 0c052e4506 | |||
| 1996a0a3d6 | |||
| 679ad9b8c6 | |||
| d4983731e7 | |||
| 4fec3c8f34 | |||
| 836fd2565f | |||
| 54618064a1 | |||
| 519e3e01ae | |||
| aec8f81358 | |||
| c1d6bf4366 | |||
| 9bf2b79d9e | |||
| 4d98408995 | |||
| 7b466388f9 | |||
| b926fb3c66 | |||
| 6c8d5c0d0e | |||
| 5a1d234260 | |||
| fd6d42c297 | |||
| 7310ad6e92 | |||
| 7e47b1348d | |||
| 1e3555a6b7 | |||
| 9a67ce5968 | |||
| 279d7955f8 | |||
| db977c0bf5 | |||
| ba6bc59818 | |||
| 6e8be0578c | |||
| 92f7d16b5e | |||
| 40bb3c2f5e | |||
| 56a6096221 | |||
| ee37b42a91 | |||
| 0806e61df4 | |||
| 279ffeeefa | |||
| 80c5ee2479 | |||
| 16208544e5 | |||
| 6afeb24fdb | |||
| e6357b81eb | |||
| dfc2efe8a6 | |||
| f28b96f431 | |||
| a10293f8f7 | |||
| b1f02f91d7 | |||
| e76fa45d86 | |||
| 06f43892a5 | |||
| a094332b0d | |||
| 7b8779f534 | |||
| 371bf20d19 | |||
| 0f633ddd15 | |||
| 7886ca7f5f |
+105
@@ -0,0 +1,105 @@
|
|||||||
|
# Support for AppVeyor CI -- https://www.appveyor.com/
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
os: Visual Studio 2015
|
||||||
|
|
||||||
|
environment:
|
||||||
|
global: { TRAVIS_OS_NAME: windows, CROSS: "", C: "", B: release, T: "", X: "" }
|
||||||
|
matrix:
|
||||||
|
- { C: msvc-10.0-x86, CL_VERSION: 16.00, VS_VERSION: 2010 }
|
||||||
|
### - { C: msvc-10.0-x64, CL_VERSION: 16.00, VS_VERSION: 2010 } # AppVeyor: x64 compiler is not installed
|
||||||
|
- { C: msvc-11.0-x86, CL_VERSION: 17.00, VS_VERSION: 2012 }
|
||||||
|
### - { C: msvc-11.0-x64, CL_VERSION: 17.00, VS_VERSION: 2012 } # AppVeyor: x64 compiler is not installed
|
||||||
|
- { C: msvc-12.0-x86, CL_VERSION: 18.00, VS_VERSION: 2013 }
|
||||||
|
- { C: msvc-12.0-x64, CL_VERSION: 18.00, VS_VERSION: 2013 }
|
||||||
|
- { C: msvc-14.0-x86, CL_VERSION: 19.00, VS_VERSION: 2015 }
|
||||||
|
- { C: msvc-14.0-x64, CL_VERSION: 19.00, VS_VERSION: 2015 }
|
||||||
|
# - { C: gcc-4.9-m32, T: SKIP }
|
||||||
|
# - { C: gcc-4.9-m64, T: SKIP }
|
||||||
|
UPX_AUTOMATIC_BUILDS_SSL_KEY:
|
||||||
|
secure: PZMpVeqnEYe39kK+Zu2/fnmZ6/HG6Lvls0hh9GMVU9vCWsr8xaU7kIbHBS01puUkb4bEWPILKYvSEDuhOhguDjd/P4QdXWipvV/F2GaVax0=
|
||||||
|
UPX_AUTOMATIC_BUILDS_SSL_IV:
|
||||||
|
secure: ZshjJ/78dbY60mVJjZJv9Si7rHY9VQb1tfQvFd4lqvY=
|
||||||
|
|
||||||
|
init:
|
||||||
|
- git config --global core.autocrlf input
|
||||||
|
- where bash & where cat & where chmod & where cp & where curl & where date & where file & where git & where gzip & where mkdir & where mv & where openssl & where readlink & where rm & where rmdir & where sed & where sha256sum & where sort & where ssh & where ssh-add & where ssh-agent & where ssh-keyscan & where tar
|
||||||
|
# - bash --version & git --version & sed --version & tar --version
|
||||||
|
- git --version & bash --version
|
||||||
|
# - dir "c:\Program Files\Git\usr\bin"
|
||||||
|
# - dir "c:\cygwin\bin"
|
||||||
|
# - dir "c:\mingw\bin"
|
||||||
|
# - dir "c:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin"
|
||||||
|
|
||||||
|
install:
|
||||||
|
- cd c:\projects
|
||||||
|
- md build build\%C% deps
|
||||||
|
- cd c:\projects\upx
|
||||||
|
- git submodule update --init --recursive
|
||||||
|
- cd c:\projects\deps
|
||||||
|
- curl -q -L --retry 5 -o ucl-1.03.tar.gz "https://github.com/upx/upx/releases/download/v3.00/ucl-1.03.tar.gz"
|
||||||
|
- curl -q -L --retry 5 -o zlib-1.2.8.tar.gz "https://github.com/upx/upx/releases/download/v3.00/zlib-1.2.8.tar.gz"
|
||||||
|
- git clone https://github.com/upx/upx-testsuite
|
||||||
|
- tar -xzf ucl-1.03.tar.gz
|
||||||
|
- tar -xzf zlib-1.2.8.tar.gz
|
||||||
|
# patch UCL for msvc-14.0 (vsnprintf issue)
|
||||||
|
- sed -i '/# *define.*snprintf *_v*snprintf$/d' ucl-1.03/acc/acc_auto.h
|
||||||
|
##- curl -q -L --retry 5 -o config.guess "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"
|
||||||
|
##- curl -q -L --retry 5 -o config.sub "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"
|
||||||
|
##- cp config.guess config.sub ucl-1.03/acconfig/
|
||||||
|
# setup compiler
|
||||||
|
- if "%C%"=="msvc-10.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 )
|
||||||
|
- if "%C%"=="msvc-10.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 )
|
||||||
|
- if "%C%"=="msvc-11.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 )
|
||||||
|
- if "%C%"=="msvc-11.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64 )
|
||||||
|
- if "%C%"=="msvc-12.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 )
|
||||||
|
- if "%C%"=="msvc-12.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 )
|
||||||
|
- if "%C%"=="msvc-14.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 )
|
||||||
|
- if "%C%"=="msvc-14.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 )
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- cd c:\projects\upx
|
||||||
|
- if "%C%"=="gcc-4.9-m32" set PATH=c:\cygwin\bin;%PATH%
|
||||||
|
- if "%C%"=="gcc-4.9-m32" bash -x ./.github/travis_build.sh
|
||||||
|
- if "%C%"=="gcc-4.9-m32" exit
|
||||||
|
- if "%C%"=="gcc-4.9-m64" set PATH=c:\cygwin\bin;%PATH%
|
||||||
|
- if "%C%"=="gcc-4.9-m64" bash -x ./.github/travis_build.sh
|
||||||
|
- if "%C%"=="gcc-4.9-m64" exit
|
||||||
|
# setup directories following the VPATH build in travis_build.sh
|
||||||
|
- where cl & where link
|
||||||
|
- set BDIR=c:\projects\build\%C%\%B%
|
||||||
|
- md %BDIR% %BDIR%\ucl-1.03 %BDIR%\upx %BDIR%\upx-testsuite %BDIR%\zlib-1.2.8
|
||||||
|
- set DEFS=-D_CRT_SECURE_NO_WARNINGS
|
||||||
|
- git rev-parse --short=12 HEAD > %BDIR%\upx\.GITREV.txt
|
||||||
|
# build UCL
|
||||||
|
- cd %BDIR%\ucl-1.03
|
||||||
|
- set s=c:\projects\deps\ucl-1.03
|
||||||
|
- cl -MT -O2 -W4 %DEFS% -I%s%\include -I%s% -c %s%\src\*.c
|
||||||
|
- link -lib -out:ucl.lib *.obj
|
||||||
|
# build zlib
|
||||||
|
- cd %BDIR%\zlib-1.2.8
|
||||||
|
- cl -MT -O2 -W2 %DEFS% -c c:\projects\deps\zlib-1.2.8\*.c
|
||||||
|
- link -lib -out:zlib.lib *.obj
|
||||||
|
# build UPX
|
||||||
|
- cd %BDIR%\upx
|
||||||
|
- set s=c:\projects\upx\src
|
||||||
|
- cat .GITREV.txt
|
||||||
|
- set /p GITREV=<.GITREV.txt
|
||||||
|
- cl -MT -EHsc -J -O2 -W4 -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% -DWITH_LZMA=0x443 -DUCL_NO_ASM -I%s%\lzma-sdk -Ic:\projects\deps\ucl-1.03\include -Ic:\projects\deps\zlib-1.2.8 -Feupx.exe %s%\*.cpp %BDIR%\ucl-1.03\ucl.lib %BDIR%\zlib-1.2.8\zlib.lib
|
||||||
|
|
||||||
|
test_script:
|
||||||
|
- set UPX=--no-color --no-progress
|
||||||
|
- cd %BDIR%\upx
|
||||||
|
# basic tests
|
||||||
|
- .\upx.exe --version
|
||||||
|
- .\upx.exe upx.exe -o upx_packed.exe
|
||||||
|
- dir *.exe
|
||||||
|
- .\upx.exe -l upx_packed.exe
|
||||||
|
- .\upx.exe -t upx_packed.exe
|
||||||
|
- .\upx_packed.exe --version
|
||||||
|
# now run the UPX testsuite using bash
|
||||||
|
- cd c:\projects\upx
|
||||||
|
- bash ./.github/travis_testsuite_1.sh
|
||||||
|
- bash ./.github/travis_deploy.sh
|
||||||
|
|
||||||
|
# vim:set ts=2 sw=2 et:
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
# Support for Circle CI -- https://circleci.com/gh/upx/upx
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
machine:
|
||||||
|
environment:
|
||||||
|
TRAVIS_OS_NAME: linux
|
||||||
|
CROSS:
|
||||||
|
C: gcc-4.8-m64
|
||||||
|
B: release
|
||||||
|
T:
|
||||||
|
X:
|
||||||
|
|
||||||
|
checkout:
|
||||||
|
post:
|
||||||
|
- git submodule update --init --recursive
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
pre:
|
||||||
|
- mkdir -p ../deps
|
||||||
|
- cd ../deps && wget -q -O - https://github.com/upx/upx/releases/download/v3.00/ucl-1.03.tar.xz | tar -xJ
|
||||||
|
- cd ../deps && wget -q -O - https://github.com/upx/upx/releases/download/v3.00/zlib-1.2.8.tar.xz | tar -xJ
|
||||||
|
- cd ../deps && git clone https://github.com/upx/upx-testsuite
|
||||||
|
override:
|
||||||
|
- mkdir -p ../build/travis
|
||||||
|
- bash ./.github/travis_build.sh
|
||||||
|
|
||||||
|
test:
|
||||||
|
override:
|
||||||
|
- bash ./.github/travis_testsuite_1.sh
|
||||||
|
|
||||||
|
# vim:set ts=2 sw=2 et:
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# see http://editorconfig.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[{GNUmakefile*,MMakefile*,Makefile*,Makevars*,*.mk}]
|
||||||
|
indent_size = 8
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.S]
|
||||||
|
indent_size = 8
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_size = 2
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<!---
|
||||||
|
|
||||||
|
IF YOU REMOVE THIS TEMPLATE WE WILL CLOSE YOUR ISSUE WITHOUT RESPONSE.
|
||||||
|
Just read it and fill in the details we're asking, it saves so much of our time. Thanks!
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
## What's the problem (or question)?
|
||||||
|
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||||
|
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||||
|
|
||||||
|
## What should have happened?
|
||||||
|
<!--- If you're describing a bug, tell us what should happen -->
|
||||||
|
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
||||||
|
|
||||||
|
## Do you have an idea for a solution?
|
||||||
|
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||||
|
<!--- or ideas how to implement the addition or change -->
|
||||||
|
|
||||||
|
## How can we reproduce the issue?
|
||||||
|
<!--- Provide unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant -->
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
4.
|
||||||
|
|
||||||
|
## Please tell us details about your environment.
|
||||||
|
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||||
|
* UPX version used (`upx --version`):
|
||||||
|
* Operating System and version:
|
||||||
|
* CPU architecture:
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
|
||||||
|
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
else
|
||||||
|
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
fi
|
||||||
|
source "$argv0dir/travis_init.sh" || exit 1
|
||||||
|
|
||||||
|
# create dirs
|
||||||
|
cd / || exit 1
|
||||||
|
mkbuilddirs $upx_BUILDDIR $ucl_BUILDDIR $upx_testsuite_BUILDDIR $zlib_BUILDDIR
|
||||||
|
cd / && cd $upx_SRCDIR || exit 1
|
||||||
|
|
||||||
|
echo
|
||||||
|
print_settings
|
||||||
|
echo
|
||||||
|
echo "$CC --version"; $CC --version
|
||||||
|
echo "$CXX --version"; $CXX --version
|
||||||
|
echo
|
||||||
|
|
||||||
|
# check whitespace
|
||||||
|
if [[ $TRAVIS_OS_NAME == linux ]]; then
|
||||||
|
cd / && cd $upx_SRCDIR || exit 1
|
||||||
|
echo "Checking source code for whitespace violations..."
|
||||||
|
bash ./src/stub/scripts/check_whitespace.sh || exit 1
|
||||||
|
echo " Passed."
|
||||||
|
fi # linux
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
#
|
||||||
|
# rebuild UPX stubs (needs upx-stubtools)
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ $BM_X =~ (^|\+)rebuild-stubs($|\+) ]]; then
|
||||||
|
bin_upx=$(readlink -en -- "$upx_SRCDIR/../deps/bin-upx-20160918")
|
||||||
|
cd / && cd $upx_SRCDIR || exit 1
|
||||||
|
make -C src/stub maintainer-clean
|
||||||
|
failed=0
|
||||||
|
PATH="$bin_upx:$PATH" make -C src/stub all || failed=1
|
||||||
|
if [[ $failed != 0 ]]; then
|
||||||
|
echo "UPX-ERROR: FATAL: rebuild-stubs failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! git diff --quiet; then
|
||||||
|
git status || true
|
||||||
|
git diff || true
|
||||||
|
echo "UPX-ERROR: FATAL: rebuild-stubs git status mismatch. See log file."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ $BM_X == rebuild-stubs ]]; then
|
||||||
|
echo "X=rebuild-stubs done. Exiting."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
unset bin_upx failed
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# build UCL
|
||||||
|
#
|
||||||
|
|
||||||
|
cd / && cd $ucl_BUILDDIR || exit 1
|
||||||
|
if [[ -n $BM_CROSS || $TRAVIS_OS_NAME == windows ]]; then
|
||||||
|
# ucl-1.03/configure is too old - build manually
|
||||||
|
rm -f ./*.o libucl.a
|
||||||
|
$CC -O2 -I$ucl_SRCDIR/include -I$ucl_SRCDIR -c $ucl_SRCDIR/src/*.c
|
||||||
|
$AR rcs libucl.a *.o
|
||||||
|
mkdir -p src/.libs
|
||||||
|
cp libucl.a src/.libs
|
||||||
|
else
|
||||||
|
if [[ ! -f config.status ]]; then
|
||||||
|
$ucl_SRCDIR/configure --enable-static --disable-shared --disable-asm
|
||||||
|
fi
|
||||||
|
make
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# build zlib
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then
|
||||||
|
cd / && cd $zlib_BUILDDIR || exit 1
|
||||||
|
# build manually
|
||||||
|
rm -f ./*.o libz.a
|
||||||
|
$CC -O2 -c $zlib_SRCDIR/*.c
|
||||||
|
$AR rcs libz.a *.o
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# build UPX
|
||||||
|
#
|
||||||
|
|
||||||
|
export UPX_UCLDIR="$ucl_SRCDIR"
|
||||||
|
cd / && cd $upx_BUILDDIR || exit 1
|
||||||
|
make="make -f $upx_SRCDIR/src/Makefile"
|
||||||
|
EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -DUCL_NO_ASM"
|
||||||
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$ucl_BUILDDIR/src/.libs"
|
||||||
|
if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then
|
||||||
|
EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -I$zlib_SRCDIR"
|
||||||
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$zlib_BUILDDIR"
|
||||||
|
fi
|
||||||
|
if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then
|
||||||
|
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -fprofile-arcs -ftest-coverage"
|
||||||
|
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage"
|
||||||
|
fi
|
||||||
|
if [[ $BM_B =~ (^|\+)debug($|\+) ]]; then
|
||||||
|
make="$make BUILD_TYPE_DEBUG=1"
|
||||||
|
fi
|
||||||
|
if [[ $BM_B =~ (^|\+)sanitize($|\+) ]]; then
|
||||||
|
case $TRAVIS_OS_NAME-$CC in linux-gcc*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fuse-ld=gold" ;; esac
|
||||||
|
make="$make BUILD_TYPE_SANITIZE=1"
|
||||||
|
fi
|
||||||
|
if [[ $BM_B =~ (^|\+)scan-build($|\+) ]]; then
|
||||||
|
make="$SCAN_BUILD $make"
|
||||||
|
fi
|
||||||
|
if [[ $BM_B =~ (^|\+)valgrind($|\+) ]]; then
|
||||||
|
EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -DWITH_VALGRIND"
|
||||||
|
fi
|
||||||
|
if [[ $BM_B =~ (^|\+)ALLOW_FAIL($|\+) ]]; then
|
||||||
|
echo "ALLOW_FAIL"
|
||||||
|
set +e
|
||||||
|
fi
|
||||||
|
export EXTRA_CPPFLAGS EXTRA_CXXFLAGS EXTRA_LDFLAGS
|
||||||
|
|
||||||
|
[[ -z $upx_exeext ]] && upx_exeext=.out
|
||||||
|
$make exeext=$upx_exeext
|
||||||
|
|
||||||
|
pwd
|
||||||
|
ls -l upx${upx_exeext}
|
||||||
|
$SIZE upx${upx_exeext} || true
|
||||||
|
file upx${upx_exeext}
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
|
||||||
|
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
else
|
||||||
|
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
fi
|
||||||
|
source "$argv0dir/travis_init.sh" || exit 1
|
||||||
|
|
||||||
|
set -x # debug
|
||||||
|
|
||||||
|
if [[ $BM_X == rebuild-stubs ]]; then exit 0; fi
|
||||||
|
# save space
|
||||||
|
if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then exit 0; fi
|
||||||
|
if [[ $BM_B =~ (^|\+)debug($|\+) ]]; then exit 0; fi
|
||||||
|
if [[ $BM_B =~ (^|\+)sanitize($|\+) ]]; then exit 0; fi
|
||||||
|
if [[ $BM_B =~ (^|\+)scan-build($|\+) ]]; then exit 0; fi
|
||||||
|
if [[ $BM_B =~ (^|\+)valgrind($|\+) ]]; then exit 0; fi
|
||||||
|
|
||||||
|
# prepare $subdir and $branch
|
||||||
|
subdir=
|
||||||
|
branch=
|
||||||
|
if [[ -n $APPVEYOR_JOB_ID ]]; then
|
||||||
|
branch=$APPVEYOR_REPO_BRANCH
|
||||||
|
if [[ -n $APPVEYOR_PULL_REQUEST_NUMBER ]]; then exit 0; fi
|
||||||
|
elif [[ -n $GITLAB_CI ]]; then
|
||||||
|
subdir=$CI_BUILD_NAME
|
||||||
|
branch=$CI_BUILD_REF_NAME
|
||||||
|
else
|
||||||
|
branch=$TRAVIS_BRANCH
|
||||||
|
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi
|
||||||
|
fi
|
||||||
|
subdir=${subdir%%:*}; subdir=${subdir%%/*}; subdir=${subdir%%-*}
|
||||||
|
case $branch in
|
||||||
|
devel*) ;;
|
||||||
|
master*) ;;
|
||||||
|
travis*) ;;
|
||||||
|
*) exit 0;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# get $rev, $branch and $git_user
|
||||||
|
cd / && cd $upx_SRCDIR || exit 1
|
||||||
|
rev=$(git rev-parse --verify HEAD)
|
||||||
|
timestamp=$(git log -n1 --format='%at' HEAD)
|
||||||
|
date=$(TZ=UTC0 date -d "@$timestamp" '+%Y%m%d-%H%M%S')
|
||||||
|
#branch="$branch-$date-${rev:0:6}"
|
||||||
|
# make the branch name a little bit shorter so that it looks nice on GitHub
|
||||||
|
branch="$branch-${date:0:8}-${rev:0:7}"
|
||||||
|
if [[ -n $APPVEYOR_JOB_ID ]]; then
|
||||||
|
branch="$branch-appveyor"
|
||||||
|
git_user="AppVeyor CI"
|
||||||
|
elif [[ -n $GITLAB_CI ]]; then
|
||||||
|
branch="$branch-gitlab"
|
||||||
|
git_user="GitLab CI"
|
||||||
|
else
|
||||||
|
branch="$branch-travis"
|
||||||
|
git_user="Travis CI"
|
||||||
|
fi
|
||||||
|
unset timestamp date
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // prepare directory $d
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
cd / && cd $upx_BUILDDIR || exit 1
|
||||||
|
|
||||||
|
mkdir deploy || exit 1
|
||||||
|
chmod 700 deploy
|
||||||
|
cd deploy || exit 1
|
||||||
|
|
||||||
|
if [[ -n $BM_CROSS ]]; then
|
||||||
|
d=$BM_CROSS
|
||||||
|
else
|
||||||
|
cpu=unknown
|
||||||
|
case $BM_C in
|
||||||
|
clang*-m32 | gcc*-m32) cpu=i386;;
|
||||||
|
clang*-m64 | gcc*-m64) cpu=amd64;;
|
||||||
|
clang*-mx32 | gcc*-mx32) cpu=amd64;;
|
||||||
|
msvc*-x86) cpu=i386;;
|
||||||
|
msvc*-x64) cpu=amd64;;
|
||||||
|
esac
|
||||||
|
os=$TRAVIS_OS_NAME
|
||||||
|
if [[ $os == osx ]]; then
|
||||||
|
os=darwin
|
||||||
|
elif [[ $os == windows ]]; then
|
||||||
|
[[ $cpu == i386 ]] && os=win32
|
||||||
|
[[ $cpu == amd64 ]] && os=win64
|
||||||
|
fi
|
||||||
|
d=$cpu-$os
|
||||||
|
fi
|
||||||
|
d=$d-$BM_C-$BM_B
|
||||||
|
|
||||||
|
mkdir $d || exit 1
|
||||||
|
for exeext in .exe .out; do
|
||||||
|
f=$upx_BUILDDIR/upx$exeext
|
||||||
|
if [[ -f $f ]]; then
|
||||||
|
cp -p -i $f $d/upx-git-${rev:0:12}$exeext
|
||||||
|
sha256sum -b $d/upx-git-${rev:0:12}$exeext
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // clone, add files & push
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
new_branch=0
|
||||||
|
if ! git clone -b $branch --single-branch https://github.com/upx/upx-automatic-builds.git; then
|
||||||
|
git clone -b master --single-branch https://github.com/upx/upx-automatic-builds.git
|
||||||
|
new_branch=1
|
||||||
|
fi
|
||||||
|
cd upx-automatic-builds || exit 1
|
||||||
|
chmod 700 .git
|
||||||
|
git config user.name "$git_user"
|
||||||
|
git config user.email "none@none"
|
||||||
|
if [[ $new_branch == 1 ]]; then
|
||||||
|
git checkout --orphan $branch
|
||||||
|
git reset --hard
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $subdir ]]; then
|
||||||
|
[[ -d $subdir ]] || mkdir $subdir
|
||||||
|
mv ../$d $subdir/
|
||||||
|
git add $subdir/$d
|
||||||
|
else
|
||||||
|
mv ../$d .
|
||||||
|
git add $d
|
||||||
|
fi
|
||||||
|
|
||||||
|
if git diff --cached --exit-code --quiet >/dev/null; then
|
||||||
|
# nothing to do ???
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
now=$(date '+%s')
|
||||||
|
##date=$(TZ=UTC0 date -d "@$now" '+%Y-%m-%d %H:%M:%S')
|
||||||
|
git commit --date="$now" -m "Automatic build $d"
|
||||||
|
git ls-files
|
||||||
|
#git log --pretty=fuller
|
||||||
|
|
||||||
|
umask 077
|
||||||
|
[[ -d ~/.ssh ]] || mkdir ~/.ssh
|
||||||
|
repo=$(git config remote.origin.url)
|
||||||
|
ssh_repo=${repo/https:\/\/github.com\//git@github.com:}
|
||||||
|
eval $(ssh-agent -s)
|
||||||
|
set +x # IMPORTANT
|
||||||
|
openssl aes-256-cbc -d -a -K "$UPX_AUTOMATIC_BUILDS_SSL_KEY" -iv "$UPX_AUTOMATIC_BUILDS_SSL_IV" -in "$upx_SRCDIR/.github/upx-automatic-builds@github.com.enc" -out .git/deploy.key
|
||||||
|
set -x
|
||||||
|
chmod 600 .git/deploy.key
|
||||||
|
ssh-add .git/deploy.key
|
||||||
|
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
let i=0 || true
|
||||||
|
while true; do
|
||||||
|
if [[ $i -ge 10 ]]; then
|
||||||
|
echo "ERROR: git push failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ $new_branch == 1 ]]; then
|
||||||
|
if git push -u $ssh_repo $branch; then break; fi
|
||||||
|
else
|
||||||
|
if git push $ssh_repo $branch; then break; fi
|
||||||
|
fi
|
||||||
|
git fetch -v origin $branch
|
||||||
|
git rebase origin/$branch
|
||||||
|
sleep $((RANDOM % 5 + 1))
|
||||||
|
let i+=1
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
|
||||||
|
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
#set -x # debug
|
||||||
|
umask 022
|
||||||
|
export GIT_PAGER=
|
||||||
|
|
||||||
|
# rename short variables to more readable Build-Matrix BM_ names
|
||||||
|
# C is COMPILER
|
||||||
|
# B is BUILD_OPTIONS
|
||||||
|
# T is TESTSUITE_OPTIONS
|
||||||
|
# X is EXTRA_OPTIONS
|
||||||
|
BM_CROSS=$CROSS; BM_C=$C; BM_B=$B; BM_T=$T; BM_X=$X
|
||||||
|
unset CROSS C B T X
|
||||||
|
[[ -z $BM_C ]] && BM_C=gcc
|
||||||
|
[[ -z $BM_B ]] && BM_B=release
|
||||||
|
|
||||||
|
# just in case, unset variable for passing extra UPX options
|
||||||
|
export UPX=
|
||||||
|
# un-export some vars
|
||||||
|
declare +x UPX_AUTOMATIC_BUILDS_SSL_KEY UPX_AUTOMATIC_BUILDS_SSL_IV
|
||||||
|
|
||||||
|
# compatibility wrappers
|
||||||
|
if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
# use GNU coreutils ("brew install coreutils")
|
||||||
|
date() {
|
||||||
|
gdate "$@"
|
||||||
|
}
|
||||||
|
readlink() {
|
||||||
|
greadlink "$@"
|
||||||
|
}
|
||||||
|
sha256sum() {
|
||||||
|
gsha256sum "$@"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
if [[ -n $APPVEYOR_JOB_ID ]]; then
|
||||||
|
openssl() {
|
||||||
|
/usr/bin/openssl "$@"
|
||||||
|
}
|
||||||
|
sort() {
|
||||||
|
/usr/bin/sort "$@"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set CC and CXX from BM_C and BM_CROSS
|
||||||
|
if [[ -z $CC_OVERRIDE ]]; then
|
||||||
|
CC=false CXX=false SCAN_BUILD=false
|
||||||
|
AR=ar SIZE=size
|
||||||
|
if [[ -n $APPVEYOR_JOB_ID ]]; then
|
||||||
|
BUILD_LOCAL_ZLIB=1
|
||||||
|
if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then
|
||||||
|
export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++"
|
||||||
|
fi
|
||||||
|
upx_exeext=.exe
|
||||||
|
# dir c:\cygwin
|
||||||
|
case $BM_C in
|
||||||
|
gcc-m32 | gcc-4.9-m32)
|
||||||
|
x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;;
|
||||||
|
gcc-m64 | gcc-4.9-m64)
|
||||||
|
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
|
||||||
|
msvc | msvc-*)
|
||||||
|
AR="link -lib"; CC="cl"; CXX="cl" ;; # standard system compiler
|
||||||
|
esac
|
||||||
|
fi # APPVEYOR_JOB_ID
|
||||||
|
if [[ -n $BM_CROSS ]]; then
|
||||||
|
BUILD_LOCAL_ZLIB=1
|
||||||
|
if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then
|
||||||
|
export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++"
|
||||||
|
fi
|
||||||
|
cat /etc/os-release || true
|
||||||
|
if egrep -q '^PRETTY_NAME="?Ubuntu .*12\.04' /etc/os-release; then
|
||||||
|
case $BM_CROSS-$BM_C in
|
||||||
|
arm-linux-gnueabi-gcc | arm-linux-gnueabi-gcc-4.6)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabi"
|
||||||
|
x=arm-linux-gnueabi; AR="$x-ar"; CC="$x-gcc"; CXX="$x-g++" ;;
|
||||||
|
arm-linux-gnueabihf-gcc | arm-linux-gnueabihf-gcc-4.6)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabihf"
|
||||||
|
x=arm-linux-gnueabihf; AR="$x-ar"; CC="$x-gcc"; CXX="$x-g++" ;;
|
||||||
|
i[36]86-w64-mingw32-gcc | i[36]86-w64-mingw32-gcc-4.6)
|
||||||
|
upx_exeext=.exe
|
||||||
|
[[ -z $upx_wine ]] && upx_wine="wine"
|
||||||
|
x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;;
|
||||||
|
x86_64-w64-mingw32-gcc | x86_64-w64-mingw32-gcc-4.6)
|
||||||
|
upx_exeext=.exe
|
||||||
|
[[ -z $upx_wine ]] && upx_wine="wine"
|
||||||
|
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
|
||||||
|
esac
|
||||||
|
elif egrep -q '^PRETTY_NAME="?Ubuntu 16\.04' /etc/os-release; then
|
||||||
|
case $BM_CROSS-$BM_C in
|
||||||
|
aarch64-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-aarch64 -L /usr/aarch64-linux-gnu"
|
||||||
|
x=aarch64-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
arm-linux-gnueabi-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabi"
|
||||||
|
x=arm-linux-gnueabi; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
arm-linux-gnueabihf-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabihf"
|
||||||
|
x=arm-linux-gnueabihf; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
i[36]86-w64-mingw32-gcc-5)
|
||||||
|
upx_exeext=.exe
|
||||||
|
[[ -z $upx_wine ]] && upx_wine="wine"
|
||||||
|
x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;;
|
||||||
|
mips-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-mips -L /usr/mips-linux-gnu"
|
||||||
|
x=mips-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
mipsel-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-mipsel -L /usr/mipsel-linux-gnu"
|
||||||
|
x=mipsel-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
powerpc-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-ppc -L /usr/powerpc-linux-gnu"
|
||||||
|
x=powerpc-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
powerpc64-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-ppc64 -L /usr/powerpc64-linux-gnu"
|
||||||
|
x=powerpc64-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
powerpc64le-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-ppc64le -L /usr/powerpc64le-linux-gnu"
|
||||||
|
x=powerpc64le-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
s390x-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-s390x -L /usr/s390x-linux-gnu"
|
||||||
|
x=s390x-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
x86_64-w64-mingw32-gcc-5)
|
||||||
|
upx_exeext=.exe
|
||||||
|
[[ -z $upx_wine ]] && upx_wine="wine"
|
||||||
|
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi # BM_CROSS
|
||||||
|
if [[ "$CC" == "false" ]]; then # generic
|
||||||
|
if [[ -z $BM_CROSS ]]; then
|
||||||
|
case $BM_C in
|
||||||
|
clang | clang-m?? | clang-3.4-m?? | clang-[678][0-9][0-9]-m??)
|
||||||
|
CC="clang"; CXX="clang++" ;; # standard system compiler
|
||||||
|
clang-[3].[0-9]-m??)
|
||||||
|
v=${BM_C:6:3}; CC="clang-$v"; CXX="clang++-$v"; SCAN_BUILD="scan-build-$v" ;;
|
||||||
|
gcc | gcc-m?? | gcc-mx32)
|
||||||
|
CC="gcc"; CXX="g++" ;; # standard system compiler
|
||||||
|
gcc-[34].[0-9]-m?? | gcc-[34].[0-9]-mx32)
|
||||||
|
v=${BM_C:4:3}; CC="gcc-$v"; CXX="g++-$v" ;;
|
||||||
|
gcc-[56]-m?? | gcc-[56]-mx32)
|
||||||
|
v=${BM_C:4:1}; CC="gcc-$v"; CXX="g++-$v" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi # generic
|
||||||
|
case $BM_C in
|
||||||
|
clang*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;;
|
||||||
|
clang*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;;
|
||||||
|
gcc*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;;
|
||||||
|
gcc*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;;
|
||||||
|
gcc*-mx32) CC="$CC -mx32"; CXX="$CXX -mx32" ;;
|
||||||
|
esac
|
||||||
|
if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then
|
||||||
|
CC="$CC -std=gnu89"
|
||||||
|
fi
|
||||||
|
unset v x
|
||||||
|
export AR CC CXX
|
||||||
|
fi # CC_OVERRIDE
|
||||||
|
|
||||||
|
# source dirs
|
||||||
|
[[ -z $upx_SRCDIR ]] && upx_SRCDIR=$(readlink -mn -- $argv0dir/..)
|
||||||
|
[[ -z $ucl_SRCDIR ]] && ucl_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/ucl-1.03)
|
||||||
|
[[ -z $upx_testsuite_SRCDIR ]] && upx_testsuite_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/upx-testsuite)
|
||||||
|
[[ -z $zlib_SRCDIR ]] && zlib_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/zlib-1.2.8)
|
||||||
|
|
||||||
|
# build dirs
|
||||||
|
mkbuilddirs() {
|
||||||
|
local d
|
||||||
|
for d in "$@"; do
|
||||||
|
mkdir -p -v "$d" || exit 1
|
||||||
|
[[ -f "$d/.mfxnobackup" ]] || touch "$d/.mfxnobackup"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
# search for an existing $toptop_builddir
|
||||||
|
if [[ -z $toptop_builddir ]]; then
|
||||||
|
for d in . ..; do
|
||||||
|
for subdir in "local" appveyor circle gitlab travis .; do
|
||||||
|
dd=$d/build/$subdir
|
||||||
|
if [[ -d $dd ]]; then
|
||||||
|
toptop_builddir=$(readlink -en -- "$dd")
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
unset d subdir dd
|
||||||
|
fi
|
||||||
|
[[ -z $toptop_builddir ]] && toptop_builddir=$(readlink -mn -- ./build)
|
||||||
|
[[ -z $toptop_bdir ]] && toptop_bdir=$(readlink -mn -- "$toptop_builddir/${BM_CROSS:+$BM_CROSS-}$BM_C/$BM_B")
|
||||||
|
[[ -z $upx_BUILDDIR ]] && upx_BUILDDIR=$(readlink -mn -- "$toptop_bdir/upx")
|
||||||
|
[[ -z $ucl_BUILDDIR ]] && ucl_BUILDDIR=$(readlink -mn -- "$toptop_bdir/ucl-1.03")
|
||||||
|
[[ -z $upx_testsuite_BUILDDIR ]] && upx_testsuite_BUILDDIR=$(readlink -mn -- "$toptop_bdir/upx-testsuite")
|
||||||
|
[[ -z $zlib_BUILDDIR ]] && zlib_BUILDDIR=$(readlink -mn -- "$toptop_bdir/zlib-1.2.8")
|
||||||
|
[[ -z $lcov_OUTPUTDIR ]] && lcov_OUTPUTDIR=$(readlink -mn -- "$toptop_bdir/.lcov-results")
|
||||||
|
unset toptop_builddir toptop_bdir
|
||||||
|
|
||||||
|
# ensure absolute directories
|
||||||
|
make_absolute() {
|
||||||
|
local d
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
if [[ -n ${!1} ]]; then
|
||||||
|
d=$(readlink -mn -- "${!1}")
|
||||||
|
eval $1="$d"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
for var_prefix in ucl upx upx_testsuite zlib; do
|
||||||
|
for var_suffix in _BUILDDIR _SRCDIR; do
|
||||||
|
make_absolute ${var_prefix}${var_suffix}
|
||||||
|
done
|
||||||
|
done
|
||||||
|
make_absolute lcov_OUTPUTDIR
|
||||||
|
unset var_prefix var_suffix
|
||||||
|
|
||||||
|
print_settings() {
|
||||||
|
local v var_prefix var_suffix
|
||||||
|
# Build Matrix
|
||||||
|
for v in TRAVIS_OS_NAME BM_CROSS BM_C BM_B BM_T; do
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
done
|
||||||
|
# BM_C related
|
||||||
|
for v in AR CC CXX CPPFLAGS CFLAGS CXXFLAGS LDFLAGS LIBS SCAN_BUILD; do
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
v=EXTRA_${v}
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
done
|
||||||
|
# directories and other info
|
||||||
|
for v in TRAVIS_XCODE_SDK UPX_UCLDIR lcov_OUTPUTDIR; do
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
done
|
||||||
|
for var_prefix in ucl upx upx_testsuite zlib; do
|
||||||
|
for var_suffix in _BUILDDIR _SRCDIR; do
|
||||||
|
v=${var_prefix}${var_suffix}
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
##env | LC_ALL=C sort
|
||||||
|
}
|
||||||
|
|
||||||
|
true
|
||||||
@@ -0,0 +1,381 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
|
||||||
|
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
#
|
||||||
|
# very first version of the upx-testsuite
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
else
|
||||||
|
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
fi
|
||||||
|
source "$argv0dir/travis_init.sh" || exit 1
|
||||||
|
|
||||||
|
if [[ $BM_T =~ (^|\+)SKIP($|\+) ]]; then
|
||||||
|
echo "UPX testsuite SKIPPED."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [[ $BM_X == rebuild-stubs ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
[[ -f $upx_exe ]] && upx_exe=$(readlink -en -- "$upx_exe")
|
||||||
|
|
||||||
|
# create dirs
|
||||||
|
cd / || exit 1
|
||||||
|
mkbuilddirs $upx_testsuite_BUILDDIR
|
||||||
|
cd / && cd $upx_testsuite_BUILDDIR || exit 1
|
||||||
|
if [[ ! -d $upx_testsuite_SRCDIR/files/packed ]]; then exit 1; fi
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // support functions
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
testsuite_header() {
|
||||||
|
local x="==========="; x="$x$x$x$x$x$x$x"
|
||||||
|
echo -e "\n${x}\n${1}\n${x}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
testsuite_split_f() {
|
||||||
|
fd=$(dirname "$1")
|
||||||
|
fb=$(basename "$1")
|
||||||
|
fsubdir=$(basename "$fd")
|
||||||
|
# sanity checks
|
||||||
|
if [[ ! -f $f || -z $fsubdir || -z $fb ]]; then
|
||||||
|
fd= fb= fsubdir=
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testsuite_check_sha() {
|
||||||
|
(cd "$1" && sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current
|
||||||
|
echo
|
||||||
|
cat $1/.sha256sums.current
|
||||||
|
if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then
|
||||||
|
echo "UPX-ERROR: $1 FAILED: checksum mismatch"
|
||||||
|
diff -u $1/.sha256sums.expected $1/.sha256sums.current || true
|
||||||
|
exit_code=1
|
||||||
|
let num_errors+=1 || true
|
||||||
|
all_errors="${all_errors} $1"
|
||||||
|
#exit 1
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
testsuite_check_sha_decompressed() {
|
||||||
|
(cd "$1" && sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current
|
||||||
|
if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then
|
||||||
|
cat $1/.sha256sums.current
|
||||||
|
echo "UPX-ERROR: FATAL: $1 FAILED: decompressed checksum mismatch"
|
||||||
|
diff -u $1/.sha256sums.expected $1/.sha256sums.current || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testsuite_use_canonicalized=1
|
||||||
|
testsuite_run_compress() {
|
||||||
|
testsuite_header $testdir
|
||||||
|
local files f
|
||||||
|
if [[ $testsuite_use_canonicalized == 1 ]]; then
|
||||||
|
files=t020_canonicalized/*/*
|
||||||
|
else
|
||||||
|
files=t010_decompressed/*/*
|
||||||
|
fi
|
||||||
|
for f in $files; do
|
||||||
|
testsuite_split_f $f
|
||||||
|
[[ -z $fb ]] && continue
|
||||||
|
echo "# $f"
|
||||||
|
mkdir -p $testdir/$fsubdir $testdir/.decompressed/$fsubdir
|
||||||
|
$upx_run -qq --prefer-ucl "$@" $f -o $testdir/$fsubdir/$fb
|
||||||
|
$upx_run -qq -d $testdir/$fsubdir/$fb -o $testdir/.decompressed/$fsubdir/$fb
|
||||||
|
done
|
||||||
|
testsuite_check_sha $testdir
|
||||||
|
$upx_run -qq -l $testdir/*/*
|
||||||
|
$upx_run -qq --file-info $testdir/*/*
|
||||||
|
$upx_run -q -t $testdir/*/*
|
||||||
|
if [[ $testsuite_use_canonicalized == 1 ]]; then
|
||||||
|
# check that after decompression the file matches the canonicalized version
|
||||||
|
cp t020_canonicalized/.sha256sums.expected $testdir/.decompressed/
|
||||||
|
testsuite_check_sha_decompressed $testdir/.decompressed
|
||||||
|
rm -rf "./$testdir/.decompressed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // expected checksums
|
||||||
|
# //
|
||||||
|
# // To ease maintenance of this script in case of updates this section
|
||||||
|
# // can be automatically re-created from the current checksums -
|
||||||
|
# // see call of function recreate_expected_sha256sums below.
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
recreate_expected_sha256sums() {
|
||||||
|
local o="$1"
|
||||||
|
local files f d
|
||||||
|
echo "########## begin .sha256sums.recreate" > "$o"
|
||||||
|
files=*/.sha256sums.current
|
||||||
|
for f in $files; do
|
||||||
|
d=$(dirname "$f")
|
||||||
|
echo "expected_sha256sums__${d}="'"\' >> "$o"
|
||||||
|
cat "$f" >> "$o"
|
||||||
|
echo '"' >> "$o"
|
||||||
|
done
|
||||||
|
echo "########## end .sha256sums.recreate" >> "$o"
|
||||||
|
}
|
||||||
|
|
||||||
|
########## begin .sha256sums.recreate
|
||||||
|
expected_sha256sums__t010_decompressed="\
|
||||||
|
24158f78c34c4ef94bb7773a6dda7231d289be76c2f5f60e8b9ddb3f800c100e *amd64-linux.elf/upx-3.91
|
||||||
|
28d7ca8f0dfca8159e637eaf2057230b6e6719e07751aca1d19a45b5efed817c *arm-wince.pe/upx-3.91.exe
|
||||||
|
b1c1c38d50007616aaf8e942839648c80a6111023e0b411e5fa7a06c543aeb4a *armeb-linux.elf/upx-3.91
|
||||||
|
bcac77a287289301a45fde9a75e4e6c9ad7f8d57856bae6eafaae12ae4445a34 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
730a513b72a094697f827e4ac1a4f8ef58a614fc7a7ad448fa58d60cd89af7ed *i386-linux.elf/upx-3.91
|
||||||
|
0dbc3c267ca8cd35ee3ea138b59c8b1ae35872c918be6d17df1a892b75710f9b *i386-win32.pe/upx-3.91.exe
|
||||||
|
8e5333ea040f5594d3e67d5b09e005d52b3a52ef55099a7c11d7e39ead38e66d *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
c3f44b4d00a87384c03a6f9e7aec809c1addfe3e271244d38a474f296603088c *mipsel-linux.elf/upx-3.91
|
||||||
|
b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.elf/upx-3.91
|
||||||
|
"
|
||||||
|
expected_sha256sums__t020_canonicalized="\
|
||||||
|
24158f78c34c4ef94bb7773a6dda7231d289be76c2f5f60e8b9ddb3f800c100e *amd64-linux.elf/upx-3.91
|
||||||
|
28d7ca8f0dfca8159e637eaf2057230b6e6719e07751aca1d19a45b5efed817c *arm-wince.pe/upx-3.91.exe
|
||||||
|
b1c1c38d50007616aaf8e942839648c80a6111023e0b411e5fa7a06c543aeb4a *armeb-linux.elf/upx-3.91
|
||||||
|
bcac77a287289301a45fde9a75e4e6c9ad7f8d57856bae6eafaae12ae4445a34 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
730a513b72a094697f827e4ac1a4f8ef58a614fc7a7ad448fa58d60cd89af7ed *i386-linux.elf/upx-3.91
|
||||||
|
0dbc3c267ca8cd35ee3ea138b59c8b1ae35872c918be6d17df1a892b75710f9b *i386-win32.pe/upx-3.91.exe
|
||||||
|
8e5333ea040f5594d3e67d5b09e005d52b3a52ef55099a7c11d7e39ead38e66d *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
c3f44b4d00a87384c03a6f9e7aec809c1addfe3e271244d38a474f296603088c *mipsel-linux.elf/upx-3.91
|
||||||
|
b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.elf/upx-3.91
|
||||||
|
"
|
||||||
|
expected_sha256sums__t110_compress_ucl_nrv2b_3_no_filter="\
|
||||||
|
52d0189f9ed16162332fbe359d723753ca1b7d7374a249d6b16144e363073384 *amd64-linux.elf/upx-3.91
|
||||||
|
0af0b3df9ca5b34ebc8ed06b3bf46807e585032961f053abfeefcb60bd63907e *arm-wince.pe/upx-3.91.exe
|
||||||
|
851ea686cc1d6ef7c63978829f0bfe40c761d00e9f07c3d4f9ce59201da4409c *armeb-linux.elf/upx-3.91
|
||||||
|
3345fda466927211ed3291ea1255fa09937fcfad974ffb1120deeefe6f655a9e *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
8631629945812b6766da0187390b4d26e830f39a79d80aacda196e678a4be10c *i386-linux.elf/upx-3.91
|
||||||
|
06794bdb9a8085ca5ef577648bf39402868a507f2a0bd02285c807929499aba4 *i386-win32.pe/upx-3.91.exe
|
||||||
|
6c9e164baa12c45ca8d55788b34e8fabdddb52374200444d42ff48c1d84103eb *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
1f3ae2bde7c72e60d3c12fccf572c5aa5dbee566d1d28029e62a8b921c6d77bd *mipsel-linux.elf/upx-3.91
|
||||||
|
181345ff1dd1c35944ec79d1197ee223913617cdd148a576cd3b9b776b8e86c2 *powerpc-linux.elf/upx-3.91
|
||||||
|
"
|
||||||
|
expected_sha256sums__t120_compress_ucl_nrv2d_3_no_filter="\
|
||||||
|
d90f1e94fb8a1d5c123e1c13b30db148870c36ff6f00fc5677bd9f05bae1fc02 *amd64-linux.elf/upx-3.91
|
||||||
|
e09a089e642f33502a35ab9a416142d3db4dbb67930366054e25c390678c3f7c *arm-wince.pe/upx-3.91.exe
|
||||||
|
b794cc520ab507887324fe04e1c36e1ed0b63ecdb29241213a3a3cf980e16cc2 *armeb-linux.elf/upx-3.91
|
||||||
|
ea5df377a14457fc4a4791e67859f77f8fe8b94ed81fd13666618fc690d70987 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
5f0876049576446707270baa651eaa724891cccbee268e18450812d5be5e9990 *i386-linux.elf/upx-3.91
|
||||||
|
4a65a19b430d50b9f15786342e3de86feb3627af07743b50a9ebfedb10c59a08 *i386-win32.pe/upx-3.91.exe
|
||||||
|
d7514121a811a36112cb2f3e42c3284e03a7807e972778229c62c075656d796f *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
0effcd336be6dcb092e37bafc9611c99c1d19c1c53a8ca6a26834d9f5f9eb56c *mipsel-linux.elf/upx-3.91
|
||||||
|
dfe218814633aa9ed47477bf021ac0bae0b491ebf9d4ff44194f3d7195e5a200 *powerpc-linux.elf/upx-3.91
|
||||||
|
"
|
||||||
|
expected_sha256sums__t130_compress_ucl_nrv2e_3_no_filter="\
|
||||||
|
00b67a1cc766b13a6167e0f672cf46b62f0879b6318ed9f548f670b011b3f185 *amd64-linux.elf/upx-3.91
|
||||||
|
a377c263a3d981af1ec278a418fcdd09298d76cece0e7c7c9af63f20ccba769d *arm-wince.pe/upx-3.91.exe
|
||||||
|
dbf2fa9b4fa5319c52b25d34aa6f57577b2a63e7241b6d4600915de0f3400190 *armeb-linux.elf/upx-3.91
|
||||||
|
4d925cff00b8959324c0838284f4619831b8080136cef05131906149fdec5bbc *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
b114b257ff5de11b75eb4489d2cb2bd3be6cf9cf141e36f02b0ab781d0f9a3ff *i386-linux.elf/upx-3.91
|
||||||
|
ce874eafe18c0f09928992a3aa1f5fe9f0be9d89b87b39ecbcf1c460e4b8e0f7 *i386-win32.pe/upx-3.91.exe
|
||||||
|
c60b3faccc59ff37c2e1e3c908d4fe01a2532e7ac1abd4c4ec4ecee974a0e8bd *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
2b74a6a831c7f9f4df22c65f8a5748a2b6cf6fd68232b0d250737938de27efc6 *mipsel-linux.elf/upx-3.91
|
||||||
|
47ddad5acc39e21d66e471c8af8d9b52e8dd8d7ad89631f771c2ea4d218f441e *powerpc-linux.elf/upx-3.91
|
||||||
|
"
|
||||||
|
expected_sha256sums__t140_compress_lzma_2_no_filter="\
|
||||||
|
f67ce2b6d4d36367a249faeb802df51dbc56019754c0f4606b5a6f97b72a54d1 *amd64-linux.elf/upx-3.91
|
||||||
|
57be6aa4f1e5ee6ef6f5eb8694b22eb07c3ea5cc9b9ebfde75db4c9a04a71a5a *arm-wince.pe/upx-3.91.exe
|
||||||
|
ef18c1ae56a037d15f0494f4b835c1336a43745edba87c783f62745488008783 *armeb-linux.elf/upx-3.91
|
||||||
|
54a6158bc6bd8cc28d3abc53cc5cf9b63c3c63ae884e96fb6d6ea974c7426206 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
801d1761289f94d7f51effb88e100832d14ae96398844084b9d10852886c4731 *i386-linux.elf/upx-3.91
|
||||||
|
f828953a66d7b3394dd2514b5972680a0cc651bd198b7607f6d3f6f6cc390a0e *i386-win32.pe/upx-3.91.exe
|
||||||
|
587b5f1f529da60f5820b8f811743aaad59e3fa9407930de1ab433863f7262a4 *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
84c811f5d27bac393610bfad4180258494c43d691c13eb57394ab95d4736e621 *mipsel-linux.elf/upx-3.91
|
||||||
|
ed83830ab5e1753a742cf4981401fd8d5bdaabcfdeb385a2e8087aeb46f93512 *powerpc-linux.elf/upx-3.91
|
||||||
|
"
|
||||||
|
expected_sha256sums__t150_compress_ucl_2_all_filters="\
|
||||||
|
2849771c8799d7a446b54ad9914d679e315a9f0d9440f9728c6d5ab6541ed494 *amd64-linux.elf/upx-3.91
|
||||||
|
7ccbe7d7822cd9fed9b3c902c2bcb80f85df4f5bbb4e9e850257435ffa375a38 *arm-wince.pe/upx-3.91.exe
|
||||||
|
c6849deffc7bb1976c18a4815bca0b8fd0b6d19e4136965108daa6382efae2d5 *armeb-linux.elf/upx-3.91
|
||||||
|
c04818c54d68c99f345ee7995634dffbe7f1c2f2db8f2b510bba461d9125f5a9 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
a3758350a0454fb78060b6d6e48d8f000e17a628b6041e8c82e3990e0b3aabe9 *i386-linux.elf/upx-3.91
|
||||||
|
b4f27ba234a5c9b4f68e2067602a180c02f95fb044830f54a45267fe1c50bb83 *i386-win32.pe/upx-3.91.exe
|
||||||
|
dd9fb59d57a7157af1a44559f6ebd8a293b0988c66b4d0951c949f88f814bf8f *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
c0bc81487114b9d158ffe1dbd4081b9e3636695c63f11b3e204033b56fc69706 *mipsel-linux.elf/upx-3.91
|
||||||
|
0a700713f0c7ff19a534963f5ab95a63d2f185f82d0c42ce8c1a485aba4c1147 *powerpc-linux.elf/upx-3.91
|
||||||
|
"
|
||||||
|
expected_sha256sums__t160_compress_all_methods_1_no_filter="\
|
||||||
|
831b0dd82d2c8fb058e8300bda5dd51657a709e76c45e0c372d9cf83c2e06f31 *amd64-linux.elf/upx-3.91
|
||||||
|
057b08389af5a31a0bf4baf03d09eb07f4698f8ddec615ae35795cec62132966 *arm-wince.pe/upx-3.91.exe
|
||||||
|
49b6b8d4f04d9078686372a315e7768fc882ad66bebb67225fa0b2255b5dd1c9 *armeb-linux.elf/upx-3.91
|
||||||
|
aef085cb86ef29d7aa380a3daea403f53659af1615ceeaa76e609dc793f50cfd *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
52087d4a2c17445b0e8d5238ec3abd2ca5cd909513cff76bf42232f33d93903f *i386-linux.elf/upx-3.91
|
||||||
|
e669d7c4fec901130dd387dc8f95e3b3f5e739d6ef0bfac10080dbd257084ae6 *i386-win32.pe/upx-3.91.exe
|
||||||
|
40cd5a94039a1703986a68dd404290aa7c27fd8c184fa4c651467b8c2d621a5d *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
b1db1d04e350972aa06216ec43d12a451abf5c928c885b0c442f9436c804e84e *mipsel-linux.elf/upx-3.91
|
||||||
|
65602c3e1e3e152d44d9f803281d4021bfd91aab825b72d8901faf4d7d9b593e *powerpc-linux.elf/upx-3.91
|
||||||
|
"
|
||||||
|
expected_sha256sums__t170_compress_all_methods_no_lzma_5_no_filter="\
|
||||||
|
bce397f12372437802d887d203bb2f8e4755dbe1a0e3c6bb9fa9cccd3306eef7 *amd64-linux.elf/upx-3.91
|
||||||
|
84b1fe14dbff7d4e2f1bcfee9b6e3c73f68eb5b95b37cbf2c655340bd959bfa3 *arm-wince.pe/upx-3.91.exe
|
||||||
|
1b6ac9c0893b3093d47e403a14a5d346ae3a0f135ecdbe3bb04fc0542abd469b *armeb-linux.elf/upx-3.91
|
||||||
|
d27237cd4b55c80d2b6c7da8d70ffc4f390290fcc550eec06c795e92d934b72a *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
2032623990d22b2cf8df5f2c0b581de5fd53869869b65818ea023a6857c4eff0 *i386-linux.elf/upx-3.91
|
||||||
|
51e91ff8226517ad8cd06d240e2c6c2f3d3e4033af1e593a5b294356d1bb5d33 *i386-win32.pe/upx-3.91.exe
|
||||||
|
b371684bbb2693797dd1164159de3bff9618bf6b99536542f57da07093dbb649 *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
7c1fa54b86f3e5f3410216aa627bd32680d7bd8210776a14762566cb2ea37d52 *mipsel-linux.elf/upx-3.91
|
||||||
|
5c60d0817feeb4dde55be90e552ccddc81591fbaecb899c3a21afc91c0ceb3b9 *powerpc-linux.elf/upx-3.91
|
||||||
|
"
|
||||||
|
########## end .sha256sums.recreate
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // init
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
#set -x # debug
|
||||||
|
exit_code=0
|
||||||
|
num_errors=0
|
||||||
|
all_errors=
|
||||||
|
|
||||||
|
if [[ $BM_T =~ (^|\+)ALLOW_FAIL($|\+) ]]; then
|
||||||
|
echo "ALLOW_FAIL"
|
||||||
|
set +e
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -z $upx_exe && -f $upx_BUILDDIR/upx.out ]] && upx_exe=$upx_BUILDDIR/upx.out
|
||||||
|
[[ -z $upx_exe && -f $upx_BUILDDIR/upx.exe ]] && upx_exe=$upx_BUILDDIR/upx.exe
|
||||||
|
if [[ -z $upx_exe ]]; then exit 1; fi
|
||||||
|
upx_run=$upx_exe
|
||||||
|
if [[ $BM_T =~ (^|\+)qemu($|\+) && -n $upx_qemu ]]; then
|
||||||
|
upx_run="$upx_qemu $upx_qemu_flags -- $upx_exe"
|
||||||
|
fi
|
||||||
|
if [[ $BM_T =~ (^|\+)wine($|\+) && -n $upx_wine ]]; then
|
||||||
|
upx_run="$upx_wine $upx_wine_flags $upx_exe"
|
||||||
|
fi
|
||||||
|
if [[ $BM_T =~ (^|\+)valgrind($|\+) ]]; then
|
||||||
|
if [[ -z $upx_valgrind ]]; then
|
||||||
|
upx_valgrind="valgrind"
|
||||||
|
fi
|
||||||
|
if [[ -z $upx_valgrind_flags ]]; then
|
||||||
|
#upx_valgrind_flags="--leak-check=full --show-reachable=yes"
|
||||||
|
#upx_valgrind_flags="-q --leak-check=no --error-exitcode=1"
|
||||||
|
upx_valgrind_flags="--leak-check=no --error-exitcode=1"
|
||||||
|
fi
|
||||||
|
upx_run="$upx_valgrind $upx_valgrind_flags $upx_exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then
|
||||||
|
(cd / && cd $upx_BUILDDIR && lcov -d . --zerocounters)
|
||||||
|
fi
|
||||||
|
|
||||||
|
export UPX="--prefer-ucl --no-color --no-progress"
|
||||||
|
|
||||||
|
# let's go
|
||||||
|
if ! $upx_run --version; then echo "UPX-ERROR: FATAL: upx --version FAILED"; exit 1; fi
|
||||||
|
if ! $upx_run -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||||
|
if ! $upx_run --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||||
|
rm -rf ./testsuite_1
|
||||||
|
mkbuilddirs testsuite_1
|
||||||
|
cd testsuite_1 || exit 1
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // decompression tests
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
testdir=t010_decompressed
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
|
||||||
|
testsuite_header $testdir
|
||||||
|
for f in $upx_testsuite_SRCDIR/files/packed/*/upx-3.91*; do
|
||||||
|
testsuite_split_f $f
|
||||||
|
[[ -z $fb ]] && continue
|
||||||
|
echo "# $f"
|
||||||
|
mkdir -p $testdir/$fsubdir
|
||||||
|
$upx_run -qq -d $f -o $testdir/$fsubdir/$fb
|
||||||
|
done
|
||||||
|
testsuite_check_sha $testdir
|
||||||
|
|
||||||
|
|
||||||
|
# run one pack+unpack step to canonicalize the files
|
||||||
|
testdir=t020_canonicalized
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
|
||||||
|
testsuite_header $testdir
|
||||||
|
for f in t010_decompressed/*/*; do
|
||||||
|
testsuite_split_f $f
|
||||||
|
[[ -z $fb ]] && continue
|
||||||
|
echo "# $f"
|
||||||
|
mkdir -p $testdir/$fsubdir/.packed
|
||||||
|
$upx_run -qq --prefer-ucl -1 $f -o $testdir/$fsubdir/.packed/$fb
|
||||||
|
$upx_run -qq -d $testdir/$fsubdir/.packed/$fb -o $testdir/$fsubdir/$fb
|
||||||
|
done
|
||||||
|
testsuite_check_sha $testdir
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // compression tests
|
||||||
|
# // info: we use fast compression levels because we want to
|
||||||
|
# // test UPX and not the compression libraries
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
testdir=t110_compress_ucl_nrv2b_3_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --nrv2b -3 --no-filter
|
||||||
|
|
||||||
|
testdir=t120_compress_ucl_nrv2d_3_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --nrv2d -3 --no-filter
|
||||||
|
|
||||||
|
testdir=t130_compress_ucl_nrv2e_3_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --nrv2e -3 --no-filter
|
||||||
|
|
||||||
|
testdir=t140_compress_lzma_2_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --lzma -2 --no-filter
|
||||||
|
|
||||||
|
testdir=t150_compress_ucl_2_all_filters
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress -2 --all-filters
|
||||||
|
|
||||||
|
testdir=t160_compress_all_methods_1_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --all-methods -1 --no-filter
|
||||||
|
|
||||||
|
testdir=t170_compress_all_methods_no_lzma_5_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --all-methods --no-lzma -5 --no-filter
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // summary
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
# recreate checkums from current version for an easy update in case of changes
|
||||||
|
recreate_expected_sha256sums .sha256sums.recreate
|
||||||
|
|
||||||
|
testsuite_header "UPX testsuite summary"
|
||||||
|
if ! $upx_run --version; then
|
||||||
|
echo "UPX-ERROR: upx --version FAILED"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "upx_exe='$upx_exe'"
|
||||||
|
if [[ "$upx_run" != "$upx_exe" ]]; then
|
||||||
|
echo "upx_run='$upx_run'"
|
||||||
|
fi
|
||||||
|
if [[ -f "$upx_exe" ]]; then
|
||||||
|
ls -l "$upx_exe"
|
||||||
|
file "$upx_exe" || true
|
||||||
|
fi
|
||||||
|
echo "upx_testsuite_SRCDIR='$upx_testsuite_SRCDIR'"
|
||||||
|
echo "upx_testsuite_BUILDDIR='$upx_testsuite_BUILDDIR'"
|
||||||
|
echo ".sha256sums.{expected,current}:"
|
||||||
|
cat */.sha256sums.expected | LC_ALL=C sort | wc
|
||||||
|
cat */.sha256sums.current | LC_ALL=C sort | wc
|
||||||
|
echo
|
||||||
|
if [[ $exit_code == 0 ]]; then
|
||||||
|
echo "UPX testsuite passed. All done."
|
||||||
|
else
|
||||||
|
echo "UPX-ERROR: UPX testsuite FAILED:${all_errors}"
|
||||||
|
echo "UPX-ERROR: UPX testsuite FAILED with $num_errors error(s). See log file."
|
||||||
|
fi
|
||||||
|
exit $exit_code
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
uqz4mAtKkF5Ex7Zt2tRP9mhQsAYn5+Xbupfuhee/s+2yVdBBdlXXRN2Q2AhMxF01
|
||||||
|
myhEuAtRNoQ4m7eyNgNU01pKb+dlyw2xiS+izm9+5fxuuEZfiuv76tQToQLltSdq
|
||||||
|
jP3Gt08MloJGcWraFiAXXji0S45MasJO3VOdygz09PbzIvGVp/NskGCMCU9lJlRt
|
||||||
|
2CsItWR+iHs6HNurWEKtEZz4qR8+HZ6RU5IquOnnHnI357lVUiC1w2qRcxmNVWuI
|
||||||
|
qS7GPvgisv0m4XMxe+l4L3b6a7laZr/hqHjFQqu/aO9Kmy5WmYRe3Bx4hTv5vqRi
|
||||||
|
OBDOUzwUcrdlUu2wqcvZhVxPaxxqA5u8G63Z3O30VCtWPZVU4yx9TRzcy/0lwxol
|
||||||
|
dw1b5t7Bl8uIzNyLsFMVS1MpnBspUrxBko6TqLAhv/DvUQmWGJRkP4Ar9naB4myS
|
||||||
|
vX6sim+Jn57Fr8aZMlvJbqlNindjxnX6+13u51C80GaYJBjHLkAIPaTTNLviOWpj
|
||||||
|
rbACDifaFloAsgJqz0KK/T7eohJBH2jVe2d9YxU6wZq6THDKJaeQ+nG5MWYvlkWa
|
||||||
|
K3N+jN8KI1GWqNpUtD8rbLPY1UZo05wQFZBCfdvEZoYdzJFVIS3t6kr0/gOIZu0D
|
||||||
|
AAIfIcopnpWpUk52MOEekzRRjJuF8fUMkiPX1oVs9HMKW+TU+yx/sFia+ke76w3i
|
||||||
|
1oiHKJJJNaoCjQXlAcT40rGLmSTLgL0ACCWIMGjK1QJYkpER8GCBCh9/whrJ3k1Q
|
||||||
|
0hm5hYiGty2ysRJFLIFPkYjangz7hIVzgOUSTYhVjJmIA62W2LmNKcixGX+sssCJ
|
||||||
|
/DK/Zs0uPiEX4gjkiomDksn7Dy8vAtHe7PzWpZA83mgPK+6zxoM6dgpM7FSe5q1/
|
||||||
|
tyf394l4nB7eayRUnx3NfK2/PTwrJcms5yAD9Hm2h72cp26TXh+RDVYWOgVX5/N0
|
||||||
|
dIsDRYo+/077pRTKwiCPrMxTxys53HHV7r5APd+FPmxikXvuszZvYTZ9K2MZB/1L
|
||||||
|
S2MCJ/u4GTTCwcbvfEjKVs3Fbqu7c2D/tVzakVEmMXloEAGPN/NrzOJsMMEDhWiw
|
||||||
|
g1wneAg5qF5nG+7R5WqstAeaRCYdXl46xay7iePZQ7viwHA8Zjuke18eHmh7J5jz
|
||||||
|
uzdh81rxCL3beoXb+BEr1/yKWfrJVTl33+m6c+zxdrV0B7O/ijlYxjke7Wo+ESac
|
||||||
|
WM2a4xU/WgXMi2+83XqcSZcRPdusZKA6bcTvAcYc/r8t7O1wjfPsTVj0WaM2DwL0
|
||||||
|
P1QTU4INmVn94zIV0+fGfyN0qI3YiS5iuOoPwLOVB13YECIyXnZz2/VJF7ZASOpS
|
||||||
|
701or4uF7GVEZxw19ow0AQttk6J/bEzbr7rZ5Um1yCMeQQ1TMHepJfuUbxle4W4S
|
||||||
|
8w8yC/Ytcy/e4rbiLG2/cY5b35LxtH1TCuaEtuiqa7vkmzr36qqD6fRWnXWC9QdR
|
||||||
|
0nWyJNj0xIIyMyilnBY2clAjDdT9qd2tMfpoz9hyBkTZPltzDw6Xd/IhhyL1URav
|
||||||
|
h0NCABGqXbpg8q7KCrIzIE6dJIh+7glfQuWkynmInntN4+fqk9Ked0haHkq5oGH5
|
||||||
|
vN5ZQNWPyQ67LaXQ4kW8iksgkgl7JEQsuie8oMuQZe13D4S3PWGFKchrBFGwN2xY
|
||||||
|
ut2+PCs5Al2BHU0qaCKdV7nCqv2tPC8G4uXNw081R2KwyoRlbKhowgFBYBTQIobJ
|
||||||
|
pc1GLU7HKm9tC61xIZ4u9oij/Bz1+gxx9vLxfx++EC/8UI23oMGygaYdda4gdEtm
|
||||||
|
v1wt8ldpzO4owI+9peFSolGLwKztwSPxln+5bvOsdsaZ6z5uW37N5ch/EwSwdmfo
|
||||||
|
Sm1i7fv/zQuZjmZkJXRJGvTd+sKdu7+IZUrTpu5W+jUfMAgmPc+AuYmSOn00K9dv
|
||||||
|
IJKY973ggNDaJKEw1uKzckl9uk/HRrgk+wgZPaWVRhOulj1npyFf+WmrZ2r3nTq0
|
||||||
|
koEI8UEselRuKJmojl4O0bz8fXZNgPtpLB/A0cdrj0Ist5TR+qRW9h3eSsybDYRS
|
||||||
|
GWP4UzFLAIwHflwNX0Q+9/u0uOxaXX6dKXzoddWksInBzh1pmQfrtUM3y7bHQYG5
|
||||||
|
zqnAMNMwm4WmtmF/mpjg0fKpiwFUU1geygkOwUsaK5Qcp5F0FPocdPRWVxUG0t3Y
|
||||||
|
QsmSpU5STb99YCs4TvhfUnQmdB2r+d0pZhlMte3v5lcpekSb2FxbUwdX3t9S2uGy
|
||||||
|
ho9CYmUj1+8ivUizjTLirOu/B8ohQT6kwvNqRSiQwU+YPa5DpxA1DYamIg6ehuX5
|
||||||
|
6u/dF4Eht+Cn6hasyzFviIUnV1y4ixLfSb0EGw+YoLbHgr8X4Uv4guaNQduKJyEu
|
||||||
|
g6p1v40fDhZ8AuQly+BOLL0yBlQoDrkY9+3HcIZAC5NmJFU5hle4Hz4gLzS6DwXo
|
||||||
|
2u8tqIELdtP9Zo4SKM7/yNy+rjl2RNRUEUNjidZsWuIC4bEeL3sUImP0Wt+zpdV0
|
||||||
|
y0RK1/wPW4dES5xFTCUp9xdP08dsSMtIrYJeBXbHrTZswnuOvk4MYGpmn/qy+qwc
|
||||||
|
GnkJtzJVm+uNspYuD0cW+JbJz5T+w1eNbejjZ+QVhqmE7ctSHndQUSueIyOcm79E
|
||||||
|
23jLzIoHMSHsiBJ8KeHN5bTfe66Gl8y3LIOpfchYd5XzkqxS7M01PxkWGZDWGYdl
|
||||||
|
6Gx64mg7ojPrSNaOzAu3da8oLvGi/YIf3wdJenZqiTzBnSzRsBnTpohQddHbB1Hj
|
||||||
|
uogDJSoad0ZSY0lLcvxncPB29hKpljFZ4IHO2UKOyO9+LFKsfK8/RbdSx/sHcUaH
|
||||||
|
hblVkVTSRReHmShxSw6abYZHivGNV0tXNXkY6uEzOMe+Vck9j9dTBSK0bFS/2Xdd
|
||||||
|
ZII/KFQH10+WEYyw+FurMUeVwU/FER4qpy+13r1PjxMSHfnJviEb8EjgvrcwAUDX
|
||||||
|
G9JNVtL4Vui6NMFV1u2qkbEMZK763YAIKYZC9UZYjbbhhgYTTMEfRcNvwVCix8nH
|
||||||
|
2TlWGhivuw5abE9QFduT1fHXJL+1uCn2GMhS8v3fxUrnGDQFit0YLlGEMm5/wVaM
|
||||||
|
PIZH5JDHlINUC0vbUrMXCz8Ztg3qhpOLiExlBHTD4vqYt9kniHLXOQfexegSC85C
|
||||||
|
AKiugEOdoHHYJGjNyXj6c0jTuMAe0CBwAKddUqPQztoKclNb02G2a9l5ColE29Uz
|
||||||
|
jXAb8PFANNqn4Nnm6oPPF1KxB45vLdT6+F1SRzXZunJ6p9N4E9KBtEOR+ixlcphL
|
||||||
|
InLJSg5iKTfWhXlSK6eldvVsP2GeoyjliERsKLgq1YGMiCW076dmoxR2Z5iPlD2V
|
||||||
|
G7Hz5nWjPBIoFhABEnONDxbrYB6ryeunILYcHpAaXSYq4OueRo6QGO8NRqFcNutG
|
||||||
|
WpwBfIlnu6rl9MDO053SJ1ah6D97n/D5aQa2JMMha0faZz84+MH3cnudAgpPjsG9
|
||||||
|
9G/2fEP08lQNAFiyY91wW3Mtj2No9+OJVYmwFORJm7IOu5nfuQZbzz9OFPcZLU5Y
|
||||||
|
DVo86icZgXayytW2XZtCKzVBDse+yi0xblGSNtwHlQIN8gKDVpa0I34DxUkIn1Cl
|
||||||
|
bk9S6+m6APF9ynN/kVCwMu9Nq3lwzmY6JCb/KX0d66uyVwYG3BN1UEWqJhDJjGep
|
||||||
|
a2JmHnG1aVhYaE/2EsOc+YP89Oub+KeuCj2dHJj2dH3QDCjr2xZUbLO7mw1tsATH
|
||||||
|
dPjNEBvxet9UU/RXqhhkfkv1XGr/umWrkjKbFqDNl5Tav/00+I59rboW7C/cWRxN
|
||||||
|
CVbadLPJlPNRR8+54G+VkDZgqaQprPwYih5a7d2MEzrMtZbU0uCJc839dqMgsf++
|
||||||
|
k4maampkcDLhxt8bBg43WoDgWxiQ+KVWyEBGmTOT2q4WYeLI9PZLseA9eNJbpt9J
|
||||||
|
oxtNNdqkU48YZWsq/3L1L0eXdGvv5TIMto4bH3SWuvQ2sepwMRxxwTg8qFrutk9K
|
||||||
|
OLOUbO1Z2ivh1g6+DAgs3RFmy9hPzzqPmJk8cL6F5tcd/VwGcow3UBJ1+Xn3SE5Y
|
||||||
|
UCHNrSfSrvDaA3N8jyvS/uPq0qRgp7LQRqrhh5cVPi67goDx/ku/fVbMbcrarO/e
|
||||||
|
Czv6CX7Id2QliOSMGGVId+ECXBvuIGAb2d4til+zTnfhBE2+uS5WQ7MjzH9PKZ7n
|
||||||
|
TDuV36mA1FDCX+WShPau7R0SGXSqKyeHJ8XSuFHbGwr1Zxwoq4GBYIcAxWjp9HA4
|
||||||
|
dhBE2x5WSTbnqh1sClxfOeE8MHxi+EUonCcvfvm30NOcC4zw1dCDc6SKLoMJYrFz
|
||||||
|
EdR3Kt1SJ9M0Jl3dD/gCTKG5kObJzqmo9BladIpQt6c=
|
||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
/.bzr*
|
||||||
|
/.hg*
|
||||||
|
/Makevars.global*
|
||||||
|
/build*
|
||||||
|
/maint*
|
||||||
|
|
||||||
|
.depend
|
||||||
|
GNUmakefile
|
||||||
|
MMakefile
|
||||||
|
Makevars.local*
|
||||||
|
tmp-testsuite*
|
||||||
|
|
||||||
|
*.a
|
||||||
|
*.dll
|
||||||
|
*.lib
|
||||||
|
*.py[cdo]
|
||||||
|
*.so
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
doc/*.1
|
||||||
|
doc/*.doc
|
||||||
|
doc/*.html
|
||||||
|
doc/*.man
|
||||||
|
doc/*.ps
|
||||||
|
doc/*.tex
|
||||||
|
|
||||||
|
src/compress_nrv*
|
||||||
|
src/*.mft
|
||||||
|
src/*.rc
|
||||||
|
|
||||||
|
src/*.d
|
||||||
|
src/*.exe
|
||||||
|
src/*.map
|
||||||
|
src/*.o
|
||||||
|
src/*.obj
|
||||||
|
src/*.out
|
||||||
|
src/*.res
|
||||||
|
src/*.ttp
|
||||||
|
|
||||||
|
src/stub/**/.*-stamp
|
||||||
|
src/stub/**/MMakefile
|
||||||
|
src/stub/tmp*/*.bin
|
||||||
|
src/stub/tmp*/*.bin.bindump
|
||||||
|
src/stub/tmp*/*.bin.disasm
|
||||||
|
src/stub/tmp*/*.d
|
||||||
|
src/stub/tmp*/*.map
|
||||||
|
src/stub/tmp*/*.o
|
||||||
|
src/stub/tmp*/*.o.disasm
|
||||||
|
src/stub/tmp*/mips.r3000-*.[is]
|
||||||
|
src/stub/tmp*/mipsel.r3000-*.[is]
|
||||||
|
src/stub/src/**/tmp*/*
|
||||||
|
|
||||||
|
src/stub/tools/armpe/armpe_tester.exe
|
||||||
|
src/stub/tools/armpe/armpe_tester.out
|
||||||
|
|
||||||
|
src/stub/tools/sstrip/amd64-linux-sstrip
|
||||||
|
src/stub/tools/sstrip/i386-linux-sstrip
|
||||||
|
src/stub/tools/sstrip/sstrip
|
||||||
+295
@@ -0,0 +1,295 @@
|
|||||||
|
# Support for GibLab CI -- https://gitlab.com/
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- export TRAVIS_OS_NAME=linux
|
||||||
|
- unset CROSS C B T X
|
||||||
|
- uname -a; pwd; id; umask
|
||||||
|
- cat /etc/os-release || true
|
||||||
|
- |
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^(CentOS|Fedora|OpenSUSE) ]]; then
|
||||||
|
time rpm -qa | LC_ALL=C sort
|
||||||
|
fi
|
||||||
|
- |
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^(Debian|Ubuntu) ]]; then
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
time dpkg -l
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^Ubuntu1604- ]]; then
|
||||||
|
dpkg --add-architecture i386
|
||||||
|
fi;
|
||||||
|
time apt-get -yq update
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^CentOS5- ]]; then
|
||||||
|
time rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm;
|
||||||
|
time yum install -y
|
||||||
|
coreutils curl diffutils grep gzip sed
|
||||||
|
bzip2 file findutils git openssh-clients openssl perl tar wget which xz
|
||||||
|
gcc gcc-c++ make valgrind
|
||||||
|
glibc-devel libstdc++-devel zlib-devel
|
||||||
|
glibc-devel.i386 libstdc++-devel.i386 zlib-devel.i386;
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^CentOS6- ]]; then
|
||||||
|
time yum install -y
|
||||||
|
coreutils curl diffutils grep gzip sed
|
||||||
|
bzip2 file findutils git openssh-clients openssl perl tar wget which xz
|
||||||
|
gcc gcc-c++ make valgrind
|
||||||
|
glibc-devel libstdc++-devel zlib-devel
|
||||||
|
glibc-devel.i686 libstdc++-devel.i686 zlib-devel.i686;
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^CentOS7- ]]; then
|
||||||
|
time yum install -y
|
||||||
|
coreutils curl diffutils grep gzip sed
|
||||||
|
bzip2 file findutils git openssh-clients openssl perl tar wget which xz
|
||||||
|
clang gcc gcc-c++ make valgrind
|
||||||
|
glibc-devel libasan libstdc++-devel zlib-devel
|
||||||
|
glibc-devel.i686 libasan.i686 libstdc++-devel.i686 zlib-devel.i686;
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^Fedora ]]; then
|
||||||
|
time dnf install -y --best --allowerasing
|
||||||
|
coreutils curl diffutils grep gzip sed
|
||||||
|
bzip2 file findutils git openssh-clients openssl perl tar wget which xz
|
||||||
|
clang gcc gcc-c++ lcov make valgrind
|
||||||
|
glibc-devel libasan libstdc++-devel libubsan zlib-devel
|
||||||
|
glibc-devel.i686 libasan.i686 libstdc++-devel.i686 libubsan.i686 zlib-devel.i686;
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^OpenSUSE42.2- ]]; then
|
||||||
|
time zypper update -y;
|
||||||
|
time zypper install -y
|
||||||
|
coreutils curl diffutils grep gzip sed
|
||||||
|
bzip2 file findutils git openssh openssl perl tar wget which xz
|
||||||
|
llvm-clang gcc gcc-32bit gcc-c++ gcc-c++-32bit lcov make valgrind
|
||||||
|
glibc-devel libstdc++-devel libz1 zlib-devel
|
||||||
|
glibc-devel-32bit libstdc++-devel-32bit libz1-32bit zlib-devel-32bit;
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^(Debian|Ubuntu) ]]; then
|
||||||
|
time apt-get -yq --no-install-suggests --no-install-recommends --force-yes upgrade;
|
||||||
|
time apt-get -yq --no-install-suggests --no-install-recommends --force-yes install
|
||||||
|
build-essential ca-certificates curl file git openssh-client openssl wget xz-utils zlib1g-dev;
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^Ubuntu1604- ]]; then
|
||||||
|
time apt-get -yq --no-install-suggests --no-install-recommends --force-yes install
|
||||||
|
g++-multilib
|
||||||
|
libstdc++-5-dev:i386 zlib1g-dev:i386
|
||||||
|
libx32stdc++-5-dev libx32z1-dev;
|
||||||
|
fi
|
||||||
|
-
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^Ubuntu1604-cross ]]; then
|
||||||
|
time apt-get -yq --no-install-suggests --no-install-recommends --force-yes install
|
||||||
|
crossbuild-essential-arm64 crossbuild-essential-armel crossbuild-essential-armhf
|
||||||
|
crossbuild-essential-powerpc crossbuild-essential-ppc64el crossbuild-essential-s390x
|
||||||
|
binutils-mingw-w64-i686 g++-mingw-w64-i686
|
||||||
|
binutils-mingw-w64-x86-64 g++-mingw-w64-x86-64
|
||||||
|
binutils-mips-linux-gnu g++-mips-linux-gnu
|
||||||
|
binutils-mipsel-linux-gnu g++-mipsel-linux-gnu
|
||||||
|
binutils-powerpc-linux-gnu g++-powerpc-linux-gnu
|
||||||
|
binutils-powerpc64-linux-gnu g++-powerpc64-linux-gnu
|
||||||
|
qemu-user qemu-utils wine;
|
||||||
|
fi
|
||||||
|
- git --version && bash --version
|
||||||
|
- umask 022; mkdir -p ../deps ../build/gitlab
|
||||||
|
- time git submodule update --init --recursive
|
||||||
|
- cd ../deps && time wget -q -O - https://github.com/upx/upx/releases/download/v3.00/ucl-1.03.tar.xz | tar -x --use-compress-program=xz
|
||||||
|
- cd ../deps && time wget -q -O - https://github.com/upx/upx/releases/download/v3.00/zlib-1.2.8.tar.xz | tar -x --use-compress-program=xz
|
||||||
|
- cd ../deps && time git clone https://github.com/upx/upx-testsuite
|
||||||
|
- |
|
||||||
|
if [[ $CI_BUILD_NAME =~ ^Fedora ]]; then
|
||||||
|
time dnf install -y --best --allowerasing python
|
||||||
|
cd ../deps && time wget -q -O - https://github.com/upx/upx-stubtools/releases/download/v20160918/bin-upx-20160918.tar.xz | tar -x --use-compress-program=xz
|
||||||
|
fi
|
||||||
|
- cd $CI_PROJECT_DIR; pwd
|
||||||
|
|
||||||
|
CentOS5-gcc-m32+m64: # gcc-4.1
|
||||||
|
image: centos:5
|
||||||
|
script:
|
||||||
|
# patch src/Makefile for gcc-4.1
|
||||||
|
- perl -i -p -e 's/ -Wmissing-declarations / /; s/ -Wvla / /;' src/Makefile
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
CentOS6-gcc-m32+m64: # gcc-4.4
|
||||||
|
image: centos:6
|
||||||
|
script:
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
CentOS7-clang+gcc-m32+m64: # clang-3.4, gcc-4.8
|
||||||
|
image: centos:7
|
||||||
|
script:
|
||||||
|
- time C=clang-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=clang-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
Debian7-gcc-m64: # gcc-4.7
|
||||||
|
image: debian:7
|
||||||
|
script:
|
||||||
|
- time C=gcc-4.7-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-4.7-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
Debian8-gcc-m64: # gcc-4.9
|
||||||
|
image: debian:8
|
||||||
|
script:
|
||||||
|
- time C=gcc-4.9-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-4.9-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-4.9-m64 bash ./.github/travis_deploy.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
Fedora23-clang+gcc-m32+m64: # clang-3.7, gcc-5
|
||||||
|
image: fedora:23
|
||||||
|
script:
|
||||||
|
- time X=rebuild-stubs bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m64 B=sanitize bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=clang-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 B=sanitize bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 T=valgrind bash ./.github/travis_testsuite_1.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
Fedora24-clang+gcc-m32+m64: # clang-3.8, gcc-6
|
||||||
|
image: fedora:24
|
||||||
|
script:
|
||||||
|
- time X=rebuild-stubs bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m64 B=sanitize bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=clang-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 B=sanitize bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 T=valgrind bash ./.github/travis_testsuite_1.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
Fedora25-clang+gcc-m32+m64: # clang-3.8, gcc-6
|
||||||
|
image: fedora:25
|
||||||
|
script:
|
||||||
|
- time X=rebuild-stubs bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-m64 B=sanitize bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=clang-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 B=sanitize bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-m64 T=valgrind bash ./.github/travis_testsuite_1.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
OpenSUSE42.2-clang+gcc-m32+m64: # clang-3.8, gcc-4.8
|
||||||
|
image: opensuse:42.2
|
||||||
|
script:
|
||||||
|
- time C=clang-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-4.8-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-4.8-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=clang-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-4.8-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-4.8-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
Ubuntu1204-gcc-m64: # gcc-4.6
|
||||||
|
image: ubuntu:12.04
|
||||||
|
script:
|
||||||
|
- time C=gcc-4.6-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-4.6-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
Ubuntu1404-gcc-m64: # gcc-4.8
|
||||||
|
image: ubuntu:14.04
|
||||||
|
script:
|
||||||
|
- time C=gcc-4.8-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-4.8-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-4.8-m64 bash ./.github/travis_deploy.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
Ubuntu1604-gcc-m32+m64: # gcc-5
|
||||||
|
image: ubuntu:16.04
|
||||||
|
script:
|
||||||
|
- time C=gcc-5-m32 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-5-m64 bash ./.github/travis_build.sh
|
||||||
|
- time C=gcc-5-m32 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-5-m64 bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time C=gcc-5-m32 bash ./.github/travis_deploy.sh
|
||||||
|
- time C=gcc-5-m64 bash ./.github/travis_deploy.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
Ubuntu1604-cross: # gcc-5
|
||||||
|
image: ubuntu:16.04
|
||||||
|
script:
|
||||||
|
- time CROSS=aarch64-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=arm-linux-gnueabi C=gcc-5 T=qemu bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=arm-linux-gnueabihf C=gcc-5 T=qemu bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=i686-w64-mingw32 C=gcc-5 T=wine bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=mips-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=mipsel-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=powerpc-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=powerpc64-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=powerpc64le-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=s390x-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=x86_64-w64-mingw32 C=gcc-5 T=wine bash ./.github/travis_build.sh
|
||||||
|
- time CROSS=aarch64-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time CROSS=arm-linux-gnueabi C=gcc-5 T=qemu bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time CROSS=arm-linux-gnueabihf C=gcc-5 T=qemu bash ./.github/travis_testsuite_1.sh
|
||||||
|
# - time CROSS=i686-w64-mingw32 C=gcc-5 T=wine bash ./.github/travis_testsuite_1.sh
|
||||||
|
# - time CROSS=mips-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time CROSS=mipsel-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_testsuite_1.sh
|
||||||
|
# - time CROSS=powerpc-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_testsuite_1.sh
|
||||||
|
# - time CROSS=powerpc64-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_testsuite_1.sh
|
||||||
|
# - time CROSS=powerpc64le-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_testsuite_1.sh
|
||||||
|
# - time CROSS=s390x-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_testsuite_1.sh
|
||||||
|
# - time CROSS=x86_64-w64-mingw32 C=gcc-5 T=wine bash ./.github/travis_testsuite_1.sh
|
||||||
|
- time CROSS=aarch64-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=arm-linux-gnueabi C=gcc-5 T=qemu bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=arm-linux-gnueabihf C=gcc-5 T=qemu bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=i686-w64-mingw32 C=gcc-5 T=wine bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=mips-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=mipsel-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=powerpc-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=powerpc64-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=powerpc64le-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=s390x-linux-gnu C=gcc-5 T=qemu bash ./.github/travis_deploy.sh
|
||||||
|
- time CROSS=x86_64-w64-mingw32 C=gcc-5 T=wine bash ./.github/travis_deploy.sh
|
||||||
|
tags: [ shared ]
|
||||||
|
except: [ tags ]
|
||||||
|
|
||||||
|
# vim:set ts=2 sw=2 et:
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[submodule "src/lzma-sdk"]
|
||||||
|
path = src/lzma-sdk
|
||||||
|
url = https://github.com/upx/upx-lzma-sdk.git
|
||||||
|
branch = master
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
syntax: regexp
|
|
||||||
|
|
||||||
^\.bzr
|
|
||||||
^ChangeLog
|
|
||||||
^Makevars.global
|
|
||||||
^build
|
|
||||||
^maint
|
|
||||||
|
|
||||||
syntax: glob
|
|
||||||
|
|
||||||
.depend
|
|
||||||
Makevars.local
|
|
||||||
|
|
||||||
*.a
|
|
||||||
*.dll
|
|
||||||
*.lib
|
|
||||||
*.py[cdo]
|
|
||||||
*.so
|
|
||||||
*.swp
|
|
||||||
|
|
||||||
doc/*.1
|
|
||||||
doc/*.doc
|
|
||||||
doc/*.html
|
|
||||||
doc/*.man
|
|
||||||
doc/*.ps
|
|
||||||
doc/*.tex
|
|
||||||
|
|
||||||
src/GNUmakefile
|
|
||||||
src/MMakefile
|
|
||||||
src/compress_nrv*
|
|
||||||
src/*.mft
|
|
||||||
src/*.rc
|
|
||||||
|
|
||||||
src/*.d
|
|
||||||
src/*.exe
|
|
||||||
src/*.map
|
|
||||||
src/*.o
|
|
||||||
src/*.obj
|
|
||||||
src/*.out
|
|
||||||
src/*.res
|
|
||||||
src/*.ttp
|
|
||||||
|
|
||||||
stub/**MMakefile
|
|
||||||
stub/**.*-stamp
|
|
||||||
stub/tmp*/*
|
|
||||||
stub/**/tmp*/*
|
|
||||||
|
|
||||||
stub/tools/armpe/armpe_tester{,.exe,.out}
|
|
||||||
|
|
||||||
stub/tools/sstrip/amd64-linux-sstrip
|
|
||||||
stub/tools/sstrip/i386-linux-sstrip
|
|
||||||
stub/tools/sstrip/sstrip
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
140415ffbcef86a42b4d672249927364430d3d38 RELEASE_111
|
|
||||||
155618b5b7930f97bd84b82befa7a4fd6672efb3 RELEASE_304
|
|
||||||
1931f4f28074970ec53b4cd21c7fc181b4da8e5e RELEASE_301
|
|
||||||
223ac5b23f9731ceac9ff8d65167df4900776e36 RELEASE_190
|
|
||||||
2c753c5bf38e7322715e2a5c6c5381111bd7a61a RELEASE_194
|
|
||||||
2ee65b77f9117651e2e5517b2edede23698d73ca RELEASE_196
|
|
||||||
396983c065fc743cb5b9703e266ca87eeff8a6ee RELEASE_291
|
|
||||||
46f3a6cca02603000fadc16637b02e30caddd909 RELEASE_302
|
|
||||||
70402aeee6e0e4fc2889658ed8cee44461c0b0a8 RELEASE_200
|
|
||||||
7c6747c82b167368344a238b1a3a87c2a4fa6a18 RELEASE_306
|
|
||||||
95c558f81a0b8d5bb2bede4c8208bb84ae7d1e58 RELEASE_303
|
|
||||||
a1c61174f54aac714f59ac20fcba839d71e64c5c RELEASE_292
|
|
||||||
a916a2fe22de45167d25abcb40008315f415221c RELEASE_201
|
|
||||||
a935d577fc7dd9c2c87761c9c702805da6ce1e51 RELEASE_193
|
|
||||||
b0353253b0b3d062eb5adb50d4b665a96620da45 RELEASE_195
|
|
||||||
b82ef51896199484afe5b0553af7d1e59b7ce428 BRANCHPOINT_FOR_upx2.hg
|
|
||||||
c2e0cd4d621b047f254f2def42132a03683ff52c RELEASE_192
|
|
||||||
c9a983b7da9d4a2311f74366478348412cac2986 RELEASE_305
|
|
||||||
d276aa09033c24d0981bc3f4fee5628aecc988ad RELEASE_290
|
|
||||||
eb1ce56dce7dd1835964362470610925963b9043 RELEASE_110
|
|
||||||
ed96891ef795bceec6b7ff3ca1ca7764431bfb39 RELEASE_191
|
|
||||||
ef9c7f2c9658d73a9b5ab2ed291483d2bbcd8bc7 RELEASE_300
|
|
||||||
efa52753e366300c0e0ebe20631adcb24ed3c15b RELEASE_293
|
|
||||||
+258
@@ -0,0 +1,258 @@
|
|||||||
|
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
language: cpp
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
on_success: never
|
||||||
|
on_failure: change
|
||||||
|
|
||||||
|
.ubuntu_toolchain_sources: &S
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.5
|
||||||
|
- llvm-toolchain-precise-3.6
|
||||||
|
- llvm-toolchain-precise-3.7
|
||||||
|
- llvm-toolchain-precise-3.8
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- CROSS= C= B= T= X=
|
||||||
|
- secure: "YXHLXK+CM5d8yELIUSSs+P0/CoefClO7/AUX1oBj5W75g+YzR5uS2doVsB8UH8S8/GdNxk4P9Jgn4EiEVnjfGgn2eAD9MVpDPIxyJs5vI+5G77asq3QNdSl6QFv3O9I/6yBoVCewgPFPqsMd7Yvs/Ea3LcQkqalVhrC8ybYtmfs6VL2w33gn2J3b3TCn/s21L0ijklM0xvP1GNMDtuUpTSish5wvGOHE/91rwtdUDbJR8u31QY7fTASDiNnL/7ihgEIZ5XxpDYXviX1GC+nemhX1fWpmVmuT8m30Ruodi0yJVGASw9i2SaKv/VX/fJ/w2vlCfspL5LMZKkVLlfpIo3mQGqmMHFxv7mNy+hRu50ptoWNSkWArcqifwveh2liHUpl4jTvWaVll5Tw5VUGJhAUdzCTnqLIbWFnKIgCedL3iRFi4+EbyWNxel8lFESMOTDZFfJG5yEiDJbgbLsUaT2GmrsOphwAG7zDcZzvYTdjg/lF4Wh0MUnQJ+0MhDpii8Ahjp49lAPdw8uRQyyY7d7ksYKXVIkbgl6dRCC5vZSPucJiFjq2BClqIoEmzZPvHveDbovzFkNhJX9tFLrHLcXbPPcegww1FGoQ3wBM6JwJ+TvSD6N4OdCmou05aDuuQeznHi3GxOScjGwxdMIU28fdJDCTDg2rOihm22kHVajo="
|
||||||
|
- secure: "JpSv3+QRmHcfN/bmT3mVkqET44NCPhM/qpcUssCVXnd2GW0qWURoyPHzVMn/gbeAkUjR6djtN3OzJ+M181QmlmTmE26pZC9Q6r1buNDWdkIH1FcpMCa67BBAjmq+yDwulDtvCMv0lbz60v57lzHBOLczF3yMxBVTjXxt1RsrzDLHzzVaDR5lEe+sQUNeRL7Vaq8crimPNTr4ZhMe59eweTO/3AWovuSPf250k1flfv7I8audZgrVZdbVKvj5C3Sziy1AGXcu8mDfET9/Ya2XBCQHWODjiKlnhSxqthhP3gQuacaLjpS2FjvQlamd+I9x6BBoLSeNbiXD9vgCydDUKvmUrU+zQs64U1hHk9WZWVC19kG7lTtTdanGDIUlIUtFZgqE4AQpJaIUWkUmHGyHi61JMvduzX21eL5c5j9DoJteX42FPb1n3xK/JSnUkLMpbFdQuy5inhzefhDfeNzaYxt8nPwHnJqrF73SW4PLDKeRyzvg/P+zqcou8nXrHfA1z9/FlnYzf7Qc9meai9Q/JARX3Q1ZKu5uyG+RuBLe2POq0192w6pflTr1ZlLJsKNSc1147PviKfmpla1lg3/6uVzMp5tgwbve/hx9SDXiRueGttKw/ymsY662+8G24NRKo4fxNklWFHaB4owM84edDzXDckPXbPgue8/HQT8BFio="
|
||||||
|
matrix:
|
||||||
|
- TRAVIS_EMPTY_JOB_WORKAROUND=true
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
exclude:
|
||||||
|
- env: TRAVIS_EMPTY_JOB_WORKAROUND=true
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
sudo: required
|
||||||
|
dist: trusty
|
||||||
|
compiler: gcc
|
||||||
|
env: X=rebuild-stubs
|
||||||
|
addons: { apt: { packages: [ "g++-multilib", "lib32z1" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.4-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.4-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.4-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.4" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.5-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.5-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.5-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.5" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.6-m32
|
||||||
|
addons: { apt: { packages: [ "g++-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.6-m64
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.7-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.7-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.7-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.7" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.8-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.8-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.8-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.8" ] } }
|
||||||
|
# - os: linux
|
||||||
|
# sudo: required
|
||||||
|
# dist: trusty
|
||||||
|
# compiler: gcc
|
||||||
|
# env: C=gcc-4.8-mx32
|
||||||
|
# addons: { apt: { packages: [ "g++-multilib", "libx32stdc++-4.8-dev", "libx32z1-dev" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.9-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.9-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-4.9-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-4.9" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-5-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-5-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-5-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-5" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-6-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-6-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-6-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-6" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-6-m32 B=debug
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-6-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-6-m64 B=debug
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-6" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-6-m64 B=debug+sanitize
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-6" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-6-m64 B=sanitize
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-6" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: C=gcc-6-m64 B=valgrind T=valgrind
|
||||||
|
addons: { apt: { sources: *S, packages: [ "g++-6", valgrind ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.4-m32
|
||||||
|
addons: { apt: { packages: [ "g++-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.4-m64
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.5-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.5", "g++-6-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.5-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.5" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.6-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.6", "g++-6-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.6-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.6" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.7-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.7", "g++-6-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.7-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.7" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.8-m32
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.8", "g++-6-multilib", "zlib1g-dev:i386" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.8-m64
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.8" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.8-m64 B=debug+sanitize
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.8" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.8-m64 B=sanitize
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.8" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.8-m64 B=debug+scan-build
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.8" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-3.8-m64 B=scan-build
|
||||||
|
addons: { apt: { sources: *S, packages: [ "clang-3.8" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: CROSS=arm-linux-gnueabi C=gcc-4.6 T=SKIP
|
||||||
|
addons: { apt: { packages: [ "g++-arm-linux-gnueabi", "qemu-user" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: CROSS=arm-linux-gnueabihf C=gcc-4.6 T=SKIP
|
||||||
|
addons: { apt: { packages: [ "g++-arm-linux-gnueabihf", "qemu-user" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: CROSS=i386-w64-mingw32 C=gcc-4.6 T=wine
|
||||||
|
addons: { apt: { packages: [ "binutils-mingw-w64-i686", "g++-mingw-w64-i686", "wine" ] } }
|
||||||
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
env: CROSS=x86_64-w64-mingw32 C=gcc-4.6 T=wine
|
||||||
|
addons: { apt: { packages: [ "binutils-mingw-w64-x86-64", "g++-mingw-w64-x86-64", "wine" ] } }
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode6.4
|
||||||
|
compiler: clang
|
||||||
|
# must use debug build or else we get "ld: internal error: atom not found" when linking
|
||||||
|
env: C=clang-602-m32 B=debug
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode6.4
|
||||||
|
compiler: clang
|
||||||
|
# must use debug build or else we get "ld: internal error: atom not found" when linking
|
||||||
|
env: C=clang-602-m64 B=debug
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode7.3
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-703-m32
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode7.3
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-703-m64
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode8.2
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-800-m32
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode8.2
|
||||||
|
compiler: clang
|
||||||
|
env: C=clang-800-m64
|
||||||
|
|
||||||
|
install:
|
||||||
|
- uname -a; pwd; id; umask
|
||||||
|
- cat /etc/os-release || true
|
||||||
|
- |
|
||||||
|
cd /
|
||||||
|
if [[ $TRAVIS_OS_NAME == linux ]]; then
|
||||||
|
if [[ $B =~ (^|\+)coverage($|\+) ]]; then
|
||||||
|
travis_retry pip install --user cpp-coveralls
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
if ! gsha256sum </bin/sh >/dev/null 2>/dev/null; then travis_retry brew install coreutils; fi
|
||||||
|
if [[ $B =~ (^|\+)coverage($|\+) ]]; then
|
||||||
|
travis_retry brew install lcov
|
||||||
|
travis_retry pip install --user cpp-coveralls
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
- git --version && bash --version
|
||||||
|
- umask 022; cd $TRAVIS_BUILD_DIR && mkdir -p ../deps ../build/travis
|
||||||
|
- cd ../deps && travis_retry wget -q -O - https://github.com/upx/upx/releases/download/v3.00/ucl-1.03.tar.xz | tar -xJ
|
||||||
|
- cd ../deps && travis_retry wget -q -O - https://github.com/upx/upx/releases/download/v3.00/zlib-1.2.8.tar.xz | tar -xJ
|
||||||
|
- cd ../deps && travis_retry git clone https://github.com/upx/upx-testsuite
|
||||||
|
- |
|
||||||
|
if [[ $X =~ (^|\+)rebuild-stubs($|\+) ]]; then
|
||||||
|
cd ../deps && travis_retry wget -q -O - https://github.com/upx/upx-stubtools/releases/download/v20160918/bin-upx-20160918.tar.xz | tar -xJ
|
||||||
|
fi
|
||||||
|
|
||||||
|
script:
|
||||||
|
- cd $TRAVIS_BUILD_DIR && bash ./.github/travis_build.sh
|
||||||
|
- cd $TRAVIS_BUILD_DIR && bash ./.github/travis_testsuite_1.sh
|
||||||
|
after_success:
|
||||||
|
- cd $TRAVIS_BUILD_DIR && bash ./.github/travis_deploy.sh
|
||||||
|
|
||||||
|
# vim:set ts=2 sw=2 et:
|
||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2017 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
Limitations and other things which are not (yet) supported:
|
Limitations and other things which are not (yet) supported:
|
||||||
@@ -44,7 +44,7 @@ test file.
|
|||||||
|
|
||||||
win32/pe
|
win32/pe
|
||||||
--------
|
--------
|
||||||
* writeable shared sections (`--force' *may* work)
|
* writable shared sections (`--force' *may* work)
|
||||||
* certificates in the image
|
* certificates in the image
|
||||||
* compressing files which contain a big BSS requires lots of memory
|
* compressing files which contain a big BSS requires lots of memory
|
||||||
during compression
|
during compression
|
||||||
|
|||||||
@@ -1,32 +1,26 @@
|
|||||||
#
|
#
|
||||||
# UPX toplevel Makefile - needs GNU make 3.81 or better
|
# UPX toplevel Makefile - needs GNU make 3.81 or better
|
||||||
#
|
#
|
||||||
# Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
#
|
#
|
||||||
|
|
||||||
MAKEFLAGS += -rR
|
MAKEFLAGS += -rR
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
export SHELL = /bin/sh
|
export SHELL = /bin/sh
|
||||||
|
|
||||||
ifneq ($(findstring $(firstword $(MAKE_VERSION)),3.77 3.78 3.78.1 3.79 3.79.1 3.80),)
|
|
||||||
$(error GNU make 3.81 or better is required)
|
|
||||||
endif
|
|
||||||
|
|
||||||
srcdir = .
|
srcdir = .
|
||||||
top_srcdir = .
|
top_srcdir = .
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
||||||
|
|
||||||
|
# info: src/stub needs special build tools from https://github.com/upx/upx-stubtools
|
||||||
# info: src/stub needs special build tools
|
|
||||||
BUILD_STUB = 0
|
BUILD_STUB = 0
|
||||||
ifneq ($(wildcard $(HOME)/local/bin/bin-upx/.),)
|
ifneq ($(wildcard $(HOME)/local/bin/bin-upx/upx-stubtools-check-version),)
|
||||||
BUILD_STUB = 1
|
BUILD_STUB = 1
|
||||||
endif
|
endif
|
||||||
ifneq ($(wildcard $(HOME)/bin/bin-upx/.),)
|
ifneq ($(wildcard $(HOME)/bin/bin-upx/upx-stubtools-check-version),)
|
||||||
BUILD_STUB = 1
|
BUILD_STUB = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@echo "UPX info: please choose a target for 'make'"
|
@echo "UPX info: please choose a target for 'make'"
|
||||||
|
|
||||||
@@ -37,6 +31,6 @@ endif
|
|||||||
$(MAKE) -C src $@
|
$(MAKE) -C src $@
|
||||||
$(MAKE) -C doc $@
|
$(MAKE) -C doc $@
|
||||||
|
|
||||||
|
|
||||||
.PHONY: default all mostlyclean clean distclean maintainer-clean
|
.PHONY: default all mostlyclean clean distclean maintainer-clean
|
||||||
|
|
||||||
|
# vim:set ts=8 sw=8 noet:
|
||||||
|
|||||||
@@ -2,6 +2,50 @@
|
|||||||
User visible changes for UPX
|
User visible changes for UPX
|
||||||
==================================================================
|
==================================================================
|
||||||
|
|
||||||
|
Changes in 3.93 (29 Jan 2017):
|
||||||
|
* UPX has moved to GitHub - the new home page is https://upx.github.io
|
||||||
|
* fixed some win32/pe and win64/pe regressions introduced in 3.92
|
||||||
|
|
||||||
|
Changes in 3.92 (11 Dec 2016):
|
||||||
|
* UPX has moved to GitHub - the new home page is https://upx.github.io
|
||||||
|
* IMPORTANT: all PE formats: internal changes: reunited the diverged source
|
||||||
|
files - please report all regressions into the bug tracker and try UPX 3.91
|
||||||
|
in case of problems.
|
||||||
|
* Support Apple MacOS 10.12 "Sierra", including more-robust de-compression.
|
||||||
|
* Explicitly diagnose Go-language bad PT_LOAD; recommend hemfix.c.
|
||||||
|
https://sourceforge.net/p/upx/bugs/195/ https://github.com/pwaller/goupx
|
||||||
|
* Fix CERT-FI Case 829767 UPX command line tools segfaults.
|
||||||
|
Received by UPX Team on 2015-May-08; originally reported
|
||||||
|
by Codenomicon to NCSC-FI on 2015-01-08.
|
||||||
|
The vulnerabilities were discovered by Joonas Kuorilehto and
|
||||||
|
Antti Häyrynen from Codenomicon.
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.91 (30 Sep 2013):
|
||||||
|
* Added experimental support for Windows 64-bit PE files, based on
|
||||||
|
work by Stefan Widmann. Please use for testing only!
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
==================================================================
|
||||||
|
|
||||||
|
Changes in 3.09 (18 Feb 2013):
|
||||||
|
* New option --preserve-build-id for GNU ELF.
|
||||||
|
* Allow for code signing and LC_UUID on Mac OS X executables.
|
||||||
|
* Allow non-contiguous LC_SEGMENTs and 0==.vmsize for Mach-O.
|
||||||
|
* Allow zero-filled final page in PackUnix::canUnpack().
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.08 (12 Dec 2011):
|
||||||
|
* Fix allocation in runtime stub for darwin.macho-entry (i386 and amd64).
|
||||||
|
* Compress shared library on ELF i386 only [ld.so threatens even this case].
|
||||||
|
* Attempt to support ELF on QNX 6.3.0 for armel (experimental).
|
||||||
|
* Better diagnostic when ELF -fPIC is needed.
|
||||||
|
* PT_NOTE improvements for *BSD.
|
||||||
|
* Preserve more ELF .e_flags on ARM.
|
||||||
|
* Minor code improvements for ELF stubs.
|
||||||
|
* Defend against another flavor of corrupt PE header.
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
Changes in 3.07 (08 Sep 2010):
|
Changes in 3.07 (08 Sep 2010):
|
||||||
* win32/pe: fixed relocation handling for files with *no* TLS callbacks
|
* win32/pe: fixed relocation handling for files with *no* TLS callbacks
|
||||||
[severe bug introduced in 3.06]
|
[severe bug introduced in 3.06]
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2017 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
Here are some possible projects from which you can choose if you'd like to
|
Here are some possible projects from which you can choose if you'd like to
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2017 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -81,12 +81,7 @@ Please report all problems or suggestions to the authors. Thanks.
|
|||||||
THE FUTURE
|
THE FUTURE
|
||||||
==========
|
==========
|
||||||
|
|
||||||
- We'd really love to support handheld systems like the PalmPilot because
|
- AArch64 (64-bit ARM) for Linux and iOS.
|
||||||
compression makes a lot of sense here. And - because of the atari/tos
|
|
||||||
format - we already have a working decompressor in 68000 assembly.
|
|
||||||
Unfortunately we know next to nothing about the operating system
|
|
||||||
architecture of such handhelds, so we need some information from
|
|
||||||
an expert. Please contact us if you think you can help.
|
|
||||||
|
|
||||||
- The Linux approach could probably get ported to a lot of other Unix
|
- The Linux approach could probably get ported to a lot of other Unix
|
||||||
variants, at least for other i386 architectures it shouldn't be too
|
variants, at least for other i386 architectures it shouldn't be too
|
||||||
@@ -108,9 +103,9 @@ THE FUTURE
|
|||||||
COPYRIGHT
|
COPYRIGHT
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
|
|
||||||
This program may be used freely, and you are welcome to
|
This program may be used freely, and you are welcome to
|
||||||
redistribute it under certain conditions.
|
redistribute it under certain conditions.
|
||||||
@@ -125,12 +120,14 @@ with this program; see the file LICENSE. If not, visit the UPX home page.
|
|||||||
|
|
||||||
|
|
||||||
Share and enjoy,
|
Share and enjoy,
|
||||||
Markus & Laszlo
|
Markus & Laszlo & John
|
||||||
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
|
John F. Reiser
|
||||||
|
<jreiser@BitWagon.com>
|
||||||
|
|
||||||
|
|
||||||
[ The term UPX is a shorthand for the Ultimate Packer for eXecutables
|
[ The term UPX is a shorthand for the Ultimate Packer for eXecutables
|
||||||
|
|||||||
+3
-2
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2017 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
MAJOR NEWS IN UPX 3
|
MAJOR NEWS IN UPX 3
|
||||||
@@ -21,3 +21,4 @@ The main news since UPX 2 are:
|
|||||||
|
|
||||||
* better compression using the LZMA algorithm (option '--lzma')
|
* better compression using the LZMA algorithm (option '--lzma')
|
||||||
|
|
||||||
|
* better support for MacOS
|
||||||
|
|||||||
+11
-11
@@ -66,11 +66,16 @@ Prerequisites
|
|||||||
Tools needed to build/modify the UPX sources
|
Tools needed to build/modify the UPX sources
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
||||||
- A C++ compiler supporting inner classes, templates, exceptions
|
- A C++ compiler: gcc >= 3.3 or clang.
|
||||||
and RTTI.
|
|
||||||
|
|
||||||
- GNU make 3.81 or better
|
- GNU make 3.81 or better
|
||||||
|
|
||||||
|
- zlib and zlib-devel [or zlib-dev] software packages for your
|
||||||
|
host environment
|
||||||
|
|
||||||
|
- LZMA SDK from https://github.com/upx/upx-lzma-sdk
|
||||||
|
When using git run 'git submodule update --init --recursive'.
|
||||||
|
|
||||||
|
|
||||||
To compile the packer sources
|
To compile the packer sources
|
||||||
-----------------------------
|
-----------------------------
|
||||||
@@ -81,11 +86,6 @@ To compile the packer sources
|
|||||||
set UPX_UCLDIR=c:\src\ucl-1.03 (DOS / Windows)
|
set UPX_UCLDIR=c:\src\ucl-1.03 (DOS / Windows)
|
||||||
export UPX_UCLDIR=$HOME/local/src/ucl-1.03 (Unix)
|
export UPX_UCLDIR=$HOME/local/src/ucl-1.03 (Unix)
|
||||||
|
|
||||||
Set the environment variable UPX_LZMADIR to point to your
|
|
||||||
to your unpacked lzma443.tar.bz2 source directory, e.g.
|
|
||||||
|
|
||||||
export UPX_LZMADIR=$HOME/local/src/lzma-4.43 (Unix)
|
|
||||||
|
|
||||||
Finally type
|
Finally type
|
||||||
|
|
||||||
make
|
make
|
||||||
@@ -96,9 +96,9 @@ If you want to modify the stub sources you'll also need
|
|||||||
|
|
||||||
- Perl & Python
|
- Perl & Python
|
||||||
|
|
||||||
- A number of cross-assemblers and cross-compilers - precompiled
|
- upx-stubtools - a number of cross-assemblers and cross-compilers.
|
||||||
binaries for i386-linux hosts are available from
|
Precompiled binaries for i386-linux hosts are available from
|
||||||
http://sourceforge.net/projects/upx/files/upx-tools/20060823/
|
https://github.com/upx/upx-stubtools/releases
|
||||||
|
|
||||||
|
|
||||||
Misc. notes
|
Misc. notes
|
||||||
@@ -138,4 +138,4 @@ Patches/Contributions
|
|||||||
diff -uNr olddirectory newdirectory
|
diff -uNr olddirectory newdirectory
|
||||||
|
|
||||||
|
|
||||||
# vi:ts=4:et
|
# vim:set ts=4 sw=4 et:
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2017 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
.___.. .
|
.___.. .
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
UPX TODO list. Last updated 2006-12-08.
|
|
||||||
|
|
||||||
|
|
||||||
IMPORTANT PROBLEMS THAT SHOULD BE FIXED SOON:
|
|
||||||
|
|
||||||
- [None]
|
|
||||||
|
|
||||||
|
|
||||||
OTHER:
|
|
||||||
|
|
||||||
- docs: convert docs from upx.pod to use AsciiDoc
|
|
||||||
|
|
||||||
- check all <const_cast> to make sure they are not invalid
|
|
||||||
|
|
||||||
- throwNotCompressible() is not a real error, so make the output nicer
|
|
||||||
(info: bla bla). Also ui.cpp (total_*).
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
IMPROVED COMPRESSION RATIO
|
|
||||||
==========================
|
|
||||||
|
|
||||||
- experiment with new filters
|
|
||||||
|
|
||||||
- implement filters for dos/exe
|
|
||||||
|
|
||||||
- filters: could we exploit a f->firstcall info field ?
|
|
||||||
|
|
||||||
- for small programs (e.g. < 64k), try an additional algorithm
|
|
||||||
to see if it gives better compression
|
|
||||||
|
|
||||||
|
|
||||||
ALL FORMATS
|
|
||||||
===========
|
|
||||||
|
|
||||||
- more thoroughly test the exe-header in canPack()
|
|
||||||
and throw exceptions when encountering bad values.
|
|
||||||
|
|
||||||
- implement `--cpu=486' option to use bswap on the 32-bit formats
|
|
||||||
(if cpu >= 486)
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT DJGPP2/COFF
|
|
||||||
==================
|
|
||||||
|
|
||||||
- handle overlays
|
|
||||||
|
|
||||||
- fix default file extension handling when the --coff option is set
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT DOS/EXE
|
|
||||||
==============
|
|
||||||
|
|
||||||
- implement filters
|
|
||||||
|
|
||||||
- add a check so that we don't pack djgpp1 binaries
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT LINUX/386
|
|
||||||
================
|
|
||||||
|
|
||||||
- don't mmap() the temporary output file - this seems to improve
|
|
||||||
file io speed
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT TMT/ADAM
|
|
||||||
===============
|
|
||||||
|
|
||||||
- the decompressors are already aligned, no need for an
|
|
||||||
extra alignment
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT WATCOM/LE
|
|
||||||
================
|
|
||||||
|
|
||||||
- handle files without relocations
|
|
||||||
|
|
||||||
- the decompressors are already aligned, no need for an
|
|
||||||
extra alignment
|
|
||||||
|
|
||||||
- fix default file extension handling when the --le option is set
|
|
||||||
|
|
||||||
- handle holes in the file
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT WIN16/NE
|
|
||||||
===============
|
|
||||||
|
|
||||||
- implement readFileHeader() to correctly identify a win16/ne
|
|
||||||
executable, so that the call for contribution will get thrown
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT WIN32/PE
|
|
||||||
===============
|
|
||||||
|
|
||||||
- fix the section alignment with the Intel compiler
|
|
||||||
|
|
||||||
- decrease runtime memory overhead
|
|
||||||
|
|
||||||
3 - difficult) don't compress the BSS section and other holes.
|
|
||||||
|
|
||||||
4 - medium - ml) fix when objectalign < 0x1000
|
|
||||||
|
|
||||||
4 - easy - ml) put the original offset of moved resources somewhere into
|
|
||||||
the res.dir. (if it's safe to do)
|
|
||||||
|
|
||||||
4 - ??? - ml) fix FIXMEs
|
|
||||||
|
|
||||||
5 - medium - ml) try to put the preprocessed imports & relocs back to their
|
|
||||||
original section if possible. this could save some virtual memory
|
|
||||||
address space.
|
|
||||||
|
|
||||||
+1
-9
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# UPX doc Makefile - needs GNU make 3.80 or better
|
# UPX doc Makefile - needs GNU make 3.81 or better
|
||||||
#
|
#
|
||||||
|
|
||||||
MAKEFLAGS += -rR
|
MAKEFLAGS += -rR
|
||||||
@@ -12,14 +12,6 @@ empty :=
|
|||||||
space := $(empty) $(empty)
|
space := $(empty) $(empty)
|
||||||
tab := $(empty) $(empty)
|
tab := $(empty) $(empty)
|
||||||
|
|
||||||
# update $PATH for our special stub build tools
|
|
||||||
ifneq ($(wildcard $(HOME)/local/bin/bin-upx/.),)
|
|
||||||
export PATH := $(HOME)/local/bin/bin-upx:$(PATH)
|
|
||||||
endif
|
|
||||||
ifneq ($(wildcard $(HOME)/bin/bin-upx/.),)
|
|
||||||
export PATH := $(HOME)/bin/bin-upx:$(PATH)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# /***********************************************************************
|
# /***********************************************************************
|
||||||
# //
|
# //
|
||||||
|
|||||||
+16
-1
@@ -1,5 +1,5 @@
|
|||||||
Decompressing ELF Directly to Memory on Linux/x86
|
Decompressing ELF Directly to Memory on Linux/x86
|
||||||
Copyright (C) 2000-2010 John F. Reiser jreiser@BitWagon.com
|
Copyright (C) 2000-2017 John F. Reiser jreiser@BitWagon.com
|
||||||
|
|
||||||
References:
|
References:
|
||||||
<elf.h> definitions for the ELF file format
|
<elf.h> definitions for the ELF file format
|
||||||
@@ -76,6 +76,21 @@ and previous versions did this by default with no option. However,
|
|||||||
too much other software erroneously assumes that /proc/self/exe
|
too much other software erroneously assumes that /proc/self/exe
|
||||||
always exists.
|
always exists.
|
||||||
|
|
||||||
|
On arm*-linux-elf there is no good address at which to retain one
|
||||||
|
page of the compressed executable. Pages below the usual .p_vaddr
|
||||||
|
0x8000 (32KiB) are rejected by the kernel. Using a page above the
|
||||||
|
original uncompressed brk(0) would require placing the entire initial
|
||||||
|
compressed program above uncompressed brk(0), which would significantly
|
||||||
|
increase the running brk(0); but too many programs break if brk(0)
|
||||||
|
moves. Thus on arm*-linux-elf the compressed executable begins
|
||||||
|
with 0x8000==.p_vaddr, all pages mapped by execve() that are also
|
||||||
|
occupied by decompressed bytes are removed before overwriting, and
|
||||||
|
/proc/self/exe becomes a "(deleted)" symlink. It might be possible
|
||||||
|
to preserve /proc/self/exe if the original uncompressed executable
|
||||||
|
were created with 0x9000==.p_vaddr (one page higher than the usual
|
||||||
|
0x8000) so that the compressed page mapped at 0x8000 would linger.
|
||||||
|
[This has not been tested.]
|
||||||
|
|
||||||
Linux stores the pathname argument that was specified to execve()
|
Linux stores the pathname argument that was specified to execve()
|
||||||
immediately after the '\0' which terminates the character string of the
|
immediately after the '\0' which terminates the character string of the
|
||||||
last environment variable [as of execve()]. This is true for at least
|
last environment variable [as of execve()]. This is true for at least
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ code 127, and a record will be added to the history file
|
|||||||
|
|
||||||
In "targeted enforcing" mode, SELinux pays close attention mostly to
|
In "targeted enforcing" mode, SELinux pays close attention mostly to
|
||||||
designated processes that run with elevated privileges: web server,
|
designated processes that run with elevated privileges: web server,
|
||||||
print server, login server, etc. Ordinary user excutables receive
|
print server, login server, etc. Ordinary user executables receive
|
||||||
much less scrutiny. However, one of the eventual goals of SELinux is to
|
much less scrutiny. However, one of the eventual goals of SELinux is to
|
||||||
eradicate runtime generation of instructions because of the possibility
|
eradicate runtime generation of instructions because of the possibility
|
||||||
for exploitation by malware (virus, trojan, key logger, privilege
|
for exploitation by malware (virus, trojan, key logger, privilege
|
||||||
|
|||||||
+7
-6
@@ -13,7 +13,7 @@ B<upx> S<[ I<command> ]> S<[ I<options> ]> I<filename>...
|
|||||||
=head1 ABSTRACT
|
=head1 ABSTRACT
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2017 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
@@ -78,6 +78,7 @@ B<UPX> is a versatile executable packer with the following features:
|
|||||||
* vmlinux/386
|
* vmlinux/386
|
||||||
* watcom/le (supporting DOS4G, PMODE/W, DOS32a and CauseWay)
|
* watcom/le (supporting DOS4G, PMODE/W, DOS32a and CauseWay)
|
||||||
* win32/pe (exe and dll)
|
* win32/pe (exe and dll)
|
||||||
|
* win64/pe (exe and dll)
|
||||||
* arm/pe (exe and dll)
|
* arm/pe (exe and dll)
|
||||||
* linux/elfamd64
|
* linux/elfamd64
|
||||||
* linux/elfppc32
|
* linux/elfppc32
|
||||||
@@ -923,7 +924,7 @@ Please report all bugs immediately to the authors.
|
|||||||
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||||
http://www.oberhumer.com
|
http://www.oberhumer.com
|
||||||
|
|
||||||
Laszlo Molnar <ml1050@users.sourceforge.net>
|
Laszlo Molnar <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser <jreiser@BitWagon.com>
|
John F. Reiser <jreiser@BitWagon.com>
|
||||||
|
|
||||||
@@ -933,13 +934,13 @@ Please report all bugs immediately to the authors.
|
|||||||
|
|
||||||
=head1 COPYRIGHT
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
|
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
|
|
||||||
Copyright (C) 2002-2010 Jens Medoch
|
Copyright (C) 2002-2017 Jens Medoch
|
||||||
|
|
||||||
This program may be used freely, and you are welcome to
|
This program may be used freely, and you are welcome to
|
||||||
redistribute it under certain conditions.
|
redistribute it under certain conditions.
|
||||||
|
|||||||
+117
-57
@@ -1,50 +1,35 @@
|
|||||||
#
|
#
|
||||||
# UPX Makefile - needs GNU make 3.81 or better
|
# UPX Makefile - needs GNU make 3.81 or better
|
||||||
#
|
#
|
||||||
# Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
#
|
#
|
||||||
|
|
||||||
MAKEFLAGS += -rR
|
# build configuration options for this Makefile
|
||||||
|
BUILD_TYPE_DEBUG ?= 0
|
||||||
|
BUILD_TYPE_SANITIZE ?= 0
|
||||||
|
BUILD_USE_DEPEND ?= 1
|
||||||
|
|
||||||
|
MAKEFLAGS += -r
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
export SHELL = /bin/sh
|
export SHELL = /bin/sh
|
||||||
override e = $($1) $(EXTRA_$1) $(upx_$1) $($(basename $(notdir $@)).$1)
|
override ee = $($1) $(EXTRA_$1) $(upx_$1) $(upx_EXTRA_$1) $($(basename $(notdir $@)).$1)
|
||||||
|
|
||||||
ifneq ($(findstring $(firstword $(MAKE_VERSION)),3.77 3.78 3.78.1 3.79 3.79.1 3.80),)
|
|
||||||
$(error GNU make 3.81 or better is required)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef srcdir
|
ifndef srcdir
|
||||||
srcdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
|
srcdir := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||||
srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,')
|
srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,' || echo 'ERROR')
|
||||||
endif
|
endif
|
||||||
ifndef top_srcdir
|
ifndef top_srcdir
|
||||||
top_srcdir := $(srcdir)/..
|
top_srcdir := $(srcdir)/..
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
||||||
ifneq ($(srcdir),.)
|
ifneq ($(srcdir),.)
|
||||||
##$(info Info: using VPATH . $(srcdir))
|
vpath %.cpp .:$(srcdir)
|
||||||
VPATH := . $(srcdir)
|
vpath %.h .:$(srcdir)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CXX),)
|
# toolchain
|
||||||
CXX = g++
|
CXX ?= g++
|
||||||
endif
|
CXXLD = $(CXX)
|
||||||
ifneq ($(findstring $(firstword $(CXX)),g++),)
|
|
||||||
USE_GNUC ?= 1
|
|
||||||
endif
|
|
||||||
ifeq ($(USE_GNUC),1)
|
|
||||||
ifeq ($(DEBUG),1)
|
|
||||||
CXXFLAGS += -O0 -g
|
|
||||||
else
|
|
||||||
CXXFLAGS += -O2
|
|
||||||
endif
|
|
||||||
CXXFLAGS_WERROR = -Werror
|
|
||||||
CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wpointer-arith -Wshadow -Wwrite-strings
|
|
||||||
CXXFLAGS += $(CXXFLAGS_WERROR)
|
|
||||||
endif
|
|
||||||
CPPFLAGS += $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
|
|
||||||
CXXLD ?= $(CXX)
|
|
||||||
|
|
||||||
exeext ?= .out
|
exeext ?= .out
|
||||||
libext ?= .a
|
libext ?= .a
|
||||||
objext ?= .o
|
objext ?= .o
|
||||||
@@ -52,56 +37,89 @@ objext ?= .o
|
|||||||
upx_SOURCES := $(sort $(wildcard $(srcdir)/*.cpp))
|
upx_SOURCES := $(sort $(wildcard $(srcdir)/*.cpp))
|
||||||
upx_OBJECTS := $(notdir $(upx_SOURCES:.cpp=$(objext)))
|
upx_OBJECTS := $(notdir $(upx_SOURCES:.cpp=$(objext)))
|
||||||
|
|
||||||
|
ifneq ($(wildcard $(top_srcdir)/.git/.),)
|
||||||
|
UPX_VERSION_GITREV := $(strip $(shell cd '$(top_srcdir)' && git rev-parse --short=12 HEAD || echo 'ERROR'))
|
||||||
|
ifneq ($(UPX_VERSION_GITREV),)
|
||||||
|
GITREV_PLUS := $(strip $(shell cd '$(top_srcdir)' && git diff --exit-code HEAD >/dev/null && echo '' || echo '+'))
|
||||||
|
DEFS += '-DUPX_VERSION_GITREV="$(UPX_VERSION_GITREV)$(GITREV_PLUS)"'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# we need UCL and zlib - you can set envvar UPX_UCLDIR
|
# we need UCL and zlib - you can set envvar UPX_UCLDIR
|
||||||
ifneq ($(wildcard $(UPX_UCLDIR)/include/ucl/ucl.h),)
|
ifneq ($(wildcard $(UPX_UCLDIR)/include/ucl/ucl.h),)
|
||||||
INCLUDES += -I$(UPX_UCLDIR)/include
|
INCLUDES += -I$(UPX_UCLDIR)/include
|
||||||
LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext))))
|
LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext))))
|
||||||
endif
|
endif
|
||||||
LIBS += -lucl -lz
|
LIBS += -lucl -lz
|
||||||
# you should set envvar UPX_LZMADIR to point to your unpacked LZMA SDK
|
# LZMA from https://github.com/upx/upx-lzma-sdk
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
|
||||||
DEFS += -DWITH_LZMA=$(UPX_LZMA_VERSION)
|
CPPFLAGS += $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
|
||||||
INCLUDES += -I$(UPX_LZMADIR)
|
ifeq ($(BUILD_TYPE_DEBUG),1)
|
||||||
|
CXXFLAGS_OPTIMIZE ?= -O0 -g
|
||||||
|
else
|
||||||
|
CXXFLAGS_OPTIMIZE ?= -O2
|
||||||
|
endif
|
||||||
|
CXXFLAGS += $(CXXFLAGS_OPTIMIZE)
|
||||||
|
# protect against security threats caused by misguided C++ compiler "optimizations"
|
||||||
|
ifeq ($(findstring clang,$(CXX)),)
|
||||||
|
CXXFLAGS += -fno-delete-null-pointer-checks
|
||||||
|
endif
|
||||||
|
CXXFLAGS += -fno-strict-aliasing -fwrapv
|
||||||
|
CXXFLAGS += -funsigned-char
|
||||||
|
CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings
|
||||||
|
CXXFLAGS_WERROR ?= -Werror
|
||||||
|
CXXFLAGS += $(CXXFLAGS_WERROR)
|
||||||
|
|
||||||
|
ifeq ($(BUILD_TYPE_SANITIZE),1)
|
||||||
|
CXXFLAGS_SANITIZE ?= -fsanitize=address,undefined -fno-omit-frame-pointer -DACC_CFG_NO_UNALIGNED
|
||||||
|
CXXFLAGS += $(CXXFLAGS_SANITIZE)
|
||||||
|
# these are the only 2 objects that are actually speed-sensitive
|
||||||
|
compress_lzma$(objext) filteri$(objext) : override CXXFLAGS_SANITIZE =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# rules
|
||||||
all: upx$(exeext) | .depend
|
all: upx$(exeext) | ./.depend
|
||||||
.DELETE_ON_ERROR: upx$(exeext) $(upx_OBJECTS) .depend
|
.DELETE_ON_ERROR: upx$(exeext) $(upx_OBJECTS) ./.depend
|
||||||
|
|
||||||
upx$(exeext): $(upx_OBJECTS) $(upx_DEPENDENCIES)
|
upx$(exeext): $(upx_OBJECTS) $(upx_DEPENDENCIES)
|
||||||
$($(notdir $@).PRE_LINK_STEP)
|
$($(notdir $@).PRE_LINK_STEP)
|
||||||
$(strip $(CXXLD) $(call e,CPPFLAGS) $(call e,CXXFLAGS) $(call e,LDFLAGS) -o $@ $(upx_OBJECTS) $(call e,LDADD) $(call e,LIBS))
|
$(strip $(CXXLD) $(call ee,CXXFLAGS) $(call ee,LDFLAGS) -o $@ $(upx_OBJECTS) $(call ee,LDADD) $(call ee,LIBS))
|
||||||
$($(notdir $@).POST_LINK_STEP)
|
$($(notdir $@).POST_LINK_STEP)
|
||||||
|
$(CHECK_WHITESPACE)
|
||||||
|
|
||||||
%.o : %.cpp | .depend
|
%.o : %.cpp | ./.depend
|
||||||
$(strip $(CXX) $(call e,CPPFLAGS) $(call e,CXXFLAGS) -o $@ -c $<)
|
$(strip $(CXX) $(call ee,CPPFLAGS) $(call ee,CXXFLAGS) -o $@ -c $<)
|
||||||
|
%.cpp.ii : %.cpp
|
||||||
|
$(strip $(CXX) $(call ee,CPPFLAGS) $(call ee,CXXFLAGS) -o $@ -E $<)
|
||||||
|
|
||||||
.depend: $(sort $(wildcard $(srcdir)/*.cpp $(srcdir)/*.h)) $(MAKEFILE_LIST)
|
ifeq ($(BUILD_USE_DEPEND),1)
|
||||||
|
./.depend: $(sort $(wildcard $(srcdir)/*.cpp $(srcdir)/*.h)) $(MAKEFILE_LIST)
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
ifeq ($(USE_GNUC),1)
|
|
||||||
@echo "Updating $@"
|
@echo "Updating $@"
|
||||||
@$(strip $(CXX) $(call e,CPPFLAGS) -MM) $(filter %.cpp,$^) > $@
|
@$(strip $(CXX) $(call ee,CPPFLAGS) $(call ee,CXXFLAGS) -MM) $(filter %.cpp,$^) > $@
|
||||||
else
|
else
|
||||||
touch $@
|
./.depend:
|
||||||
|
.PHONY: ./.depend
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CHECK_WHITESPACE =
|
||||||
ifeq ($(USE_GNUC),1)
|
ifeq ($(shell uname),Linux)
|
||||||
##compress_lzma$(objext) : CXXFLAGS += -O3 -fomit-frame-pointer
|
CHECK_WHITESPACE = $(top_srcdir)/src/stub/scripts/check_whitespace.sh $(top_srcdir)
|
||||||
compress_lzma$(objext) : CXXFLAGS += -Wno-cast-qual
|
ifneq ($(wildcard $(top_srcdir)/.git/.),)
|
||||||
compress_lzma$(objext) : CXXFLAGS += -Wno-shadow
|
CHECK_WHITESPACE = $(top_srcdir)/src/stub/scripts/check_whitespace_git.sh $(top_srcdir)
|
||||||
ifeq ($(UPX_LZMA_VERSION),0x443)
|
|
||||||
compress_lzma$(objext) : CXXFLAGS += -Wno-non-virtual-dtor
|
|
||||||
compress_lzma$(objext) : CXXFLAGS += -Wno-unused
|
|
||||||
endif
|
endif
|
||||||
# needed for gcc-4.3:
|
check-whitespace : ; $(CHECK_WHITESPACE)
|
||||||
compress_lzma$(objext) : CXXFLAGS += -Wno-error
|
|
||||||
endif
|
endif
|
||||||
|
.PHONY: check-whitespace
|
||||||
|
|
||||||
mostlyclean clean distclean maintainer-clean:
|
mostlyclean clean distclean maintainer-clean:
|
||||||
rm -f *.d *.map *.o *.obj *.res .depend upx.exe upx.out upx.ttp upx$(exeext)
|
rm -f *.d *.ii *.map *.o *.obj *.res ./.depend upx.exe upx.out upx.ttp upx$(exeext)
|
||||||
|
|
||||||
|
./.depend compress_lzma$(objext) : INCLUDES += -I$(UPX_LZMADIR)
|
||||||
|
|
||||||
|
compress_lzma$(objext) : CXXFLAGS += -Wno-shadow
|
||||||
|
p_mach$(objext) : CXXFLAGS += -Wno-cast-align
|
||||||
|
|
||||||
.PHONY: all mostlyclean clean distclean maintainer-clean
|
.PHONY: all mostlyclean clean distclean maintainer-clean
|
||||||
|
|
||||||
@@ -109,6 +127,48 @@ ifeq ($(MAKECMDGOALS),mostlyclean)
|
|||||||
else ifeq ($(MAKECMDGOALS),clean)
|
else ifeq ($(MAKECMDGOALS),clean)
|
||||||
else ifeq ($(MAKECMDGOALS),distclean)
|
else ifeq ($(MAKECMDGOALS),distclean)
|
||||||
else ifeq ($(MAKECMDGOALS),maintainer-clean)
|
else ifeq ($(MAKECMDGOALS),maintainer-clean)
|
||||||
|
else ifeq ($(MAKECMDGOALS),clang-format)
|
||||||
|
else ifeq ($(MAKECMDGOALS),check-whitespace)
|
||||||
else
|
else
|
||||||
-include .depend
|
ifeq ($(BUILD_USE_DEPEND),1)
|
||||||
|
-include ./.depend
|
||||||
endif
|
endif
|
||||||
|
help$(objext): $(MAKEFILE_LIST)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# "make run-testsuite"
|
||||||
|
# search for the UPX testsuite -- git clone https://github.com/upx/upx-testsuite.git
|
||||||
|
# you also can override upx_testsuite_SRCDIR
|
||||||
|
ifndef upx_testsuite_SRCDIR
|
||||||
|
# search standard locations below $(top_srcdir)
|
||||||
|
ifneq ($(wildcard $(top_srcdir)/../upx-testsuite.git/files/packed/.),)
|
||||||
|
upx_testsuite_SRCDIR := $(top_srcdir)/../upx-testsuite.git
|
||||||
|
else ifneq ($(wildcard $(top_srcdir)/../upx-testsuite/files/packed/.),)
|
||||||
|
upx_testsuite_SRCDIR := $(top_srcdir)/../upx-testsuite
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
# run the UPX testsuite
|
||||||
|
ifneq ($(wildcard $(upx_testsuite_SRCDIR)/files/packed/.),)
|
||||||
|
ifneq ($(wildcard $(top_srcdir)/.github/travis_testsuite_1.sh),)
|
||||||
|
run-testsuite: export upx_exe := ./upx$(exeext)
|
||||||
|
run-testsuite: export upx_testsuite_SRCDIR := $(upx_testsuite_SRCDIR)
|
||||||
|
run-testsuite: export upx_testsuite_BUILDDIR := ./tmp-testsuite
|
||||||
|
run-testsuite: ./upx$(exeext)
|
||||||
|
time -p bash $(top_srcdir)/.github/travis_testsuite_1.sh
|
||||||
|
.PHONY: run-testsuite
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# automatically format some C++ source code files
|
||||||
|
ifeq ($(shell uname),Linux)
|
||||||
|
CLANG_FORMAT_FILES += linker.cpp linker.h packhead.cpp
|
||||||
|
CLANG_FORMAT_FILES += s_djgpp2.cpp s_object.cpp s_vcsa.cpp s_win32.cpp screen.h
|
||||||
|
CLANG_FORMAT_FILES += snprintf.cpp
|
||||||
|
CLANG_FORMAT_FILES += stdcxx.cpp stdcxx.h
|
||||||
|
CLANG_FORMAT_FILES += ui.cpp ui.h util.h
|
||||||
|
clang-format:
|
||||||
|
$(top_srcdir)/src/stub/scripts/upx-clang-format -i $(addprefix $(top_srcdir)/src/,$(CLANG_FORMAT_FILES))
|
||||||
|
.PHONY: clang-format
|
||||||
|
endif
|
||||||
|
|
||||||
|
# vim:set ts=8 sw=8 noet:
|
||||||
|
|||||||
+53
-111
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ inline void set_be32(void *p, unsigned v)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline acc_uint64l_t get_be64(const void *p)
|
inline upx_uint64_t get_be64(const void *p)
|
||||||
{
|
{
|
||||||
#if defined(ACC_UA_GET_BE64)
|
#if defined(ACC_UA_GET_BE64)
|
||||||
return ACC_UA_GET_BE64(p);
|
return ACC_UA_GET_BE64(p);
|
||||||
@@ -97,7 +97,7 @@ inline acc_uint64l_t get_be64(const void *p)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void set_be64(void *p, acc_uint64l_t v)
|
inline void set_be64(void *p, upx_uint64_t v)
|
||||||
{
|
{
|
||||||
#if defined(ACC_UA_SET_BE64)
|
#if defined(ACC_UA_SET_BE64)
|
||||||
ACC_UA_SET_BE64(p, v);
|
ACC_UA_SET_BE64(p, v);
|
||||||
@@ -160,7 +160,7 @@ inline void set_le32(void *p, unsigned v)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline acc_uint64l_t get_le64(const void *p)
|
inline upx_uint64_t get_le64(const void *p)
|
||||||
{
|
{
|
||||||
#if defined(ACC_UA_GET_LE64)
|
#if defined(ACC_UA_GET_LE64)
|
||||||
return ACC_UA_GET_LE64(p);
|
return ACC_UA_GET_LE64(p);
|
||||||
@@ -169,7 +169,7 @@ inline acc_uint64l_t get_le64(const void *p)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void set_le64(void *p, acc_uint64l_t v)
|
inline void set_le64(void *p, upx_uint64_t v)
|
||||||
{
|
{
|
||||||
#if defined(ACC_UA_SET_LE64)
|
#if defined(ACC_UA_SET_LE64)
|
||||||
ACC_UA_SET_LE64(p, v);
|
ACC_UA_SET_LE64(p, v);
|
||||||
@@ -187,18 +187,16 @@ inline int sign_extend(unsigned v, unsigned bits)
|
|||||||
{
|
{
|
||||||
const unsigned sign_bit = 1u << (bits - 1);
|
const unsigned sign_bit = 1u << (bits - 1);
|
||||||
v &= sign_bit | (sign_bit - 1);
|
v &= sign_bit | (sign_bit - 1);
|
||||||
//v = (v ^ sign_bit) - sign_bit;
|
|
||||||
v |= 0 - (v & sign_bit);
|
v |= 0 - (v & sign_bit);
|
||||||
return (int) v;
|
return ACC_ICAST(int, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline acc_int64l_t sign_extend(acc_uint64l_t v, unsigned bits)
|
inline upx_int64_t sign_extend(upx_uint64_t v, unsigned bits)
|
||||||
{
|
{
|
||||||
const acc_uint64l_t sign_bit = ACC_UINT64_C(1) << (bits - 1);
|
const upx_uint64_t sign_bit = UPX_UINT64_C(1) << (bits - 1);
|
||||||
v &= sign_bit | (sign_bit - 1);
|
v &= sign_bit | (sign_bit - 1);
|
||||||
//v = (v ^ sign_bit) - sign_bit;
|
|
||||||
v |= 0 - (v & sign_bit);
|
v |= 0 - (v & sign_bit);
|
||||||
return (acc_int64l_t) v;
|
return ACC_ICAST(upx_int64_t, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int get_be16_signed(const void *p)
|
inline int get_be16_signed(const void *p)
|
||||||
@@ -219,9 +217,9 @@ inline int get_be32_signed(const void *p)
|
|||||||
return sign_extend(v, 32);
|
return sign_extend(v, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline acc_int64l_t get_be64_signed(const void *p)
|
inline upx_int64_t get_be64_signed(const void *p)
|
||||||
{
|
{
|
||||||
acc_uint64l_t v = get_be64(p);
|
upx_uint64_t v = get_be64(p);
|
||||||
return sign_extend(v, 64);
|
return sign_extend(v, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,9 +241,9 @@ inline int get_le32_signed(const void *p)
|
|||||||
return sign_extend(v, 32);
|
return sign_extend(v, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline acc_int64l_t get_le64_signed(const void *p)
|
inline upx_int64_t get_le64_signed(const void *p)
|
||||||
{
|
{
|
||||||
acc_uint64l_t v = get_le64(p);
|
upx_uint64_t v = get_le64(p);
|
||||||
return sign_extend(v, 64);
|
return sign_extend(v, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,25 +267,25 @@ inline unsigned acc_swab32(unsigned v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline unsigned acc_swab16p(const acc_uint16e_t *p)
|
inline unsigned acc_swab16p(const upx_uint16_t *p)
|
||||||
{
|
{
|
||||||
return acc_swab16(*p);
|
return acc_swab16(*p);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned acc_swap32p(const acc_uint32e_t *p)
|
inline unsigned acc_swap32p(const upx_uint32_t *p)
|
||||||
{
|
{
|
||||||
return acc_swab32(*p);
|
return acc_swab32(*p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void acc_swab16s(acc_uint16e_t *p)
|
inline void acc_swab16s(upx_uint16_t *p)
|
||||||
{
|
{
|
||||||
*p = (acc_uint16e_t) acc_swab16(*p);
|
*p = ACC_ICONV(upx_uint16_t, acc_swab16(*p));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void acc_swab32s(acc_uint32e_t *p)
|
inline void acc_swab32s(upx_uint32_t *p)
|
||||||
{
|
{
|
||||||
*p = (acc_uint32e_t) acc_swab32(*p);
|
*p = ACC_ICONV(upx_uint32_t, acc_swab32(*p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -316,9 +314,6 @@ inline void acc_ua_swab32s(void *p)
|
|||||||
__packed_struct(BE16)
|
__packed_struct(BE16)
|
||||||
unsigned char d[2];
|
unsigned char d[2];
|
||||||
|
|
||||||
//inline BE16() { }
|
|
||||||
//BE16(unsigned v) { set_be16(d, v); }
|
|
||||||
|
|
||||||
BE16& operator = (unsigned v) { set_be16(d, v); return *this; }
|
BE16& operator = (unsigned v) { set_be16(d, v); return *this; }
|
||||||
BE16& operator += (unsigned v) { set_be16(d, get_be16(d) + v); return *this; }
|
BE16& operator += (unsigned v) { set_be16(d, get_be16(d) + v); return *this; }
|
||||||
BE16& operator -= (unsigned v) { set_be16(d, get_be16(d) - v); return *this; }
|
BE16& operator -= (unsigned v) { set_be16(d, get_be16(d) - v); return *this; }
|
||||||
@@ -330,16 +325,13 @@ __packed_struct(BE16)
|
|||||||
BE16& operator <<= (unsigned v) { set_be16(d, get_be16(d) << v); return *this; }
|
BE16& operator <<= (unsigned v) { set_be16(d, get_be16(d) << v); return *this; }
|
||||||
BE16& operator >>= (unsigned v) { set_be16(d, get_be16(d) >> v); return *this; }
|
BE16& operator >>= (unsigned v) { set_be16(d, get_be16(d) >> v); return *this; }
|
||||||
|
|
||||||
operator unsigned () const { return get_be16(d); }
|
operator unsigned () const { return get_be16(d); }
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
|
||||||
__packed_struct(BE32)
|
__packed_struct(BE32)
|
||||||
unsigned char d[4];
|
unsigned char d[4];
|
||||||
|
|
||||||
//inline BE32() { }
|
|
||||||
//BE32(unsigned v) { set_be32(d, v); }
|
|
||||||
|
|
||||||
BE32& operator = (unsigned v) { set_be32(d, v); return *this; }
|
BE32& operator = (unsigned v) { set_be32(d, v); return *this; }
|
||||||
BE32& operator += (unsigned v) { set_be32(d, get_be32(d) + v); return *this; }
|
BE32& operator += (unsigned v) { set_be32(d, get_be32(d) + v); return *this; }
|
||||||
BE32& operator -= (unsigned v) { set_be32(d, get_be32(d) - v); return *this; }
|
BE32& operator -= (unsigned v) { set_be32(d, get_be32(d) - v); return *this; }
|
||||||
@@ -351,37 +343,31 @@ __packed_struct(BE32)
|
|||||||
BE32& operator <<= (unsigned v) { set_be32(d, get_be32(d) << v); return *this; }
|
BE32& operator <<= (unsigned v) { set_be32(d, get_be32(d) << v); return *this; }
|
||||||
BE32& operator >>= (unsigned v) { set_be32(d, get_be32(d) >> v); return *this; }
|
BE32& operator >>= (unsigned v) { set_be32(d, get_be32(d) >> v); return *this; }
|
||||||
|
|
||||||
operator unsigned () const { return get_be32(d); }
|
operator unsigned () const { return get_be32(d); }
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
|
||||||
__packed_struct(BE64)
|
__packed_struct(BE64)
|
||||||
unsigned char d[8];
|
unsigned char d[8];
|
||||||
|
|
||||||
//inline BE64() { }
|
BE64& operator = (upx_uint64_t v) { set_be64(d, v); return *this; }
|
||||||
//BE64(acc_uint64l_t v) { set_be64(d, v); }
|
BE64& operator += (upx_uint64_t v) { set_be64(d, get_be64(d) + v); return *this; }
|
||||||
|
BE64& operator -= (upx_uint64_t v) { set_be64(d, get_be64(d) - v); return *this; }
|
||||||
BE64& operator = (acc_uint64l_t v) { set_be64(d, v); return *this; }
|
BE64& operator *= (upx_uint64_t v) { set_be64(d, get_be64(d) * v); return *this; }
|
||||||
BE64& operator += (acc_uint64l_t v) { set_be64(d, get_be64(d) + v); return *this; }
|
BE64& operator /= (upx_uint64_t v) { set_be64(d, get_be64(d) / v); return *this; }
|
||||||
BE64& operator -= (acc_uint64l_t v) { set_be64(d, get_be64(d) - v); return *this; }
|
BE64& operator &= (upx_uint64_t v) { set_be64(d, get_be64(d) & v); return *this; }
|
||||||
BE64& operator *= (acc_uint64l_t v) { set_be64(d, get_be64(d) * v); return *this; }
|
BE64& operator |= (upx_uint64_t v) { set_be64(d, get_be64(d) | v); return *this; }
|
||||||
BE64& operator /= (acc_uint64l_t v) { set_be64(d, get_be64(d) / v); return *this; }
|
BE64& operator ^= (upx_uint64_t v) { set_be64(d, get_be64(d) ^ v); return *this; }
|
||||||
BE64& operator &= (acc_uint64l_t v) { set_be64(d, get_be64(d) & v); return *this; }
|
|
||||||
BE64& operator |= (acc_uint64l_t v) { set_be64(d, get_be64(d) | v); return *this; }
|
|
||||||
BE64& operator ^= (acc_uint64l_t v) { set_be64(d, get_be64(d) ^ v); return *this; }
|
|
||||||
BE64& operator <<= (unsigned v) { set_be64(d, get_be64(d) << v); return *this; }
|
BE64& operator <<= (unsigned v) { set_be64(d, get_be64(d) << v); return *this; }
|
||||||
BE64& operator >>= (unsigned v) { set_be64(d, get_be64(d) >> v); return *this; }
|
BE64& operator >>= (unsigned v) { set_be64(d, get_be64(d) >> v); return *this; }
|
||||||
|
|
||||||
operator acc_uint64l_t () const { return get_be64(d); }
|
operator upx_uint64_t () const { return get_be64(d); }
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
|
||||||
__packed_struct(LE16)
|
__packed_struct(LE16)
|
||||||
unsigned char d[2];
|
unsigned char d[2];
|
||||||
|
|
||||||
//inline LE16() { }
|
|
||||||
//LE16(unsigned v) { set_le16(d, v); }
|
|
||||||
|
|
||||||
LE16& operator = (unsigned v) { set_le16(d, v); return *this; }
|
LE16& operator = (unsigned v) { set_le16(d, v); return *this; }
|
||||||
LE16& operator += (unsigned v) { set_le16(d, get_le16(d) + v); return *this; }
|
LE16& operator += (unsigned v) { set_le16(d, get_le16(d) + v); return *this; }
|
||||||
LE16& operator -= (unsigned v) { set_le16(d, get_le16(d) - v); return *this; }
|
LE16& operator -= (unsigned v) { set_le16(d, get_le16(d) - v); return *this; }
|
||||||
@@ -393,16 +379,13 @@ __packed_struct(LE16)
|
|||||||
LE16& operator <<= (unsigned v) { set_le16(d, get_le16(d) << v); return *this; }
|
LE16& operator <<= (unsigned v) { set_le16(d, get_le16(d) << v); return *this; }
|
||||||
LE16& operator >>= (unsigned v) { set_le16(d, get_le16(d) >> v); return *this; }
|
LE16& operator >>= (unsigned v) { set_le16(d, get_le16(d) >> v); return *this; }
|
||||||
|
|
||||||
operator unsigned () const { return get_le16(d); }
|
operator unsigned () const { return get_le16(d); }
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
|
||||||
__packed_struct(LE32)
|
__packed_struct(LE32)
|
||||||
unsigned char d[4];
|
unsigned char d[4];
|
||||||
|
|
||||||
//inline LE32() { }
|
|
||||||
//LE32(unsigned v) { set_le32(d, v); }
|
|
||||||
|
|
||||||
LE32& operator = (unsigned v) { set_le32(d, v); return *this; }
|
LE32& operator = (unsigned v) { set_le32(d, v); return *this; }
|
||||||
LE32& operator += (unsigned v) { set_le32(d, get_le32(d) + v); return *this; }
|
LE32& operator += (unsigned v) { set_le32(d, get_le32(d) + v); return *this; }
|
||||||
LE32& operator -= (unsigned v) { set_le32(d, get_le32(d) - v); return *this; }
|
LE32& operator -= (unsigned v) { set_le32(d, get_le32(d) - v); return *this; }
|
||||||
@@ -414,28 +397,25 @@ __packed_struct(LE32)
|
|||||||
LE32& operator <<= (unsigned v) { set_le32(d, get_le32(d) << v); return *this; }
|
LE32& operator <<= (unsigned v) { set_le32(d, get_le32(d) << v); return *this; }
|
||||||
LE32& operator >>= (unsigned v) { set_le32(d, get_le32(d) >> v); return *this; }
|
LE32& operator >>= (unsigned v) { set_le32(d, get_le32(d) >> v); return *this; }
|
||||||
|
|
||||||
operator unsigned () const { return get_le32(d); }
|
operator unsigned () const { return get_le32(d); }
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
|
||||||
__packed_struct(LE64)
|
__packed_struct(LE64)
|
||||||
unsigned char d[8];
|
unsigned char d[8];
|
||||||
|
|
||||||
//inline LE64() { }
|
LE64& operator = (upx_uint64_t v) { set_le64(d, v); return *this; }
|
||||||
//LE64(acc_uint64l_t v) { set_le64(d, v); }
|
LE64& operator += (upx_uint64_t v) { set_le64(d, get_le64(d) + v); return *this; }
|
||||||
|
LE64& operator -= (upx_uint64_t v) { set_le64(d, get_le64(d) - v); return *this; }
|
||||||
LE64& operator = (acc_uint64l_t v) { set_le64(d, v); return *this; }
|
LE64& operator *= (upx_uint64_t v) { set_le64(d, get_le64(d) * v); return *this; }
|
||||||
LE64& operator += (acc_uint64l_t v) { set_le64(d, get_le64(d) + v); return *this; }
|
LE64& operator /= (upx_uint64_t v) { set_le64(d, get_le64(d) / v); return *this; }
|
||||||
LE64& operator -= (acc_uint64l_t v) { set_le64(d, get_le64(d) - v); return *this; }
|
LE64& operator &= (upx_uint64_t v) { set_le64(d, get_le64(d) & v); return *this; }
|
||||||
LE64& operator *= (acc_uint64l_t v) { set_le64(d, get_le64(d) * v); return *this; }
|
LE64& operator |= (upx_uint64_t v) { set_le64(d, get_le64(d) | v); return *this; }
|
||||||
LE64& operator /= (acc_uint64l_t v) { set_le64(d, get_le64(d) / v); return *this; }
|
LE64& operator ^= (upx_uint64_t v) { set_le64(d, get_le64(d) ^ v); return *this; }
|
||||||
LE64& operator &= (acc_uint64l_t v) { set_le64(d, get_le64(d) & v); return *this; }
|
|
||||||
LE64& operator |= (acc_uint64l_t v) { set_le64(d, get_le64(d) | v); return *this; }
|
|
||||||
LE64& operator ^= (acc_uint64l_t v) { set_le64(d, get_le64(d) ^ v); return *this; }
|
|
||||||
LE64& operator <<= (unsigned v) { set_le64(d, get_le64(d) << v); return *this; }
|
LE64& operator <<= (unsigned v) { set_le64(d, get_le64(d) << v); return *this; }
|
||||||
LE64& operator >>= (unsigned v) { set_le64(d, get_le64(d) >> v); return *this; }
|
LE64& operator >>= (unsigned v) { set_le64(d, get_le64(d) >> v); return *this; }
|
||||||
|
|
||||||
operator acc_uint64l_t () const { return get_le64(d); }
|
operator upx_uint64_t () const { return get_le64(d); }
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
|
||||||
@@ -486,15 +466,16 @@ template <class T> T* operator - (T* ptr, const LE64& v);
|
|||||||
// global overloads
|
// global overloads
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if 1 && !defined(ALIGN_DOWN)
|
inline unsigned ALIGN_DOWN(unsigned a, const BE32& b) { return ALIGN_DOWN(a, (unsigned) b); }
|
||||||
|
inline unsigned ALIGN_DOWN(const BE32& a, unsigned b) { return ALIGN_DOWN((unsigned) a, b); }
|
||||||
|
inline unsigned ALIGN_UP (unsigned a, const BE32& b) { return ALIGN_UP (a, (unsigned) b); }
|
||||||
|
inline unsigned ALIGN_UP (const BE32& a, unsigned b) { return ALIGN_UP ((unsigned) a, b); }
|
||||||
|
|
||||||
inline unsigned ALIGN_DOWN(unsigned a, const LE32& b) { return ALIGN_DOWN(a, (unsigned) b); }
|
inline unsigned ALIGN_DOWN(unsigned a, const LE32& b) { return ALIGN_DOWN(a, (unsigned) b); }
|
||||||
inline unsigned ALIGN_DOWN(const LE32& a, unsigned b) { return ALIGN_DOWN((unsigned) a, b); }
|
inline unsigned ALIGN_DOWN(const LE32& a, unsigned b) { return ALIGN_DOWN((unsigned) a, b); }
|
||||||
inline unsigned ALIGN_UP (unsigned a, const LE32& b) { return ALIGN_UP (a, (unsigned) b); }
|
inline unsigned ALIGN_UP (unsigned a, const LE32& b) { return ALIGN_UP (a, (unsigned) b); }
|
||||||
inline unsigned ALIGN_UP (const LE32& a, unsigned b) { return ALIGN_UP ((unsigned) a, b); }
|
inline unsigned ALIGN_UP (const LE32& a, unsigned b) { return ALIGN_UP ((unsigned) a, b); }
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(UPX_MAX)
|
|
||||||
inline unsigned UPX_MAX(unsigned a, const BE16& b) { return UPX_MAX(a, (unsigned) b); }
|
inline unsigned UPX_MAX(unsigned a, const BE16& b) { return UPX_MAX(a, (unsigned) b); }
|
||||||
inline unsigned UPX_MAX(const BE16& a, unsigned b) { return UPX_MAX((unsigned) a, b); }
|
inline unsigned UPX_MAX(const BE16& a, unsigned b) { return UPX_MAX((unsigned) a, b); }
|
||||||
inline unsigned UPX_MIN(unsigned a, const BE16& b) { return UPX_MIN(a, (unsigned) b); }
|
inline unsigned UPX_MIN(unsigned a, const BE16& b) { return UPX_MIN(a, (unsigned) b); }
|
||||||
@@ -514,7 +495,6 @@ inline unsigned UPX_MAX(unsigned a, const LE32& b) { return UPX_MAX(a, (unsig
|
|||||||
inline unsigned UPX_MAX(const LE32& a, unsigned b) { return UPX_MAX((unsigned) a, b); }
|
inline unsigned UPX_MAX(const LE32& a, unsigned b) { return UPX_MAX((unsigned) a, b); }
|
||||||
inline unsigned UPX_MIN(unsigned a, const LE32& b) { return UPX_MIN(a, (unsigned) b); }
|
inline unsigned UPX_MIN(unsigned a, const LE32& b) { return UPX_MIN(a, (unsigned) b); }
|
||||||
inline unsigned UPX_MIN(const LE32& a, unsigned b) { return UPX_MIN((unsigned) a, b); }
|
inline unsigned UPX_MIN(const LE32& a, unsigned b) { return UPX_MIN((unsigned) a, b); }
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -542,42 +522,6 @@ int __acc_cdecl_qsort le64_compare_signed(const void *, const void *);
|
|||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
|
|
||||||
// just for testing...
|
|
||||||
#if !(ACC_CFG_NO_UNALIGNED)
|
|
||||||
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_GNUC >= 0x030200)
|
|
||||||
typedef acc_uint16e_t LE16_unaligned __attribute__((__aligned__(1)));
|
|
||||||
typedef acc_uint32e_t LE32_unaligned __attribute__((__aligned__(1)));
|
|
||||||
# ifndef LE16
|
|
||||||
# define LE16 LE16_unaligned
|
|
||||||
# endif
|
|
||||||
# ifndef LE32
|
|
||||||
# define LE32 LE32_unaligned
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if 0 && (ACC_ARCH_I386) && (ACC_CC_INTELC)
|
|
||||||
typedef __declspec(align(1)) acc_uint16e_t LE16_unaligned;
|
|
||||||
typedef __declspec(align(1)) acc_uint32e_t LE32_unaligned;
|
|
||||||
# ifndef LE16
|
|
||||||
# define LE16 LE16_unaligned
|
|
||||||
# endif
|
|
||||||
# ifndef LE32
|
|
||||||
# define LE32 LE32_unaligned
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_MSC) && (_MSC_VER >= 1200)
|
|
||||||
typedef __declspec(align(1)) acc_uint16e_t LE16_unaligned;
|
|
||||||
typedef __declspec(align(1)) acc_uint32e_t LE32_unaligned;
|
|
||||||
# ifndef LE16
|
|
||||||
# define LE16 LE16_unaligned
|
|
||||||
# endif
|
|
||||||
# ifndef LE32
|
|
||||||
# define LE32 LE32_unaligned
|
|
||||||
# endif
|
|
||||||
# pragma warning(disable: 4244) // Wx: conversion, possible loss of data
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// Provide namespaces and classes to abstract endianness policies.
|
// Provide namespaces and classes to abstract endianness policies.
|
||||||
//
|
//
|
||||||
@@ -587,13 +531,15 @@ int __acc_cdecl_qsort le64_compare_signed(const void *, const void *);
|
|||||||
|
|
||||||
// forward declarations
|
// forward declarations
|
||||||
namespace N_BELE_CTP {
|
namespace N_BELE_CTP {
|
||||||
struct BEPolicy; struct LEPolicy;
|
struct BEPolicy;
|
||||||
|
struct LEPolicy;
|
||||||
extern const BEPolicy be_policy;
|
extern const BEPolicy be_policy;
|
||||||
extern const LEPolicy le_policy;
|
extern const LEPolicy le_policy;
|
||||||
}
|
}
|
||||||
namespace N_BELE_RTP {
|
namespace N_BELE_RTP {
|
||||||
struct AbstractPolicy;
|
struct AbstractPolicy;
|
||||||
struct BEPolicy; struct LEPolicy;
|
struct BEPolicy;
|
||||||
|
struct LEPolicy;
|
||||||
extern const BEPolicy be_policy;
|
extern const BEPolicy be_policy;
|
||||||
extern const LEPolicy le_policy;
|
extern const LEPolicy le_policy;
|
||||||
}
|
}
|
||||||
@@ -620,8 +566,4 @@ inline const N_BELE_RTP::AbstractPolicy* getRTP(const LEPolicy*)
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+16
-20
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -61,17 +61,17 @@ struct AbstractPolicy
|
|||||||
V unsigned get16(const void *p) C = 0;
|
V unsigned get16(const void *p) C = 0;
|
||||||
V unsigned get24(const void *p) C = 0;
|
V unsigned get24(const void *p) C = 0;
|
||||||
V unsigned get32(const void *p) C = 0;
|
V unsigned get32(const void *p) C = 0;
|
||||||
V acc_uint64l_t get64(const void *p) C = 0;
|
V upx_uint64_t get64(const void *p) C = 0;
|
||||||
|
|
||||||
V void set16(void *p, unsigned v) C = 0;
|
V void set16(void *p, unsigned v) C = 0;
|
||||||
V void set24(void *p, unsigned v) C = 0;
|
V void set24(void *p, unsigned v) C = 0;
|
||||||
V void set32(void *p, unsigned v) C = 0;
|
V void set32(void *p, unsigned v) C = 0;
|
||||||
V void set64(void *p, acc_uint64l_t v) C = 0;
|
V void set64(void *p, upx_uint64_t v) C = 0;
|
||||||
|
|
||||||
V unsigned get16_signed(const void *p) C = 0;
|
V unsigned get16_signed(const void *p) C = 0;
|
||||||
V unsigned get24_signed(const void *p) C = 0;
|
V unsigned get24_signed(const void *p) C = 0;
|
||||||
V unsigned get32_signed(const void *p) C = 0;
|
V unsigned get32_signed(const void *p) C = 0;
|
||||||
V acc_uint64l_t get64_signed(const void *p) C = 0;
|
V upx_uint64_t get64_signed(const void *p) C = 0;
|
||||||
|
|
||||||
S u16_compare(const void *a, const void *b) C = 0;
|
S u16_compare(const void *a, const void *b) C = 0;
|
||||||
S u24_compare(const void *a, const void *b) C = 0;
|
S u24_compare(const void *a, const void *b) C = 0;
|
||||||
@@ -113,7 +113,7 @@ struct BEPolicy
|
|||||||
{ return get_be24(p); }
|
{ return get_be24(p); }
|
||||||
V unsigned get32(const void *p) C
|
V unsigned get32(const void *p) C
|
||||||
{ return get_be32(p); }
|
{ return get_be32(p); }
|
||||||
V acc_uint64l_t get64(const void *p) C
|
V upx_uint64_t get64(const void *p) C
|
||||||
{ return get_be64(p); }
|
{ return get_be64(p); }
|
||||||
|
|
||||||
V void set16(void *p, unsigned v) C
|
V void set16(void *p, unsigned v) C
|
||||||
@@ -122,7 +122,7 @@ struct BEPolicy
|
|||||||
{ set_be24(p, v); }
|
{ set_be24(p, v); }
|
||||||
V void set32(void *p, unsigned v) C
|
V void set32(void *p, unsigned v) C
|
||||||
{ set_be32(p, v); }
|
{ set_be32(p, v); }
|
||||||
V void set64(void *p, acc_uint64l_t v) C
|
V void set64(void *p, upx_uint64_t v) C
|
||||||
{ set_be64(p, v); }
|
{ set_be64(p, v); }
|
||||||
|
|
||||||
V unsigned get16_signed(const void *p) C
|
V unsigned get16_signed(const void *p) C
|
||||||
@@ -131,7 +131,7 @@ struct BEPolicy
|
|||||||
{ return get_be24_signed(p); }
|
{ return get_be24_signed(p); }
|
||||||
V unsigned get32_signed(const void *p) C
|
V unsigned get32_signed(const void *p) C
|
||||||
{ return get_be32_signed(p); }
|
{ return get_be32_signed(p); }
|
||||||
V acc_uint64l_t get64_signed(const void *p) C
|
V upx_uint64_t get64_signed(const void *p) C
|
||||||
{ return get_be64_signed(p); }
|
{ return get_be64_signed(p); }
|
||||||
|
|
||||||
S u16_compare(const void *a, const void *b) C
|
S u16_compare(const void *a, const void *b) C
|
||||||
@@ -190,7 +190,7 @@ struct LEPolicy
|
|||||||
{ return get_le24(p); }
|
{ return get_le24(p); }
|
||||||
V unsigned get32(const void *p) C
|
V unsigned get32(const void *p) C
|
||||||
{ return get_le32(p); }
|
{ return get_le32(p); }
|
||||||
V acc_uint64l_t get64(const void *p) C
|
V upx_uint64_t get64(const void *p) C
|
||||||
{ return get_le64(p); }
|
{ return get_le64(p); }
|
||||||
|
|
||||||
V void set16(void *p, unsigned v) C
|
V void set16(void *p, unsigned v) C
|
||||||
@@ -199,7 +199,7 @@ struct LEPolicy
|
|||||||
{ set_le24(p, v); }
|
{ set_le24(p, v); }
|
||||||
V void set32(void *p, unsigned v) C
|
V void set32(void *p, unsigned v) C
|
||||||
{ set_le32(p, v); }
|
{ set_le32(p, v); }
|
||||||
V void set64(void *p, acc_uint64l_t v) C
|
V void set64(void *p, upx_uint64_t v) C
|
||||||
{ set_le64(p, v); }
|
{ set_le64(p, v); }
|
||||||
|
|
||||||
V unsigned get16_signed(const void *p) C
|
V unsigned get16_signed(const void *p) C
|
||||||
@@ -208,7 +208,7 @@ struct LEPolicy
|
|||||||
{ return get_le24_signed(p); }
|
{ return get_le24_signed(p); }
|
||||||
V unsigned get32_signed(const void *p) C
|
V unsigned get32_signed(const void *p) C
|
||||||
{ return get_le32_signed(p); }
|
{ return get_le32_signed(p); }
|
||||||
V acc_uint64l_t get64_signed(const void *p) C
|
V upx_uint64_t get64_signed(const void *p) C
|
||||||
{ return get_le64_signed(p); }
|
{ return get_le64_signed(p); }
|
||||||
|
|
||||||
S u16_compare(const void *a, const void *b) C
|
S u16_compare(const void *a, const void *b) C
|
||||||
@@ -259,9 +259,9 @@ struct HostAlignedPolicy
|
|||||||
enum { isBE = HostPolicy::isBE, isLE = HostPolicy::isLE };
|
enum { isBE = HostPolicy::isBE, isLE = HostPolicy::isLE };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef acc_uint16e_t U16;
|
typedef upx_uint16_t U16;
|
||||||
typedef acc_uint32e_t U32;
|
typedef upx_uint32_t U32;
|
||||||
typedef acc_uint64l_t U64;
|
typedef upx_uint64_t U64;
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() {
|
||||||
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
|
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
|
||||||
@@ -276,8 +276,4 @@ struct HostAlignedPolicy
|
|||||||
#undef S
|
#undef S
|
||||||
#undef C
|
#undef C
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+30
-39
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -37,70 +37,65 @@
|
|||||||
template <class T>
|
template <class T>
|
||||||
class BoundedPtr
|
class BoundedPtr
|
||||||
{
|
{
|
||||||
// typedef BoundedPtr<T> Self;
|
|
||||||
public:
|
public:
|
||||||
typedef T* StoredType;
|
//typedef T* StoredType;
|
||||||
typedef T* PointerType;
|
//typedef T* PointerType;
|
||||||
typedef T& ReferenceType;
|
//typedef T& ReferenceType;
|
||||||
|
|
||||||
~BoundedPtr() { }
|
~BoundedPtr() { }
|
||||||
|
|
||||||
explicit BoundedPtr(void* base, unsigned size, T* ptr=0)
|
explicit BoundedPtr(void* base, size_t size_in_bytes, T* ptr=0)
|
||||||
: ptr_(ptr), base_(base), size_(size) { check(); }
|
: ptr_(ptr), base_(base), size_in_bytes_(0)
|
||||||
|
{
|
||||||
|
assert(base_ != NULL);
|
||||||
|
size_in_bytes_ = mem_size(1, size_in_bytes);
|
||||||
|
check();
|
||||||
|
}
|
||||||
|
|
||||||
|
// assignment
|
||||||
BoundedPtr& operator= (const BoundedPtr& other) {
|
BoundedPtr& operator= (const BoundedPtr& other) {
|
||||||
assert(base_ == other.base_); assert(size_ == other.size_);
|
assert(base_ == other.base_);
|
||||||
|
assert(size_in_bytes_ == other.size_in_bytes_);
|
||||||
ptr_ = other.ptr_; check(); return *this;
|
ptr_ = other.ptr_; check(); return *this;
|
||||||
}
|
}
|
||||||
BoundedPtr& operator= (T* other) {
|
BoundedPtr& operator= (T* other) {
|
||||||
ptr_ = other; check(); return *this;
|
ptr_ = other; check(); return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
operator T* () { check(); return ptr_; }
|
operator T* () { return ptr_; }
|
||||||
operator const T* () const { check(); return ptr_; }
|
operator const T* () const { return ptr_; }
|
||||||
|
|
||||||
BoundedPtr& operator += (size_t n) {
|
BoundedPtr& operator += (size_t n) {
|
||||||
checkStrict(); ptr_ += n; checkStrict(); return *this;
|
checkNULL(); ptr_ += n; checkRange(); return *this;
|
||||||
}
|
}
|
||||||
BoundedPtr& operator -= (size_t n) {
|
BoundedPtr& operator -= (size_t n) {
|
||||||
checkStrict(); ptr_ -= n; checkStrict(); return *this;
|
checkNULL(); ptr_ -= n; checkRange(); return *this;
|
||||||
}
|
}
|
||||||
BoundedPtr& operator ++ (void) {
|
BoundedPtr& operator ++ (void) {
|
||||||
checkStrict(); ptr_ += 1; checkStrict(); return *this;
|
checkNULL(); ptr_ += 1; checkRange(); return *this;
|
||||||
}
|
}
|
||||||
// T* operator ++ (int) {
|
|
||||||
// T* p = ptr_; checkStrict(); ptr_ += 1; checkStrict(); return p;
|
|
||||||
// }
|
|
||||||
// BoundedPtr& operator -- (void) {
|
|
||||||
// checkStrict(); ptr_ -= 1; checkStrict(); return *this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkNULL() const {
|
void checkNULL() const {
|
||||||
if (!ptr_)
|
if __acc_very_unlikely(!ptr_)
|
||||||
throwCantUnpack("unexpected NULL pointer; take care!");
|
throwCantUnpack("unexpected NULL pointer; take care!");
|
||||||
}
|
}
|
||||||
void checkRange(size_t extra=0) const {
|
void checkRange() const {
|
||||||
size_t off = (const char *) ptr_ - (const char *) base_;
|
size_t off = (const char *) ptr_ - (const char *) base_;
|
||||||
if (off > size_ || off + extra > size_)
|
if __acc_very_unlikely(off > size_in_bytes_)
|
||||||
throwCantUnpack("pointer out of range; take care!");
|
throwCantUnpack("pointer out of range; take care!");
|
||||||
}
|
}
|
||||||
void checkStrict(size_t extra=0) const {
|
void check() const { // check ptr_ invariant: either NULL or valid checkRange()
|
||||||
checkNULL();
|
if (ptr_ != NULL)
|
||||||
checkRange(extra);
|
checkRange();
|
||||||
}
|
|
||||||
void check(size_t extra=0) const {
|
|
||||||
if (ptr_) checkRange(extra);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
T* ptr_;
|
T* ptr_;
|
||||||
void* base_;
|
void* base_;
|
||||||
size_t size_;
|
size_t size_in_bytes_;
|
||||||
|
|
||||||
// disable copy
|
// disable copy
|
||||||
BoundedPtr(const BoundedPtr&); // {}
|
BoundedPtr(const BoundedPtr&); // {}
|
||||||
// BoundedPtr& operator= (const BoundedPtr&); // { return *this; }
|
|
||||||
|
|
||||||
// disable dynamic allocation
|
// disable dynamic allocation
|
||||||
DISABLE_NEW_DELETE
|
DISABLE_NEW_DELETE
|
||||||
};
|
};
|
||||||
@@ -108,8 +103,4 @@ private:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -89,8 +89,4 @@ console_t console_file =
|
|||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -159,8 +159,4 @@ void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...)
|
|||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -75,8 +75,4 @@ console_t console_none =
|
|||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -317,8 +317,4 @@ console_t console_screen =
|
|||||||
|
|
||||||
#endif /* USE_SCREEN */
|
#endif /* USE_SCREEN */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+16
-25
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,14 +22,13 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "compress.h"
|
#include "compress.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -41,12 +40,10 @@ unsigned upx_adler32(const void *buf, unsigned len, unsigned adler)
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return adler;
|
return adler;
|
||||||
assert(buf != NULL);
|
assert(buf != NULL);
|
||||||
#if 0
|
#if 1
|
||||||
return adler32(adler, (const Bytef *) buf, len); // zlib
|
return upx_ucl_adler32(buf, len, adler);
|
||||||
#elif (WITH_UCL)
|
|
||||||
return ucl_adler32(adler, (const ucl_bytep) buf, len);
|
|
||||||
#else
|
#else
|
||||||
# error
|
return upx_zlib_adler32(buf, len, adler);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,12 +54,10 @@ unsigned upx_crc32(const void *buf, unsigned len, unsigned crc)
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return crc;
|
return crc;
|
||||||
assert(buf != NULL);
|
assert(buf != NULL);
|
||||||
#if 0
|
#if 1
|
||||||
return crc32(crc, (const Bytef *) buf, len); // zlib
|
return upx_ucl_crc32(buf, len, crc);
|
||||||
#elif (WITH_UCL)
|
|
||||||
return ucl_crc32(crc, (const ucl_bytep) buf, len);
|
|
||||||
#else
|
#else
|
||||||
# error
|
return upx_zlib_crc32(buf, len, crc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* UNUSED */
|
#endif /* UNUSED */
|
||||||
@@ -106,7 +101,7 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
cresult->c_len = 0;
|
cresult->c_len = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (0) {
|
if __acc_cte(0) {
|
||||||
}
|
}
|
||||||
#if (WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
else if (M_IS_LZMA(method))
|
else if (M_IS_LZMA(method))
|
||||||
@@ -114,7 +109,7 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
cb, method, level, cconf, cresult);
|
cb, method, level, cconf, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_NRV)
|
#if (WITH_NRV)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
|
||||||
r = upx_nrv_compress(src, src_len, dst, dst_len,
|
r = upx_nrv_compress(src, src_len, dst, dst_len,
|
||||||
cb, method, level, cconf, cresult);
|
cb, method, level, cconf, cresult);
|
||||||
#endif
|
#endif
|
||||||
@@ -152,14 +147,14 @@ int upx_decompress ( const upx_bytep src, unsigned src_len,
|
|||||||
if (cresult && cresult->method == 0)
|
if (cresult && cresult->method == 0)
|
||||||
cresult = NULL;
|
cresult = NULL;
|
||||||
|
|
||||||
if (0) {
|
if __acc_cte(0) {
|
||||||
}
|
}
|
||||||
#if (WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
else if (M_IS_LZMA(method))
|
else if (M_IS_LZMA(method))
|
||||||
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult);
|
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_NRV)
|
#if (WITH_NRV)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
|
||||||
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult);
|
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_UCL)
|
#if (WITH_UCL)
|
||||||
@@ -199,14 +194,14 @@ int upx_test_overlap ( const upx_bytep buf,
|
|||||||
unsigned overlap_overhead = src_off + src_len - *dst_len;
|
unsigned overlap_overhead = src_off + src_len - *dst_len;
|
||||||
assert((int)overlap_overhead > 0);
|
assert((int)overlap_overhead > 0);
|
||||||
|
|
||||||
if (0) {
|
if __acc_cte(0) {
|
||||||
}
|
}
|
||||||
#if (WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
else if (M_IS_LZMA(method))
|
else if (M_IS_LZMA(method))
|
||||||
r = upx_lzma_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
r = upx_lzma_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_NRV)
|
#if (WITH_NRV)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
|
||||||
r = upx_nrv_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
r = upx_nrv_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_UCL)
|
#if (WITH_UCL)
|
||||||
@@ -220,8 +215,4 @@ int upx_test_overlap ( const upx_bytep buf,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+12
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if (WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
|
int upx_lzma_init(void);
|
||||||
const char *upx_lzma_version_string(void);
|
const char *upx_lzma_version_string(void);
|
||||||
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
@@ -56,6 +57,7 @@ int upx_lzma_test_overlap ( const upx_bytep buf,
|
|||||||
|
|
||||||
|
|
||||||
#if (WITH_NRV)
|
#if (WITH_NRV)
|
||||||
|
int upx_nrv_init(void);
|
||||||
const char *upx_nrv_version_string(void);
|
const char *upx_nrv_version_string(void);
|
||||||
int upx_nrv_compress ( const upx_bytep src, unsigned src_len,
|
int upx_nrv_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
@@ -77,6 +79,7 @@ int upx_nrv_test_overlap ( const upx_bytep buf,
|
|||||||
|
|
||||||
|
|
||||||
#if (WITH_UCL)
|
#if (WITH_UCL)
|
||||||
|
int upx_ucl_init(void);
|
||||||
const char *upx_ucl_version_string(void);
|
const char *upx_ucl_version_string(void);
|
||||||
int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
@@ -94,10 +97,13 @@ int upx_ucl_test_overlap ( const upx_bytep buf,
|
|||||||
unsigned* dst_len,
|
unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const upx_compress_result_t *cresult );
|
const upx_compress_result_t *cresult );
|
||||||
|
unsigned upx_ucl_adler32(const void *buf, unsigned len, unsigned adler);
|
||||||
|
unsigned upx_ucl_crc32 (const void *buf, unsigned len, unsigned crc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (WITH_ZLIB)
|
#if (WITH_ZLIB)
|
||||||
|
int upx_zlib_init(void);
|
||||||
const char *upx_zlib_version_string(void);
|
const char *upx_zlib_version_string(void);
|
||||||
int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
|
int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
@@ -115,13 +121,11 @@ int upx_zlib_test_overlap ( const upx_bytep buf,
|
|||||||
unsigned* dst_len,
|
unsigned* dst_len,
|
||||||
int method,
|
int method,
|
||||||
const upx_compress_result_t *cresult );
|
const upx_compress_result_t *cresult );
|
||||||
|
unsigned upx_zlib_adler32(const void *buf, unsigned len, unsigned adler);
|
||||||
|
unsigned upx_zlib_crc32 (const void *buf, unsigned len, unsigned crc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+50
-321
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -30,6 +30,16 @@
|
|||||||
#include "compress.h"
|
#include "compress.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
|
#if (ACC_CC_MSC)
|
||||||
|
# pragma warning(disable: 4456) // -Wno-shadow
|
||||||
|
#endif
|
||||||
|
#if (ACC_CC_MSC && (_MSC_VER < 1900))
|
||||||
|
# pragma warning(disable: 4127) // warning C4127: conditional expression is constant
|
||||||
|
#endif
|
||||||
|
#if (ACC_CC_INTELC_GNUC)
|
||||||
|
# pragma warning(error: 424) // #424: extra ";" ignored
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void lzma_compress_config_t::reset()
|
void lzma_compress_config_t::reset()
|
||||||
{
|
{
|
||||||
@@ -47,15 +57,6 @@ void lzma_compress_config_t::reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !(WITH_LZMA)
|
|
||||||
extern int compress_lzma_dummy;
|
|
||||||
int compress_lzma_dummy = 0;
|
|
||||||
#else
|
|
||||||
#define opt compress_lzma_opt
|
|
||||||
|
|
||||||
#undef USE_LZMA_PROPERTIES
|
|
||||||
|
|
||||||
|
|
||||||
// INFO: the LZMA SDK is covered by a permissive license which allows
|
// INFO: the LZMA SDK is covered by a permissive license which allows
|
||||||
// using unmodified LZMA source code in UPX and the UPX stubs.
|
// using unmodified LZMA source code in UPX and the UPX stubs.
|
||||||
// See SPECIAL EXCEPTION below.
|
// See SPECIAL EXCEPTION below.
|
||||||
@@ -93,21 +94,6 @@ int compress_lzma_dummy = 0;
|
|||||||
// while you keep LZMA SDK code unmodified.
|
// while you keep LZMA SDK code unmodified.
|
||||||
|
|
||||||
|
|
||||||
#if (WITH_LZMA >= 0x461)
|
|
||||||
#include "C/7zVersion.h"
|
|
||||||
#if (WITH_LZMA != (0x100 * MY_VER_MAJOR) + (0x10 * (MY_VER_MINOR / 10)) + (MY_VER_MINOR % 10))
|
|
||||||
# error "WITH_LZMA version mismatch"
|
|
||||||
#endif
|
|
||||||
#include "C/Types.h"
|
|
||||||
static void *cb_alloc(void *, size_t size) {
|
|
||||||
return malloc(size);
|
|
||||||
}
|
|
||||||
static void cb_free(void *, void *ptr) {
|
|
||||||
free(ptr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// compress defaults
|
// compress defaults
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -124,13 +110,12 @@ static int prepare(lzma_compress_result_t *res,
|
|||||||
res->fast_mode = 2;
|
res->fast_mode = 2;
|
||||||
res->num_fast_bytes = 64; // 5 .. 273
|
res->num_fast_bytes = 64; // 5 .. 273
|
||||||
res->match_finder_cycles = 0;
|
res->match_finder_cycles = 0;
|
||||||
#if 1
|
// UPX overrides
|
||||||
res->pos_bits = lzma_compress_config_t::pos_bits_t::default_value_c;
|
res->pos_bits = lzma_compress_config_t::pos_bits_t::default_value_c;
|
||||||
res->lit_pos_bits = lzma_compress_config_t::lit_pos_bits_t::default_value_c;
|
res->lit_pos_bits = lzma_compress_config_t::lit_pos_bits_t::default_value_c;
|
||||||
res->lit_context_bits = lzma_compress_config_t::lit_context_bits_t::default_value_c;
|
res->lit_context_bits = lzma_compress_config_t::lit_context_bits_t::default_value_c;
|
||||||
res->dict_size = lzma_compress_config_t::dict_size_t::default_value_c;
|
res->dict_size = lzma_compress_config_t::dict_size_t::default_value_c;
|
||||||
res->num_fast_bytes = lzma_compress_config_t::num_fast_bytes_t::default_value_c;
|
res->num_fast_bytes = lzma_compress_config_t::num_fast_bytes_t::default_value_c;
|
||||||
#endif
|
|
||||||
// method overrides
|
// method overrides
|
||||||
if (method >= 0x100) {
|
if (method >= 0x100) {
|
||||||
res->pos_bits = (method >> 16) & 15;
|
res->pos_bits = (method >> 16) & 15;
|
||||||
@@ -145,7 +130,7 @@ static int prepare(lzma_compress_result_t *res,
|
|||||||
res->lit_context_bits = 8;
|
res->lit_context_bits = 8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME: tune these settings according to level
|
// TODO: tune these settings according to level
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@@ -225,133 +210,25 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
// compress
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if (WITH_LZMA >= 0x461)
|
|
||||||
#define kLiteralNextStates kLiteralNextStates_enc
|
|
||||||
#include "C/LzmaEnc.h"
|
|
||||||
#include "C/LzmaEnc.c"
|
|
||||||
#include "C/LzFind.c"
|
|
||||||
#undef kLiteralNextStates
|
|
||||||
#undef kNumFullDistances
|
|
||||||
|
|
||||||
|
|
||||||
struct upx_ICompressProgress {
|
|
||||||
SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
|
|
||||||
upx_callback_p cb;
|
|
||||||
};
|
|
||||||
|
|
||||||
static SRes cb_progress(void *p, UInt64 inSize, UInt64 outSize) {
|
|
||||||
upx_callback_p cb = ((upx_ICompressProgress *) p)->cb;
|
|
||||||
if (cb && cb->nprogress)
|
|
||||||
cb->nprogress(cb, (unsigned) inSize, (unsigned) outSize);
|
|
||||||
return SZ_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|
||||||
upx_bytep dst, unsigned* dst_len,
|
|
||||||
upx_callback_p cb,
|
|
||||||
int method, int level,
|
|
||||||
const upx_compress_config_t *cconf_parm,
|
|
||||||
upx_compress_result_t *cresult )
|
|
||||||
{
|
|
||||||
assert(M_IS_LZMA(method));
|
|
||||||
assert(level > 0); assert(cresult != NULL);
|
|
||||||
COMPILE_TIME_ASSERT(LZMA_PROPS_SIZE == 5)
|
|
||||||
|
|
||||||
int r = UPX_E_ERROR;
|
|
||||||
int rh;
|
|
||||||
|
|
||||||
unsigned dst_avail = *dst_len;
|
|
||||||
*dst_len = 0;
|
|
||||||
|
|
||||||
ISzAlloc cba; cba.Alloc = cb_alloc; cba.Free = cb_free;
|
|
||||||
upx_ICompressProgress progress;
|
|
||||||
progress.Progress = cb_progress; progress.cb = cb;
|
|
||||||
|
|
||||||
const lzma_compress_config_t *lcconf = cconf_parm ? &cconf_parm->conf_lzma : NULL;
|
|
||||||
lzma_compress_result_t *res = &cresult->result_lzma;
|
|
||||||
if (prepare(res, src_len, method, level, lcconf) != 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
CLzmaEncProps props; memset(&props, 0, sizeof(props));
|
|
||||||
props.level = level;
|
|
||||||
LzmaEncProps_Init(&props);
|
|
||||||
props.pb = res->pos_bits;
|
|
||||||
props.lp = res->lit_pos_bits;
|
|
||||||
props.lc = res->lit_context_bits;
|
|
||||||
props.dictSize = res->dict_size;
|
|
||||||
props.algo = res->fast_mode ? 1 : 0;
|
|
||||||
props.fb = res->num_fast_bytes;
|
|
||||||
props.mc = res->match_finder_cycles;
|
|
||||||
|
|
||||||
unsigned char props_buf[LZMA_PROPS_SIZE];
|
|
||||||
SizeT props_buf_size; props_buf_size = LZMA_PROPS_SIZE;
|
|
||||||
|
|
||||||
#if (USE_LZMA_PROPERTIES)
|
|
||||||
if (dst_avail < 1)
|
|
||||||
goto error;
|
|
||||||
dst[0] = 0; // filled below
|
|
||||||
dst += 1; *dst_len += 1; dst_avail -= 1;
|
|
||||||
#else
|
|
||||||
if (dst_avail < 2)
|
|
||||||
goto error;
|
|
||||||
// extra stuff in first byte: 5 high bits convenience for stub decompressor
|
|
||||||
unsigned tt; tt = res->lit_context_bits + res->lit_pos_bits;
|
|
||||||
dst[0] = ((tt << 3) | res->pos_bits);
|
|
||||||
dst[1] = ((res->lit_pos_bits << 4) | (res->lit_context_bits));
|
|
||||||
dst += 2; *dst_len += 2; dst_avail -= 2;
|
|
||||||
#endif
|
|
||||||
SizeT x_len; x_len = dst_avail;
|
|
||||||
rh = LzmaEncode(dst, &x_len, src, src_len,
|
|
||||||
&props, props_buf, &props_buf_size, 0,
|
|
||||||
(ICompressProgress *) (void *) &progress, &cba, &cba);
|
|
||||||
assert(x_len <= dst_avail);
|
|
||||||
*dst_len += x_len;
|
|
||||||
if (rh == SZ_OK) {
|
|
||||||
#if (USE_LZMA_PROPERTIES)
|
|
||||||
dst[-1] = props_buf[0];
|
|
||||||
#endif
|
|
||||||
r = UPX_E_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
error:
|
|
||||||
//printf("\nlzma_compress: %d: %u %u %u %u %u, %u - > %u\n", r, res->pos_bits, res->lit_pos_bits, res->lit_context_bits, res->dict_size, res->num_probs, src_len, *dst_len);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* (WITH_LZMA >= 0x461) */
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// compress - cruft because of pseudo-COM layer
|
// compress - cruft because of pseudo-COM layer
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if (WITH_LZMA < 0x461)
|
|
||||||
|
|
||||||
#undef MSDOS
|
#undef MSDOS
|
||||||
#undef OS2
|
#undef OS2
|
||||||
#undef _WIN32
|
#undef _WIN32
|
||||||
#undef _WIN32_WCE
|
#undef _WIN32_WCE
|
||||||
#undef COMPRESS_MF_MT
|
#undef COMPRESS_MF_MT
|
||||||
#undef _NO_EXCEPTIONS
|
#undef _NO_EXCEPTIONS
|
||||||
#if (WITH_LZMA >= 0x449)
|
#include "C/Common/MyInitGuid.h"
|
||||||
# define INITGUID 1
|
//#include "C/7zip/Compress/LZMA/LZMADecoder.h"
|
||||||
//# include "CPP/7zip/Compress/LZMA/LZMADecoder.h"
|
#include "C/7zip/Compress/LZMA/LZMAEncoder.h"
|
||||||
# include "CPP/7zip/Compress/LZMA/LZMAEncoder.h"
|
|
||||||
#else
|
|
||||||
# include "C/Common/MyInitGuid.h"
|
|
||||||
//# include "C/7zip/Compress/LZMA/LZMADecoder.h"
|
|
||||||
# include "C/7zip/Compress/LZMA/LZMAEncoder.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace MyLzma {
|
namespace MyLzma {
|
||||||
|
|
||||||
struct InStream: public ISequentialInStream, public CMyUnknownImp
|
struct InStream: public ISequentialInStream, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
virtual ~InStream() { }
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
const Byte *b_buf; size_t b_size; size_t b_pos;
|
const Byte *b_buf; size_t b_size; size_t b_pos;
|
||||||
void Init(const Byte *data, size_t size) {
|
void Init(const Byte *data, size_t size) {
|
||||||
@@ -364,7 +241,7 @@ STDMETHODIMP InStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
|||||||
{
|
{
|
||||||
size_t remain = b_size - b_pos;
|
size_t remain = b_size - b_pos;
|
||||||
if (size > remain) size = (UInt32) remain;
|
if (size > remain) size = (UInt32) remain;
|
||||||
memcpy(data, b_buf + b_pos, size);
|
memmove(data, b_buf + b_pos, size);
|
||||||
b_pos += size;
|
b_pos += size;
|
||||||
if (processedSize != NULL) *processedSize = size;
|
if (processedSize != NULL) *processedSize = size;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@@ -372,6 +249,7 @@ STDMETHODIMP InStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
|||||||
|
|
||||||
struct OutStream : public ISequentialOutStream, public CMyUnknownImp
|
struct OutStream : public ISequentialOutStream, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
virtual ~OutStream() { }
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
Byte *b_buf; size_t b_size; size_t b_pos; bool overflow;
|
Byte *b_buf; size_t b_size; size_t b_pos; bool overflow;
|
||||||
void Init(Byte *data, size_t size) {
|
void Init(Byte *data, size_t size) {
|
||||||
@@ -389,7 +267,7 @@ STDMETHODIMP OutStream::Write(const void *data, UInt32 size, UInt32 *processedSi
|
|||||||
{
|
{
|
||||||
size_t remain = b_size - b_pos;
|
size_t remain = b_size - b_pos;
|
||||||
if (size > remain) size = (UInt32) remain, overflow = true;
|
if (size > remain) size = (UInt32) remain, overflow = true;
|
||||||
memcpy(b_buf + b_pos, data, size);
|
memmove(b_buf + b_pos, data, size);
|
||||||
b_pos += size;
|
b_pos += size;
|
||||||
if (processedSize != NULL) *processedSize = size;
|
if (processedSize != NULL) *processedSize = size;
|
||||||
return overflow ? E_FAIL : S_OK;
|
return overflow ? E_FAIL : S_OK;
|
||||||
@@ -397,6 +275,7 @@ STDMETHODIMP OutStream::Write(const void *data, UInt32 size, UInt32 *processedSi
|
|||||||
|
|
||||||
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
virtual ~ProgressInfo() { }
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
|
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
|
||||||
upx_callback_p cb;
|
upx_callback_p cb;
|
||||||
@@ -411,34 +290,16 @@ STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outS
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
#include "C/Common/Alloc.cpp"
|
||||||
#if (ACC_CC_INTELC) && defined(__linux__)
|
#include "C/Common/CRC.cpp"
|
||||||
# pragma warning(disable: 424) // #424: extra ";" ignored
|
//#include "C/7zip/Common/InBuffer.cpp"
|
||||||
#endif
|
#include "C/7zip/Common/OutBuffer.cpp"
|
||||||
|
#include "C/7zip/Common/StreamUtils.cpp"
|
||||||
#if (WITH_LZMA >= 0x449)
|
#include "C/7zip/Compress/LZ/LZInWindow.cpp"
|
||||||
# include "C/Alloc.c"
|
//#include "C/7zip/Compress/LZ/LZOutWindow.cpp"
|
||||||
# include "C/7zCrc.c"
|
//#include "C/7zip/Compress/LZMA/LZMADecoder.cpp"
|
||||||
# include "C/Compress/Lz/MatchFinder.c"
|
#include "C/7zip/Compress/LZMA/LZMAEncoder.cpp"
|
||||||
//# include "CPP/7zip/Common/InBuffer.cpp"
|
#include "C/7zip/Compress/RangeCoder/RangeCoderBit.cpp"
|
||||||
# include "CPP/7zip/Common/OutBuffer.cpp"
|
|
||||||
# include "CPP/7zip/Common/StreamUtils.cpp"
|
|
||||||
//# include "CPP/7zip/Compress/LZ/LZOutWindow.cpp"
|
|
||||||
//# include "CPP/7zip/Compress/LZMA/LZMADecoder.cpp"
|
|
||||||
# include "CPP/7zip/Compress/LZMA/LZMAEncoder.cpp"
|
|
||||||
# include "CPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp"
|
|
||||||
#else
|
|
||||||
# include "C/Common/Alloc.cpp"
|
|
||||||
# include "C/Common/CRC.cpp"
|
|
||||||
//# include "C/7zip/Common/InBuffer.cpp"
|
|
||||||
# include "C/7zip/Common/OutBuffer.cpp"
|
|
||||||
# include "C/7zip/Common/StreamUtils.cpp"
|
|
||||||
# include "C/7zip/Compress/LZ/LZInWindow.cpp"
|
|
||||||
//# include "C/7zip/Compress/LZ/LZOutWindow.cpp"
|
|
||||||
//# include "C/7zip/Compress/LZMA/LZMADecoder.cpp"
|
|
||||||
# include "C/7zip/Compress/LZMA/LZMAEncoder.cpp"
|
|
||||||
# include "C/7zip/Compress/RangeCoder/RangeCoderBit.cpp"
|
|
||||||
#endif
|
|
||||||
#undef RC_NORMALIZE
|
#undef RC_NORMALIZE
|
||||||
|
|
||||||
|
|
||||||
@@ -477,14 +338,10 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
NCoderPropID::kMatchFinder // 7 mf
|
NCoderPropID::kMatchFinder // 7 mf
|
||||||
};
|
};
|
||||||
PROPVARIANT pr[8];
|
PROPVARIANT pr[8];
|
||||||
#ifdef COMPRESS_MF_BT4
|
|
||||||
const unsigned nprops = 8;
|
const unsigned nprops = 8;
|
||||||
static wchar_t matchfinder[] = L"BT4";
|
static const wchar_t matchfinder[] = L"BT4";
|
||||||
assert(NCompress::NLZMA::FindMatchFinder(matchfinder) >= 0);
|
assert(NCompress::NLZMA::FindMatchFinder(matchfinder) >= 0);
|
||||||
pr[7].vt = VT_BSTR; pr[7].bstrVal = matchfinder;
|
pr[7].vt = VT_BSTR; pr[7].bstrVal = ACC_PCAST(BSTR, ACC_UNCONST_CAST(wchar_t *, matchfinder));
|
||||||
#else
|
|
||||||
const unsigned nprops = 7;
|
|
||||||
#endif
|
|
||||||
pr[0].vt = pr[1].vt = pr[2].vt = pr[3].vt = VT_UI4;
|
pr[0].vt = pr[1].vt = pr[2].vt = pr[3].vt = VT_UI4;
|
||||||
pr[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
|
pr[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
|
||||||
if (prepare(res, src_len, method, level, lcconf) != 0)
|
if (prepare(res, src_len, method, level, lcconf) != 0)
|
||||||
@@ -497,11 +354,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
pr[5].uintVal = res->num_fast_bytes;
|
pr[5].uintVal = res->num_fast_bytes;
|
||||||
pr[6].uintVal = res->match_finder_cycles;
|
pr[6].uintVal = res->match_finder_cycles;
|
||||||
|
|
||||||
#ifndef _NO_EXCEPTIONS
|
|
||||||
try {
|
try {
|
||||||
#else
|
|
||||||
# error
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (enc.SetCoderProperties(propIDs, pr, nprops) != S_OK)
|
if (enc.SetCoderProperties(propIDs, pr, nprops) != S_OK)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -513,21 +366,17 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
assert(os.b_pos == 5);
|
assert(os.b_pos == 5);
|
||||||
#if (USE_LZMA_PROPERTIES)
|
|
||||||
os.b_pos = 1;
|
|
||||||
#else
|
|
||||||
os.b_pos = 0;
|
os.b_pos = 0;
|
||||||
// extra stuff in first byte: 5 high bits convenience for stub decompressor
|
// extra stuff in first byte: 5 high bits convenience for stub decompressor
|
||||||
unsigned t = res->lit_context_bits + res->lit_pos_bits;
|
unsigned t = res->lit_context_bits + res->lit_pos_bits;
|
||||||
os.WriteByte((t << 3) | res->pos_bits);
|
os.WriteByte(Byte((t << 3) | res->pos_bits));
|
||||||
os.WriteByte((res->lit_pos_bits << 4) | (res->lit_context_bits));
|
os.WriteByte(Byte((res->lit_pos_bits << 4) | (res->lit_context_bits)));
|
||||||
#endif
|
|
||||||
|
|
||||||
rh = enc.Code(&is, &os, NULL, NULL, &progress);
|
rh = enc.Code(&is, &os, NULL, NULL, &progress);
|
||||||
|
|
||||||
#ifndef _NO_EXCEPTIONS
|
} catch (...) {
|
||||||
} catch (...) { rh = E_OUTOFMEMORY; }
|
rh = E_OUTOFMEMORY;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
assert(is.b_pos <= src_len);
|
assert(is.b_pos <= src_len);
|
||||||
assert(os.b_pos <= *dst_len);
|
assert(os.b_pos <= *dst_len);
|
||||||
@@ -552,121 +401,17 @@ error:
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* (WITH_LZMA < 0x461) */
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// decompress
|
// decompress
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if (WITH_LZMA >= 0x461)
|
|
||||||
|
|
||||||
#undef _LZMA_PROB32
|
|
||||||
#include "C/LzmaDec.h"
|
|
||||||
#include "C/LzmaDec.c"
|
|
||||||
|
|
||||||
|
|
||||||
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
|
||||||
upx_bytep dst, unsigned* dst_len,
|
|
||||||
int method,
|
|
||||||
const upx_compress_result_t *cresult )
|
|
||||||
{
|
|
||||||
#define Properties prop
|
|
||||||
assert(M_IS_LZMA(method));
|
|
||||||
// see res->num_probs above
|
|
||||||
COMPILE_TIME_ASSERT(sizeof(CLzmaProb) == 2)
|
|
||||||
COMPILE_TIME_ASSERT(LZMA_PROPS_SIZE == 5)
|
|
||||||
COMPILE_TIME_ASSERT(LZMA_BASE_SIZE == 1846)
|
|
||||||
COMPILE_TIME_ASSERT(LZMA_LIT_SIZE == 768)
|
|
||||||
|
|
||||||
ISzAlloc cba; cba.Alloc = cb_alloc; cba.Free = cb_free;
|
|
||||||
CLzmaDec s; memset(&s, 0, sizeof(s));
|
|
||||||
SizeT srcLen = 0;
|
|
||||||
int r = UPX_E_ERROR;
|
|
||||||
SRes rh;
|
|
||||||
ELzmaStatus status;
|
|
||||||
|
|
||||||
#if (USE_LZMA_PROPERTIES)
|
|
||||||
rh = LzmaProps_Decode(&s.Properties, src, src_len);
|
|
||||||
if (rh != 0)
|
|
||||||
goto error;
|
|
||||||
src += 1; src_len -= 1;
|
|
||||||
#else
|
|
||||||
if (src_len < 3)
|
|
||||||
goto error;
|
|
||||||
s.Properties.pb = src[0] & 7;
|
|
||||||
s.Properties.lp = (src[1] >> 4);
|
|
||||||
s.Properties.lc = src[1] & 15;
|
|
||||||
if (s.Properties.pb >= 5) goto error;
|
|
||||||
if (s.Properties.lp >= 5) goto error;
|
|
||||||
if (s.Properties.lc >= 9) goto error;
|
|
||||||
// extra
|
|
||||||
if ((src[0] >> 3) != (int)(s.Properties.lc + s.Properties.lp)) goto error;
|
|
||||||
src += 2; src_len -= 2;
|
|
||||||
#endif
|
|
||||||
s.Properties.dicSize = 0;
|
|
||||||
|
|
||||||
if (cresult)
|
|
||||||
{
|
|
||||||
assert(cresult->method == method);
|
|
||||||
assert(cresult->result_lzma.pos_bits == (unsigned) s.Properties.pb);
|
|
||||||
assert(cresult->result_lzma.lit_pos_bits == (unsigned) s.Properties.lp);
|
|
||||||
assert(cresult->result_lzma.lit_context_bits == (unsigned) s.Properties.lc);
|
|
||||||
assert(cresult->result_lzma.num_probs == (unsigned) LzmaProps_GetNumProbs(&s.Properties));
|
|
||||||
const lzma_compress_result_t *res = &cresult->result_lzma;
|
|
||||||
UNUSED(res);
|
|
||||||
//printf("\nlzma_decompress config: %u %u %u %u %u\n", res->pos_bits, res->lit_pos_bits, res->lit_context_bits, res->dict_size, res->num_probs);
|
|
||||||
}
|
|
||||||
|
|
||||||
rh = LzmaDec_AllocateProbs2(&s, &s.Properties, &cba);
|
|
||||||
if (rh != SZ_OK)
|
|
||||||
{
|
|
||||||
r = UPX_E_OUT_OF_MEMORY;
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
s.dic = dst; s.dicPos = 0; s.dicBufSize = *dst_len;
|
|
||||||
LzmaDec_Init(&s);
|
|
||||||
srcLen = src_len;
|
|
||||||
rh = LzmaDec_DecodeToDic(&s, *dst_len, src, &srcLen, LZMA_FINISH_ANY, &status);
|
|
||||||
assert(srcLen <= src_len);
|
|
||||||
assert(s.dicPos <= *dst_len);
|
|
||||||
if (rh == SZ_OK && status == LZMA_STATUS_NEEDS_MORE_INPUT)
|
|
||||||
rh = SZ_ERROR_INPUT_EOF;
|
|
||||||
if (rh == SZ_OK && status == LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK)
|
|
||||||
{
|
|
||||||
r = UPX_E_OK;
|
|
||||||
if (srcLen != src_len)
|
|
||||||
r = UPX_E_INPUT_NOT_CONSUMED;
|
|
||||||
}
|
|
||||||
error:
|
|
||||||
*dst_len = s.dicPos;
|
|
||||||
LzmaDec_FreeProbs(&s, &cba);
|
|
||||||
return r;
|
|
||||||
#undef Properties
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* (WITH_LZMA >= 0x461) */
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
// decompress
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if (WITH_LZMA < 0x461)
|
|
||||||
|
|
||||||
#undef _LZMA_IN_CB
|
#undef _LZMA_IN_CB
|
||||||
#undef _LZMA_OUT_READ
|
#undef _LZMA_OUT_READ
|
||||||
#undef _LZMA_PROB32
|
#undef _LZMA_PROB32
|
||||||
#undef _LZMA_LOC_OPT
|
#undef _LZMA_LOC_OPT
|
||||||
#if (WITH_LZMA >= 0x449)
|
#include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
|
||||||
# include "C/Compress/Lzma/LzmaDecode.h"
|
#include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
|
||||||
# include "C/Compress/Lzma/LzmaDecode.c"
|
|
||||||
#else
|
|
||||||
# include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
|
|
||||||
# include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
@@ -684,14 +429,6 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
|||||||
int r = UPX_E_ERROR;
|
int r = UPX_E_ERROR;
|
||||||
int rh;
|
int rh;
|
||||||
|
|
||||||
#if (USE_LZMA_PROPERTIES)
|
|
||||||
if (src_len < 2)
|
|
||||||
goto error;
|
|
||||||
rh = LzmaDecodeProperties(&s.Properties, src, src_len);
|
|
||||||
if (rh != 0)
|
|
||||||
goto error;
|
|
||||||
src += 1; src_len -= 1;
|
|
||||||
#else
|
|
||||||
if (src_len < 3)
|
if (src_len < 3)
|
||||||
goto error;
|
goto error;
|
||||||
s.Properties.pb = src[0] & 7;
|
s.Properties.pb = src[0] & 7;
|
||||||
@@ -703,7 +440,6 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
|||||||
// extra
|
// extra
|
||||||
if ((src[0] >> 3) != s.Properties.lc + s.Properties.lp) goto error;
|
if ((src[0] >> 3) != s.Properties.lc + s.Properties.lp) goto error;
|
||||||
src += 2; src_len -= 2;
|
src += 2; src_len -= 2;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (cresult)
|
if (cresult)
|
||||||
{
|
{
|
||||||
@@ -738,8 +474,6 @@ error:
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* (WITH_LZMA < 0x461) */
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// test_overlap - see <ucl/ucl.h> for semantics
|
// test_overlap - see <ucl/ucl.h> for semantics
|
||||||
@@ -764,7 +498,7 @@ int upx_lzma_test_overlap ( const upx_bytep buf,
|
|||||||
return UPX_E_ERROR;
|
return UPX_E_ERROR;
|
||||||
// NOTE: there is a very tiny possibility that decompression has
|
// NOTE: there is a very tiny possibility that decompression has
|
||||||
// succeeded but the data is not restored correctly because of
|
// succeeded but the data is not restored correctly because of
|
||||||
// in-place buffer overlapping.
|
// in-place buffer overlapping, so we use an extra memcmp().
|
||||||
if (tbuf != NULL && memcmp(tbuf, b, *dst_len) != 0)
|
if (tbuf != NULL && memcmp(tbuf, b, *dst_len) != 0)
|
||||||
return UPX_E_ERROR;
|
return UPX_E_ERROR;
|
||||||
return UPX_E_OK;
|
return UPX_E_OK;
|
||||||
@@ -775,15 +509,14 @@ int upx_lzma_test_overlap ( const upx_bytep buf,
|
|||||||
// misc
|
// misc
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_lzma_init(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const char *upx_lzma_version_string(void)
|
const char *upx_lzma_version_string(void)
|
||||||
{
|
{
|
||||||
#if (WITH_LZMA >= 0x461)
|
#if (WITH_LZMA == 0x443)
|
||||||
return MY_VERSION;
|
|
||||||
#elif (WITH_LZMA + 0 == 0x457)
|
|
||||||
return "4.57";
|
|
||||||
#elif (WITH_LZMA + 0 == 0x449)
|
|
||||||
return "4.49";
|
|
||||||
#elif (WITH_LZMA + 0 == 0x443)
|
|
||||||
return "4.43";
|
return "4.43";
|
||||||
#else
|
#else
|
||||||
# error "unknown WITH_LZMA version"
|
# error "unknown WITH_LZMA version"
|
||||||
@@ -792,8 +525,4 @@ const char *upx_lzma_version_string(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* WITH_LZMA */
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+33
-7
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ int compress_ucl_dummy = 0;
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#if 1 && !(UCL_USE_ASM) && (ACC_ARCH_I386)
|
#if 1 && !(UCL_USE_ASM) && (ACC_ARCH_I386)
|
||||||
# if (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_WATCOMC)
|
# if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_WATCOMC)
|
||||||
# define UCL_USE_ASM 1
|
# define UCL_USE_ASM 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -281,14 +281,40 @@ int upx_ucl_test_overlap ( const upx_bytep buf,
|
|||||||
// misc
|
// misc
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
static ucl_voidp __UCL_CDECL my_malloc(ucl_uint n) { return calloc(1, n); }
|
||||||
|
static void __UCL_CDECL my_free(ucl_voidp p) { free(p); }
|
||||||
|
}
|
||||||
|
|
||||||
|
int upx_ucl_init(void)
|
||||||
|
{
|
||||||
|
if (ucl_init() != UCL_E_OK)
|
||||||
|
return -1;
|
||||||
|
#if defined(UPX_OFFICIAL_BUILD)
|
||||||
|
if (UCL_VERSION != ucl_version())
|
||||||
|
return -2;
|
||||||
|
#endif
|
||||||
|
ucl_set_malloc_hooks(my_malloc, my_free);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const char *upx_ucl_version_string(void)
|
const char *upx_ucl_version_string(void)
|
||||||
{
|
{
|
||||||
return ucl_version_string();
|
return ucl_version_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned upx_ucl_adler32(const void *buf, unsigned len, unsigned adler)
|
||||||
|
{
|
||||||
|
return ucl_adler32(adler, (const ucl_bytep) buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0 /* UNUSED */
|
||||||
|
unsigned upx_ucl_crc32(const void *buf, unsigned len, unsigned crc)
|
||||||
|
{
|
||||||
|
return ucl_crc32(crc, (const ucl_bytep) buf, len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* WITH_UCL */
|
#endif /* WITH_UCL */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|||||||
+30
-9
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
z_stream s;
|
z_stream s;
|
||||||
s.zalloc = (alloc_func) 0;
|
s.zalloc = (alloc_func) 0;
|
||||||
s.zfree = (free_func) 0;
|
s.zfree = (free_func) 0;
|
||||||
s.next_in = const_cast<upx_bytep>(src); // UNCONST
|
s.next_in = ACC_UNCONST_CAST(upx_bytep, src);
|
||||||
s.avail_in = src_len;
|
s.avail_in = src_len;
|
||||||
s.next_out = dst;
|
s.next_out = dst;
|
||||||
s.avail_out = *dst_len;
|
s.avail_out = *dst_len;
|
||||||
@@ -153,7 +153,7 @@ int upx_zlib_decompress ( const upx_bytep src, unsigned src_len,
|
|||||||
z_stream s;
|
z_stream s;
|
||||||
s.zalloc = (alloc_func) 0;
|
s.zalloc = (alloc_func) 0;
|
||||||
s.zfree = (free_func) 0;
|
s.zfree = (free_func) 0;
|
||||||
s.next_in = const_cast<upx_bytep>(src); // UNCONST
|
s.next_in = ACC_UNCONST_CAST(upx_bytep, src);
|
||||||
s.avail_in = src_len;
|
s.avail_in = src_len;
|
||||||
s.next_out = dst;
|
s.next_out = dst;
|
||||||
s.avail_out = *dst_len;
|
s.avail_out = *dst_len;
|
||||||
@@ -211,7 +211,7 @@ int upx_zlib_test_overlap ( const upx_bytep buf,
|
|||||||
return UPX_E_ERROR;
|
return UPX_E_ERROR;
|
||||||
// NOTE: there is a very tiny possibility that decompression has
|
// NOTE: there is a very tiny possibility that decompression has
|
||||||
// succeeded but the data is not restored correctly because of
|
// succeeded but the data is not restored correctly because of
|
||||||
// in-place buffer overlapping.
|
// in-place buffer overlapping, so we use an extra memcmp().
|
||||||
if (tbuf != NULL && memcmp(tbuf, b, *dst_len) != 0)
|
if (tbuf != NULL && memcmp(tbuf, b, *dst_len) != 0)
|
||||||
return UPX_E_ERROR;
|
return UPX_E_ERROR;
|
||||||
return UPX_E_OK;
|
return UPX_E_OK;
|
||||||
@@ -222,14 +222,35 @@ int upx_zlib_test_overlap ( const upx_bytep buf,
|
|||||||
// misc
|
// misc
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_zlib_init(void)
|
||||||
|
{
|
||||||
|
#if defined(UPX_OFFICIAL_BUILD)
|
||||||
|
if (strcmp(ZLIB_VERSION, zlibVersion()) != 0)
|
||||||
|
return -2;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const char *upx_zlib_version_string(void)
|
const char *upx_zlib_version_string(void)
|
||||||
{
|
{
|
||||||
return zlibVersion();
|
return zlibVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 /* UNUSED */
|
||||||
|
unsigned upx_zlib_adler32(const void *buf, unsigned len, unsigned adler)
|
||||||
|
{
|
||||||
|
return adler32(adler, (const Bytef *) buf, len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0 /* UNUSED */
|
||||||
|
unsigned upx_zlib_crc32(const void *buf, unsigned len, unsigned crc)
|
||||||
|
{
|
||||||
|
return crc32(crc, (const Bytef *) buf, len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* WITH_ZLIB */
|
#endif /* WITH_ZLIB */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|||||||
+123
-240
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,123 +31,79 @@
|
|||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#if !defined(_FILE_OFFSET_BITS)
|
||||||
|
# define _FILE_OFFSET_BITS 64
|
||||||
|
#endif
|
||||||
|
#undef NDEBUG
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// ACC
|
// ACC
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if (defined(_WIN32) || defined(_WIN64)) && defined(_MSC_VER)
|
#ifndef ACC_CFG_USE_NEW_STYLE_CASTS
|
||||||
#ifndef _CRT_NONSTDC_NO_DEPRECATE
|
#define ACC_CFG_USE_NEW_STYLE_CASTS 1
|
||||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef _CRT_NONSTDC_NO_WARNINGS
|
#define ACC_CFG_PREFER_TYPEOF_ACC_INT32E_T ACC_TYPEOF_INT
|
||||||
#define _CRT_NONSTDC_NO_WARNINGS 1
|
#define ACC_CFG_PREFER_TYPEOF_ACC_INT64E_T ACC_TYPEOF_LONG_LONG
|
||||||
|
#include "miniacc.h"
|
||||||
|
#if !(ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_MSC)
|
||||||
|
// other compilers may work, but we're NOT interested into supporting them
|
||||||
|
# error "only clang and gcc are officially supported"
|
||||||
#endif
|
#endif
|
||||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
// UPX sanity checks for a sane compiler
|
||||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
#if !defined(UINT_MAX) || (UINT_MAX != 0xffffffffL)
|
||||||
#endif
|
# error "UINT_MAX"
|
||||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS 1
|
|
||||||
#endif
|
#endif
|
||||||
|
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4)
|
||||||
|
ACC_COMPILE_TIME_ASSERT_HEADER((1u << 31) << 1 == 0)
|
||||||
|
ACC_COMPILE_TIME_ASSERT_HEADER(((int)(1u << 31)) >> 31 == -1) // arithmetic right shift
|
||||||
|
ACC_COMPILE_TIME_ASSERT_HEADER(CHAR_MAX == 255) // -funsigned-char
|
||||||
|
ACC_COMPILE_TIME_ASSERT_HEADER((char)(-1) > 0) // -funsigned-char
|
||||||
|
|
||||||
|
#if (ACC_CC_MSC)
|
||||||
|
# pragma warning(error: 4127)
|
||||||
|
# pragma warning(error: 4146)
|
||||||
|
# pragma warning(error: 4319)
|
||||||
|
# pragma warning(error: 4805)
|
||||||
|
# pragma warning(disable: 4244) // -Wconversion
|
||||||
|
# pragma warning(disable: 4267) // -Wconversion
|
||||||
|
# pragma warning(disable: 4820) // padding added after data member
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "miniacc.h"
|
|
||||||
#if ((ACC_OS_WIN32 || ACC_OS_WIN64) && ACC_CC_MWERKS) && defined(__MSL__)
|
|
||||||
# undef HAVE_UTIME_H /* this pulls in <windows.h> */
|
|
||||||
#endif
|
|
||||||
// FIXME - quick hack for arm-wince-gcc-3.4 (Debian pocketpc-*.deb packages)
|
// FIXME - quick hack for arm-wince-gcc-3.4 (Debian pocketpc-*.deb packages)
|
||||||
#if 1 && (ACC_ARCH_ARM) && defined(__pe__) && !defined(_WIN32)
|
#if 1 && (ACC_ARCH_ARM) && defined(__pe__) && !defined(__CEGCC__) && !defined(_WIN32)
|
||||||
# undef HAVE_CHMOD
|
# undef HAVE_CHMOD
|
||||||
# undef HAVE_CHOWN
|
# undef HAVE_CHOWN
|
||||||
# undef HAVE_LSTAT
|
# undef HAVE_LSTAT
|
||||||
# undef HAVE_UTIME
|
# undef HAVE_UTIME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// pragmas
|
|
||||||
#if (ACC_CC_BORLANDC)
|
|
||||||
# if (__BORLANDC__ < 0x0500)
|
|
||||||
# error "need Borland C++ 5.0 or newer"
|
|
||||||
# endif
|
|
||||||
# pragma warn -aus // 8004: 'x' is assigned a value that is never used
|
|
||||||
# pragma warn -inl // 8026+8027: Function not expanded inline
|
|
||||||
// Borland compilers typically produce a number of bogus warnings, and
|
|
||||||
// the actual diagnostics vary from version to version...
|
|
||||||
# if (__BORLANDC__ < 0x0530)
|
|
||||||
# pragma warn -csu // 8012: Comparing signed and unsigned values
|
|
||||||
# endif
|
|
||||||
# if (__BORLANDC__ >= 0x0530 && __BORLANDC__ < 0x0560)
|
|
||||||
# pragma warn -osh // 8055: Possible overflow in shift operation
|
|
||||||
# endif
|
|
||||||
# if (__BORLANDC__ >= 0x0560)
|
|
||||||
# pragma warn -use // 8080: 'x' is declared but never used
|
|
||||||
# endif
|
|
||||||
#elif (ACC_CC_DMC)
|
|
||||||
# if (__DMC__ < 0x829)
|
|
||||||
# error "need Digital Mars C++ 8.29 or newer"
|
|
||||||
# endif
|
|
||||||
#elif (ACC_CC_INTELC)
|
|
||||||
# if (__INTEL_COMPILER < 450)
|
|
||||||
# error "need Intel C++ 4.5 or newer"
|
|
||||||
# endif
|
|
||||||
# if (ACC_OS_WIN32 || ACC_OS_WIN64)
|
|
||||||
# elif defined(__linux__)
|
|
||||||
# pragma warning(error: 424) // #424: extra ";" ignored
|
|
||||||
//# pragma warning(disable: 128) // #128: loop is not reachable from preceding code
|
|
||||||
//# pragma warning(disable: 181) // #181: argument is incompatible with corresponding format string conversion
|
|
||||||
# pragma warning(disable: 193) // #193: zero used for undefined preprocessing identifier
|
|
||||||
# pragma warning(disable: 810) // #810: conversion from "A" to "B" may lose significant bits
|
|
||||||
# pragma warning(disable: 981) // #981: operands are evaluated in unspecified order
|
|
||||||
# pragma warning(disable: 1418) // #1418: external function definition with no prior declaration
|
|
||||||
//# pragma warning(disable: 1419) // #1419: external declaration in primary source file
|
|
||||||
# else
|
|
||||||
# error "untested platform"
|
|
||||||
# endif
|
|
||||||
#elif (ACC_CC_MSC)
|
|
||||||
# if (_MSC_VER < 1100)
|
|
||||||
# error "need Visual C++ 5.0 or newer"
|
|
||||||
# endif
|
|
||||||
# pragma warning(error: 4096) // W2: '__cdecl' must be used with '...'
|
|
||||||
# pragma warning(error: 4138) // Wx: '*/' found outside of comment
|
|
||||||
# pragma warning(disable: 4097) // W3: typedef-name 'A' used as synonym for class-name 'B'
|
|
||||||
# pragma warning(disable: 4511) // W3: 'class': copy constructor could not be generated
|
|
||||||
# pragma warning(disable: 4512) // W4: 'class': assignment operator could not be generated
|
|
||||||
# pragma warning(disable: 4514) // W4: 'function': unreferenced inline function has been removed
|
|
||||||
# pragma warning(disable: 4710) // W4: 'function': function not inlined
|
|
||||||
# if (_MSC_VER >= 1300)
|
|
||||||
# pragma warning(disable: 4625) // W4: 'class' : copy constructor could not be generated because a base class copy constructor is inaccessible
|
|
||||||
# pragma warning(disable: 4626) // W4: 'class' : assignment operator could not be generated because a base class assignment operator is inaccessible
|
|
||||||
# pragma warning(disable: 4711) // W4: 'function' selected for automatic inline expansion
|
|
||||||
# pragma warning(disable: 4820) // W4: 'struct' : 'x' bytes padding added after member 'member'
|
|
||||||
# endif
|
|
||||||
# if (_MSC_VER >= 1400)
|
|
||||||
# pragma warning(disable: 4996) // W1: 'function': was declared deprecated
|
|
||||||
# endif
|
|
||||||
#elif (ACC_CC_SUNPROC)
|
|
||||||
//# pragma error_messages(off,"badargtype2w") // FIXME
|
|
||||||
#elif (ACC_CC_WATCOMC)
|
|
||||||
# if (__WATCOMC__ < 1280)
|
|
||||||
# error "need Open Watcom C++ 1.8 or newer" // because earlier versions do not support nested classes
|
|
||||||
# endif
|
|
||||||
# if defined(__cplusplus)
|
|
||||||
# pragma warning 367 9 // w3: conditional expression in if statement is always true
|
|
||||||
# pragma warning 368 9 // w3: conditional expression in if statement is always false
|
|
||||||
# pragma warning 389 9 // w3: integral value may be truncated
|
|
||||||
# pragma warning 656 9 // w5: define this function inside its class definition (may improve code quality)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define ACC_WANT_ACC_INCD_H 1
|
#define ACC_WANT_ACC_INCD_H 1
|
||||||
#define ACC_WANT_ACC_INCE_H 1
|
#define ACC_WANT_ACC_INCE_H 1
|
||||||
#define ACC_WANT_ACC_LIB_H 1
|
#define ACC_WANT_ACC_LIB_H 1
|
||||||
#define ACC_WANT_ACC_CXX_H 1
|
#define ACC_WANT_ACC_CXX_H 1
|
||||||
#include "miniacc.h"
|
#include "miniacc.h"
|
||||||
#if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
|
||||||
# if defined(INVALID_HANDLE_VALUE) || defined(MAKEWORD) || defined(RT_CURSOR)
|
/* intergral types */
|
||||||
# error "something pulled in <windows.h>"
|
typedef acc_int8_t upx_int8_t;
|
||||||
# endif
|
typedef acc_uint8_t upx_uint8_t;
|
||||||
#endif
|
typedef acc_int16_t upx_int16_t;
|
||||||
|
typedef acc_uint16_t upx_uint16_t;
|
||||||
|
typedef acc_int32_t upx_int32_t;
|
||||||
|
typedef acc_uint32_t upx_uint32_t;
|
||||||
|
typedef acc_int64_t upx_int64_t;
|
||||||
|
typedef acc_uint64_t upx_uint64_t;
|
||||||
|
typedef acc_uintptr_t upx_uintptr_t;
|
||||||
|
#define UPX_INT16_C ACC_INT16_C
|
||||||
|
#define UPX_UINT16_C ACC_UINT16_C
|
||||||
|
#define UPX_INT32_C ACC_INT32_C
|
||||||
|
#define UPX_UINT32_C ACC_UINT32_C
|
||||||
|
#define UPX_INT64_C ACC_INT64_C
|
||||||
|
#define UPX_UINT64_C ACC_UINT64_C
|
||||||
|
|
||||||
|
typedef unsigned char upx_byte;
|
||||||
|
#define upx_bytep upx_byte *
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -162,40 +118,20 @@
|
|||||||
#undef _
|
#undef _
|
||||||
#undef __
|
#undef __
|
||||||
#undef ___
|
#undef ___
|
||||||
#undef NDEBUG
|
|
||||||
#undef dos
|
#undef dos
|
||||||
#undef linux
|
#undef linux
|
||||||
#undef small
|
#undef small
|
||||||
#undef tos
|
#undef tos
|
||||||
#if (ACC_CC_DMC)
|
#undef unix
|
||||||
# undef tell
|
|
||||||
#endif
|
|
||||||
#if !(ACC_CC_PGI)
|
|
||||||
# undef unix
|
|
||||||
#endif
|
|
||||||
#if defined(__DJGPP__)
|
#if defined(__DJGPP__)
|
||||||
# undef sopen
|
# undef sopen
|
||||||
# undef __unix__
|
# undef __unix__
|
||||||
# undef __unix
|
# undef __unix
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(WITH_UCL)
|
#define WITH_LZMA 0x443
|
||||||
# define WITH_UCL 1
|
#define WITH_UCL 1
|
||||||
#endif
|
#define WITH_ZLIB 1
|
||||||
#if 0 && !defined(WITH_LZMA)
|
|
||||||
# define WITH_LZMA 1
|
|
||||||
#endif
|
|
||||||
#if 1 && (ACC_CC_WATCOMC)
|
|
||||||
# undef WITH_LZMA
|
|
||||||
#endif
|
|
||||||
#if defined(UPX_OFFICIAL_BUILD)
|
|
||||||
# if !(WITH_LZMA) || !(WITH_NRV) || !(WITH_UCL)
|
|
||||||
# error
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if (WITH_NRV)
|
|
||||||
# include <nrv/nrvconf.h>
|
|
||||||
#endif
|
|
||||||
#if (WITH_UCL)
|
#if (WITH_UCL)
|
||||||
# define ucl_compress_config_t REAL_ucl_compress_config_t
|
# define ucl_compress_config_t REAL_ucl_compress_config_t
|
||||||
# include <ucl/uclconf.h>
|
# include <ucl/uclconf.h>
|
||||||
@@ -206,42 +142,32 @@
|
|||||||
# undef ucl_compress_config_t
|
# undef ucl_compress_config_t
|
||||||
# undef ucl_compress_config_p
|
# undef ucl_compress_config_p
|
||||||
#endif
|
#endif
|
||||||
#if !defined(UINT_MAX) || (UINT_MAX < 0xffffffffL)
|
|
||||||
# error "UINT_MAX"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define upx_byte unsigned char
|
|
||||||
#define upx_bytep upx_byte *
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
// system includes
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
// malloc debuggers
|
// malloc debuggers
|
||||||
#if (WITH_VALGRIND)
|
#if (WITH_VALGRIND)
|
||||||
# include <valgrind/memcheck.h>
|
# include <valgrind/memcheck.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(VALGRIND_MAKE_MEM_DEFINED)
|
||||||
#if !defined(VALGRIND_MAKE_WRITABLE)
|
# define VALGRIND_MAKE_MEM_DEFINED(addr,len) 0
|
||||||
# define VALGRIND_MAKE_WRITABLE(addr,len) 0
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(VALGRIND_MAKE_READABLE)
|
#if !defined(VALGRIND_MAKE_MEM_NOACCESS)
|
||||||
# if 0
|
# define VALGRIND_MAKE_MEM_NOACCESS(addr,len) 0
|
||||||
# define VALGRIND_MAKE_READABLE(addr,len) (memset(addr,0,len), 0)
|
|
||||||
# else
|
|
||||||
# define VALGRIND_MAKE_READABLE(addr,len) 0
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(VALGRIND_DISCARD)
|
#if !defined(VALGRIND_MAKE_MEM_UNDEFINED)
|
||||||
# define VALGRIND_DISCARD(handle) ((void)(&handle))
|
# define VALGRIND_MAKE_MEM_UNDEFINED(addr,len) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// IMPORTANT: unconditionally enable assertions
|
||||||
// unconditionally turn on assertions
|
|
||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
// protect against integer overflows and malicious header fields
|
||||||
|
// see C 11 standard, Annex K
|
||||||
|
typedef size_t upx_rsize_t;
|
||||||
|
#define UPX_RSIZE_MAX UPX_RSIZE_MAX_MEM
|
||||||
|
#define UPX_RSIZE_MAX_MEM (768 * 1024 * 1024) // DO NOT CHANGE
|
||||||
|
#define UPX_RSIZE_MAX_STR (1024 * 1024)
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// portab
|
// portab
|
||||||
@@ -257,7 +183,6 @@
|
|||||||
# define STDERR_FILENO (fileno(stderr))
|
# define STDERR_FILENO (fileno(stderr))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !(HAVE_STRCASECMP) && (HAVE_STRICMP)
|
#if !(HAVE_STRCASECMP) && (HAVE_STRICMP)
|
||||||
# define strcasecmp stricmp
|
# define strcasecmp stricmp
|
||||||
#endif
|
#endif
|
||||||
@@ -265,7 +190,6 @@
|
|||||||
# define strncasecmp strnicmp
|
# define strncasecmp strnicmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(S_IWUSR) && defined(_S_IWUSR)
|
#if !defined(S_IWUSR) && defined(_S_IWUSR)
|
||||||
# define S_IWUSR _S_IWUSR
|
# define S_IWUSR _S_IWUSR
|
||||||
#elif !defined(S_IWUSR) && defined(_S_IWRITE)
|
#elif !defined(S_IWUSR) && defined(_S_IWRITE)
|
||||||
@@ -305,7 +229,6 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// avoid warnings about shadowing global functions
|
// avoid warnings about shadowing global functions
|
||||||
#undef index
|
#undef index
|
||||||
#define basename upx_basename
|
#define basename upx_basename
|
||||||
@@ -315,6 +238,11 @@
|
|||||||
#undef PAGE_MASK
|
#undef PAGE_MASK
|
||||||
#undef PAGE_SIZE
|
#undef PAGE_SIZE
|
||||||
|
|
||||||
|
#if !defined(O_BINARY) || (O_BINARY+0 == 0)
|
||||||
|
# if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
|
# error "missing O_BINARY"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
#if !defined(O_BINARY)
|
#if !defined(O_BINARY)
|
||||||
# define O_BINARY 0
|
# define O_BINARY 0
|
||||||
#endif
|
#endif
|
||||||
@@ -324,27 +252,20 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (ACC_CC_INTELC && (__INTEL_COMPILER < 800))
|
|
||||||
#elif (0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386))
|
|
||||||
#elif (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE)
|
|
||||||
# define __packed_struct(s) struct s {
|
|
||||||
# define __packed_struct_end() } __attribute__((__packed__,__aligned__(1)));
|
|
||||||
#elif (ACC_CC_WATCOMC)
|
|
||||||
# define __packed_struct(s) _Packed struct s {
|
|
||||||
# define __packed_struct_end() };
|
|
||||||
#endif
|
|
||||||
#if !defined(__packed_struct)
|
|
||||||
# define __packed_struct(s) struct s {
|
|
||||||
# define __packed_struct_end() };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#define UNUSED(var) ACC_UNUSED(var)
|
#if (ACC_CC_MSC)
|
||||||
#define COMPILE_TIME_ASSERT(e) ACC_COMPILE_TIME_ASSERT(e)
|
#define __packed_struct(s) struct s {
|
||||||
|
#define __packed_struct_end() };
|
||||||
|
#else
|
||||||
|
#define __packed_struct(s) __acc_struct_packed(s)
|
||||||
|
#define __packed_struct_end() __acc_struct_packed_end()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UNUSED(var) ACC_UNUSED(var)
|
||||||
|
#define COMPILE_TIME_ASSERT(e) ACC_COMPILE_TIME_ASSERT(e)
|
||||||
|
|
||||||
#define __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b) { \
|
#define __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b) { \
|
||||||
typedef a acc_tmp_a_t; typedef b acc_tmp_b_t; \
|
typedef a acc_tmp_a_t; typedef b acc_tmp_b_t; \
|
||||||
@@ -365,47 +286,28 @@
|
|||||||
#define TABLESIZE(table) ((sizeof(table)/sizeof((table)[0])))
|
#define TABLESIZE(table) ((sizeof(table)/sizeof((table)[0])))
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define ALIGN_DOWN(a,b) (((a) / (b)) * (b))
|
|
||||||
#define ALIGN_UP(a,b) ALIGN_DOWN((a) + ((b) - 1), b)
|
|
||||||
#define ALIGN_GAP(a,b) (ALIGN_UP(a,b) - (a))
|
|
||||||
#elif 1
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T ALIGN_DOWN(const T& a, const T& b) { T r; r = (a / b) * b; return r; }
|
inline T ALIGN_DOWN(const T& a, const T& b) { T r; r = (a / b) * b; return r; }
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T ALIGN_UP (const T& a, const T& b) { T r; r = ((a + b - 1) / b) * b; return r; }
|
inline T ALIGN_UP (const T& a, const T& b) { T r; r = ((a + b - 1) / b) * b; return r; }
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T ALIGN_GAP (const T& a, const T& b) { T r; r = ALIGN_UP(a, b) - a; return r; }
|
inline T ALIGN_GAP (const T& a, const T& b) { T r; r = ALIGN_UP(a, b) - a; return r; }
|
||||||
#else
|
|
||||||
inline unsigned ALIGN_DOWN(unsigned a, unsigned b) { return (a / b) * b; }
|
|
||||||
inline unsigned ALIGN_UP (unsigned a, unsigned b) { return ((a + b - 1) / b) * b; }
|
|
||||||
inline unsigned ALIGN_GAP (unsigned a, unsigned b) { return ALIGN_UP(a, b) - a; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define UPX_MAX(a,b) ((a) >= (b) ? (a) : (b))
|
|
||||||
#define UPX_MIN(a,b) ((a) <= (b) ? (a) : (b))
|
|
||||||
#elif 1
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline const T& UPX_MAX(const T& a, const T& b) { if (a < b) return b; return a; }
|
inline const T& UPX_MAX(const T& a, const T& b) { if (a < b) return b; return a; }
|
||||||
template <class T>
|
template <class T>
|
||||||
inline const T& UPX_MIN(const T& a, const T& b) { if (a < b) return a; return b; }
|
inline const T& UPX_MIN(const T& a, const T& b) { if (a < b) return a; return b; }
|
||||||
#else
|
|
||||||
inline unsigned UPX_MAX(unsigned a, unsigned b) { return a < b ? b : a; }
|
|
||||||
inline unsigned UPX_MIN(unsigned a, unsigned b) { return a < b ? a : b; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// An Array allocates memory on the heap, but automatically
|
// An Array allocates memory on the heap, but automatically
|
||||||
// gets destructed when leaving scope or on exceptions.
|
// gets destructed when leaving scope or on exceptions.
|
||||||
#define Array(type, var, size) \
|
#define Array(type, var, size) \
|
||||||
assert((int)(size) > 0); \
|
MemBuffer var ## _membuf(mem_size(sizeof(type), size)); \
|
||||||
MemBuffer var ## _membuf((size)*(sizeof(type))); \
|
type * const var = ACC_STATIC_CAST(type *, var ## _membuf.getVoidPtr())
|
||||||
type * const var = ((type *) var ## _membuf.getVoidPtr())
|
|
||||||
|
|
||||||
#define ByteArray(var, size) Array(unsigned char, var, size)
|
#define ByteArray(var, size) Array(unsigned char, var, size)
|
||||||
|
|
||||||
struct noncopyable
|
class noncopyable
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
inline noncopyable() {}
|
inline noncopyable() {}
|
||||||
@@ -459,18 +361,18 @@ private:
|
|||||||
#define UPX_F_DOS_EXE 3
|
#define UPX_F_DOS_EXE 3
|
||||||
#define UPX_F_DJGPP2_COFF 4
|
#define UPX_F_DJGPP2_COFF 4
|
||||||
#define UPX_F_WATCOM_LE 5
|
#define UPX_F_WATCOM_LE 5
|
||||||
#define UPX_F_VXD_LE 6
|
#define UPX_F_VXD_LE 6 // NOT IMPLEMENTED
|
||||||
#define UPX_F_DOS_EXEH 7 /* OBSOLETE */
|
#define UPX_F_DOS_EXEH 7 // OBSOLETE
|
||||||
#define UPX_F_TMT_ADAM 8
|
#define UPX_F_TMT_ADAM 8
|
||||||
#define UPX_F_WIN32_PE 9
|
#define UPX_F_WIN32_PE 9
|
||||||
#define UPX_F_LINUX_i386 10
|
#define UPX_F_LINUX_i386 10
|
||||||
#define UPX_F_WIN16_NE 11
|
#define UPX_F_WIN16_NE 11 // NOT IMPLEMENTED
|
||||||
#define UPX_F_LINUX_ELF_i386 12
|
#define UPX_F_LINUX_ELF_i386 12
|
||||||
#define UPX_F_LINUX_SEP_i386 13
|
#define UPX_F_LINUX_SEP_i386 13 // NOT IMPLEMENTED
|
||||||
#define UPX_F_LINUX_SH_i386 14
|
#define UPX_F_LINUX_SH_i386 14
|
||||||
#define UPX_F_VMLINUZ_i386 15
|
#define UPX_F_VMLINUZ_i386 15
|
||||||
#define UPX_F_BVMLINUZ_i386 16
|
#define UPX_F_BVMLINUZ_i386 16
|
||||||
#define UPX_F_ELKS_8086 17
|
#define UPX_F_ELKS_8086 17 // NOT IMPLEMENTED
|
||||||
#define UPX_F_PS1_EXE 18
|
#define UPX_F_PS1_EXE 18
|
||||||
#define UPX_F_VMLINUX_i386 19
|
#define UPX_F_VMLINUX_i386 19
|
||||||
#define UPX_F_LINUX_ELFI_i386 20
|
#define UPX_F_LINUX_ELFI_i386 20
|
||||||
@@ -492,10 +394,17 @@ private:
|
|||||||
#define UPX_F_MACH_AMD64 34
|
#define UPX_F_MACH_AMD64 34
|
||||||
#define UPX_F_DYLIB_AMD64 35
|
#define UPX_F_DYLIB_AMD64 35
|
||||||
|
|
||||||
#define UPX_F_PLAIN_TEXT 127
|
#define UPX_F_WIN64_PEP 36
|
||||||
|
|
||||||
|
#define UPX_F_MACH_ARM64EL 37
|
||||||
|
|
||||||
|
#define UPX_F_MACH_PPC64LE 38
|
||||||
|
#define UPX_F_LINUX_ELFPPC64LE 39
|
||||||
|
#define UPX_F_VMLINUX_PPC64LE 40
|
||||||
|
#define UPX_F_DYLIB_PPC64LE 41
|
||||||
|
|
||||||
#define UPX_F_ATARI_TOS 129
|
#define UPX_F_ATARI_TOS 129
|
||||||
#define UPX_F_SOLARIS_SPARC 130
|
#define UPX_F_SOLARIS_SPARC 130 // NOT IMPLEMENTED
|
||||||
#define UPX_F_MACH_PPC32 131
|
#define UPX_F_MACH_PPC32 131
|
||||||
#define UPX_F_LINUX_ELFPPC32 132
|
#define UPX_F_LINUX_ELFPPC32 132
|
||||||
#define UPX_F_LINUX_ELF32_ARMEB 133
|
#define UPX_F_LINUX_ELF32_ARMEB 133
|
||||||
@@ -548,13 +457,7 @@ private:
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
struct upx_callback_t;
|
struct upx_callback_t;
|
||||||
#define upx_callback_p upx_callback_t *
|
typedef upx_callback_t *upx_callback_p;
|
||||||
#if 0
|
|
||||||
typedef void* (__acc_cdecl *upx_alloc_func_t)
|
|
||||||
(upx_callback_p self, unsigned items, unsigned size);
|
|
||||||
typedef void (__acc_cdecl *upx_free_func_t)
|
|
||||||
(upx_callback_p self, void* ptr);
|
|
||||||
#endif
|
|
||||||
typedef void (__acc_cdecl *upx_progress_func_t)
|
typedef void (__acc_cdecl *upx_progress_func_t)
|
||||||
(upx_callback_p, unsigned, unsigned);
|
(upx_callback_p, unsigned, unsigned);
|
||||||
|
|
||||||
@@ -574,14 +477,16 @@ struct upx_callback_t
|
|||||||
template <class T, T default_value, T min_value, T max_value>
|
template <class T, T default_value, T min_value, T max_value>
|
||||||
struct OptVar
|
struct OptVar
|
||||||
{
|
{
|
||||||
typedef T Type;
|
typedef T value_type;
|
||||||
static const T default_value_c = default_value;
|
static const T default_value_c = default_value;
|
||||||
static const T min_value_c = min_value;
|
static const T min_value_c = min_value;
|
||||||
static const T max_value_c = max_value;
|
static const T max_value_c = max_value;
|
||||||
|
|
||||||
void assertValue() {
|
void assertValue() const {
|
||||||
// FIXME: this generates annoying warnings "unsigned >= 0 is always true"
|
// info: this generates annoying warnings "unsigned >= 0 is always true"
|
||||||
//assert((v >= min_value) && (v <= max_value));
|
//assert(v >= min_value_c);
|
||||||
|
assert(v == min_value_c || v >= min_value_c + 1);
|
||||||
|
assert(v <= max_value_c);
|
||||||
}
|
}
|
||||||
|
|
||||||
OptVar() : v(default_value), is_set(0) { }
|
OptVar() : v(default_value), is_set(0) { }
|
||||||
@@ -590,15 +495,6 @@ struct OptVar
|
|||||||
assertValue();
|
assertValue();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
#error
|
|
||||||
// there is too much implicit magic in this copy operator;
|
|
||||||
// better introduce an explicit "oassign" function.
|
|
||||||
OptVar& operator= (const OptVar& other) {
|
|
||||||
if (other.is_set) { v = other.v; is_set += 1; }
|
|
||||||
assertValue(); return *this;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void reset() { v = default_value; is_set = 0; }
|
void reset() { v = default_value; is_set = 0; }
|
||||||
operator T () const { return v; }
|
operator T () const { return v; }
|
||||||
@@ -609,24 +505,20 @@ struct OptVar
|
|||||||
|
|
||||||
|
|
||||||
// optional assignments
|
// optional assignments
|
||||||
template <class T> inline void oassign(T& self, const T& other) {
|
template <class T, T a, T b, T c>
|
||||||
|
inline void oassign(OptVar<T,a,b,c> &self, const OptVar<T,a,b,c> &other) {
|
||||||
if (other.is_set) { self.v = other.v; self.is_set += 1; }
|
if (other.is_set) { self.v = other.v; self.is_set += 1; }
|
||||||
}
|
}
|
||||||
#if 0
|
template <class T, T a, T b, T c>
|
||||||
template <class V, class T> inline void oassign(V& v, const T& other) {
|
inline void oassign(unsigned &v, const OptVar<T,a,b,c> &other) {
|
||||||
if (other.is_set) { v = other.v; }
|
if (other.is_set) { v = other.v; }
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
template <class T> inline void oassign(unsigned& v, const T& other) {
|
|
||||||
if (other.is_set) { v = other.v; }
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
struct lzma_compress_config_t
|
struct lzma_compress_config_t
|
||||||
{
|
{
|
||||||
typedef OptVar<unsigned, 2u, 0u, 4u> pos_bits_t; // pb
|
typedef OptVar<unsigned, 2u, 0u, 4u> pos_bits_t; // pb
|
||||||
typedef OptVar<unsigned, 0u, 0u, 4u> lit_pos_bits_t; // lb
|
typedef OptVar<unsigned, 0u, 0u, 4u> lit_pos_bits_t; // lp
|
||||||
typedef OptVar<unsigned, 3u, 0u, 8u> lit_context_bits_t; // lc
|
typedef OptVar<unsigned, 3u, 0u, 8u> lit_context_bits_t; // lc
|
||||||
typedef OptVar<unsigned, (1u<<22), 1u, (1u<<30) > dict_size_t;
|
typedef OptVar<unsigned, (1u<<22), 1u, (1u<<30) > dict_size_t;
|
||||||
typedef OptVar<unsigned, 64u, 5u, 273u> num_fast_bytes_t;
|
typedef OptVar<unsigned, 64u, 5u, 273u> num_fast_bytes_t;
|
||||||
@@ -732,10 +624,7 @@ struct upx_compress_result_t
|
|||||||
// globals
|
// globals
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "snprintf.h"
|
#include "snprintf.h" // must get included first!
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
|
|
||||||
#include "stdcxx.h"
|
#include "stdcxx.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "except.h"
|
#include "except.h"
|
||||||
@@ -751,8 +640,8 @@ typedef ElfLinker Linker;
|
|||||||
|
|
||||||
// main.cpp
|
// main.cpp
|
||||||
extern const char *progname;
|
extern const char *progname;
|
||||||
bool set_ec(int ec);
|
bool set_exit_code(int ec);
|
||||||
#if (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
void e_exit(int ec) __attribute__((__noreturn__));
|
void e_exit(int ec) __attribute__((__noreturn__));
|
||||||
#else
|
#else
|
||||||
void e_exit(int ec);
|
void e_exit(int ec);
|
||||||
@@ -764,7 +653,7 @@ void printSetNl(int need_nl);
|
|||||||
void printClearLine(FILE *f = NULL);
|
void printClearLine(FILE *f = NULL);
|
||||||
void printErr(const char *iname, const Throwable *e);
|
void printErr(const char *iname, const Throwable *e);
|
||||||
void printUnhandledException(const char *iname, const std::exception *e);
|
void printUnhandledException(const char *iname, const std::exception *e);
|
||||||
#if (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
void __acc_cdecl_va printErr(const char *iname, const char *format, ...)
|
void __acc_cdecl_va printErr(const char *iname, const char *format, ...)
|
||||||
__attribute__((__format__(__printf__,2,3)));
|
__attribute__((__format__(__printf__,2,3)));
|
||||||
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...)
|
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...)
|
||||||
@@ -774,7 +663,7 @@ void __acc_cdecl_va printErr(const char *iname, const char *format, ...);
|
|||||||
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...);
|
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
void __acc_cdecl_va infoWarning(const char *format, ...)
|
void __acc_cdecl_va infoWarning(const char *format, ...)
|
||||||
__attribute__((__format__(__printf__,1,2)));
|
__attribute__((__format__(__printf__,1,2)));
|
||||||
void __acc_cdecl_va infoHeader(const char *format, ...)
|
void __acc_cdecl_va infoHeader(const char *format, ...)
|
||||||
@@ -796,6 +685,7 @@ void do_files(int i, int argc, char *argv[]);
|
|||||||
|
|
||||||
|
|
||||||
// help.cpp
|
// help.cpp
|
||||||
|
extern const char gitrev[];
|
||||||
void show_head(void);
|
void show_head(void);
|
||||||
void show_help(int verbose=0);
|
void show_help(int verbose=0);
|
||||||
void show_license(void);
|
void show_license(void);
|
||||||
@@ -825,9 +715,6 @@ int upx_test_overlap ( const upx_bytep buf,
|
|||||||
const upx_compress_result_t *cresult );
|
const upx_compress_result_t *cresult );
|
||||||
|
|
||||||
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
#if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
# if defined(INVALID_HANDLE_VALUE) || defined(MAKEWORD) || defined(RT_CURSOR)
|
# if defined(INVALID_HANDLE_VALUE) || defined(MAKEWORD) || defined(RT_CURSOR)
|
||||||
# error "something pulled in <windows.h>"
|
# error "something pulled in <windows.h>"
|
||||||
@@ -837,8 +724,4 @@ int upx_test_overlap ( const upx_bytep buf,
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -187,8 +187,4 @@ extern console_t console_screen;
|
|||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+8
-12
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
long Throwable::counter = 0;
|
unsigned long Throwable::counter = 0;
|
||||||
|
|
||||||
Throwable::Throwable(const char *m, int e, bool w) NOTHROW
|
Throwable::Throwable(const char *m, int e, bool w) NOTHROW
|
||||||
: super(), msg(NULL), err(e), is_warning(w)
|
: super(), msg(NULL), err(e), is_warning(w)
|
||||||
@@ -41,7 +41,7 @@ Throwable::Throwable(const char *m, int e, bool w) NOTHROW
|
|||||||
if (m)
|
if (m)
|
||||||
msg = strdup(m);
|
msg = strdup(m);
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "construct exception: %s %ld\n", msg, counter);
|
fprintf(stderr, "construct exception: %s %lu\n", msg, counter);
|
||||||
counter++;
|
counter++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ Throwable::Throwable(const Throwable &other) NOTHROW
|
|||||||
if (other.msg)
|
if (other.msg)
|
||||||
msg = strdup(other.msg);
|
msg = strdup(other.msg);
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "copy exception: %s %ld\n", msg, counter);
|
fprintf(stderr, "copy exception: %s %lu\n", msg, counter);
|
||||||
counter++;
|
counter++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ Throwable::~Throwable() NOTHROW
|
|||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
counter--;
|
counter--;
|
||||||
fprintf(stderr, "destruct exception: %s %ld\n", msg, counter);
|
fprintf(stderr, "destruct exception: %s %lu\n", msg, counter);
|
||||||
#endif
|
#endif
|
||||||
if (msg)
|
if (msg)
|
||||||
free(msg);
|
free(msg);
|
||||||
@@ -205,8 +205,4 @@ const char *prettyName(const char *n) NOTHROW
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+6
-11
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ private:
|
|||||||
DISABLE_NEW_DELETE
|
DISABLE_NEW_DELETE
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static long counter; // for debugging
|
static unsigned long counter; // for debugging
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -200,8 +200,7 @@ public:
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#undef NORET
|
#undef NORET
|
||||||
#if 0 && defined(__GNUC__)
|
#if 1 && defined(__GNUC__)
|
||||||
// (noreturn) is probably not the correct semantics for throwing exceptions
|
|
||||||
#define NORET __attribute__((__noreturn__))
|
#define NORET __attribute__((__noreturn__))
|
||||||
#else
|
#else
|
||||||
#define NORET /*empty*/
|
#define NORET /*empty*/
|
||||||
@@ -231,8 +230,4 @@ void throwEOFException(const char *msg = NULL, int e = 0) NORET;
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+35
-15
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -168,8 +168,10 @@ void FileBase::write(const void *buf, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FileBase::seek(off_t off, int whence)
|
off_t FileBase::seek(upx_int64_t off64, int whence)
|
||||||
{
|
{
|
||||||
|
mem_size_assert(1, off64 >= 0 ? off64 : -off64); // sanity check
|
||||||
|
off_t off = ACC_ICONV(off_t, off64);
|
||||||
if (!isOpen())
|
if (!isOpen())
|
||||||
throwIOException("bad seek 1");
|
throwIOException("bad seek 1");
|
||||||
if (whence == SEEK_SET) {
|
if (whence == SEEK_SET) {
|
||||||
@@ -185,6 +187,7 @@ void FileBase::seek(off_t off, int whence)
|
|||||||
}
|
}
|
||||||
if (::lseek(_fd,off,whence) < 0)
|
if (::lseek(_fd,off,whence) < 0)
|
||||||
throwIOException("seek error",errno);
|
throwIOException("seek error",errno);
|
||||||
|
return off - _offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -243,6 +246,7 @@ void InputFile::sopen(const char *name, int flags, int shflags)
|
|||||||
else
|
else
|
||||||
throwIOException(_name, errno);
|
throwIOException(_name, errno);
|
||||||
}
|
}
|
||||||
|
_length_orig = _length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -283,9 +287,12 @@ int InputFile::readx(MemBuffer &buf, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InputFile::seek(off_t off, int whence)
|
off_t InputFile::seek(upx_int64_t off64, int whence)
|
||||||
{
|
{
|
||||||
super::seek(off,whence);
|
off_t pos = super::seek(off64, whence);
|
||||||
|
if (_length < pos)
|
||||||
|
throwIOException("bad seek 4");
|
||||||
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -294,6 +301,10 @@ off_t InputFile::tell() const
|
|||||||
return super::tell();
|
return super::tell();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
off_t InputFile::st_size_orig() const
|
||||||
|
{
|
||||||
|
return _length_orig;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
@@ -393,8 +404,10 @@ void OutputFile::rewrite(const void *buf, int len)
|
|||||||
bytes_written -= len; // restore
|
bytes_written -= len; // restore
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputFile::seek(off_t off, int whence)
|
off_t OutputFile::seek(upx_int64_t off64, int whence)
|
||||||
{
|
{
|
||||||
|
mem_size_assert(1, off64 >= 0 ? off64 : -off64); // sanity check
|
||||||
|
off_t off = ACC_ICONV(off_t, off64);
|
||||||
assert(!opt->to_stdout);
|
assert(!opt->to_stdout);
|
||||||
switch (whence) {
|
switch (whence) {
|
||||||
case SEEK_SET: {
|
case SEEK_SET: {
|
||||||
@@ -407,9 +420,20 @@ void OutputFile::seek(off_t off, int whence)
|
|||||||
_length = bytes_written; // necessary
|
_length = bytes_written; // necessary
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
super::seek(off,whence);
|
return super::seek(off,whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WARNING: fsync() does not exist in some Windows environments.
|
||||||
|
// This trick works only on UNIX-like systems.
|
||||||
|
//int OutputFile::read(void *buf, int len)
|
||||||
|
//{
|
||||||
|
// fsync(_fd);
|
||||||
|
// InputFile infile;
|
||||||
|
// infile.open(this->getName(), O_RDONLY | O_BINARY);
|
||||||
|
// infile.seek(this->tell(), SEEK_SET);
|
||||||
|
// return infile.read(buf, len);
|
||||||
|
//}
|
||||||
|
|
||||||
void OutputFile::set_extent(off_t offset, off_t length)
|
void OutputFile::set_extent(off_t offset, off_t length)
|
||||||
{
|
{
|
||||||
super::set_extent(offset, length);
|
super::set_extent(offset, length);
|
||||||
@@ -435,8 +459,8 @@ off_t OutputFile::unset_extent()
|
|||||||
void OutputFile::dump(const char *name, const void *buf, int len, int flags)
|
void OutputFile::dump(const char *name, const void *buf, int len, int flags)
|
||||||
{
|
{
|
||||||
if (flags < 0)
|
if (flags < 0)
|
||||||
flags = O_CREAT | O_BINARY | O_TRUNC;
|
flags = O_CREAT | O_TRUNC;
|
||||||
flags |= O_WRONLY;
|
flags |= O_WRONLY | O_BINARY;
|
||||||
OutputFile f;
|
OutputFile f;
|
||||||
f.open(name, flags, 0600);
|
f.open(name, flags, 0600);
|
||||||
f.write(buf, len);
|
f.write(buf, len);
|
||||||
@@ -472,8 +496,4 @@ void MemoryOutputFile::write(const void *buf, int len)
|
|||||||
|
|
||||||
#endif /* if 0 */
|
#endif /* if 0 */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+10
-11
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ protected:
|
|||||||
virtual int read(void *buf, int len);
|
virtual int read(void *buf, int len);
|
||||||
virtual int readx(void *buf, int len);
|
virtual int readx(void *buf, int len);
|
||||||
virtual void write(const void *buf, int len);
|
virtual void write(const void *buf, int len);
|
||||||
virtual void seek(off_t off, int whence);
|
virtual off_t seek(upx_int64_t off, int whence);
|
||||||
virtual off_t tell() const;
|
virtual off_t tell() const;
|
||||||
|
|
||||||
int _fd;
|
int _fd;
|
||||||
@@ -106,8 +106,11 @@ public:
|
|||||||
virtual int read(MemBuffer &buf, int len);
|
virtual int read(MemBuffer &buf, int len);
|
||||||
virtual int readx(MemBuffer &buf, int len);
|
virtual int readx(MemBuffer &buf, int len);
|
||||||
|
|
||||||
virtual void seek(off_t off, int whence);
|
virtual off_t seek(upx_int64_t off, int whence);
|
||||||
virtual off_t tell() const;
|
virtual off_t tell() const;
|
||||||
|
virtual off_t st_size_orig() const;
|
||||||
|
protected:
|
||||||
|
off_t _length_orig;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -139,7 +142,7 @@ public:
|
|||||||
virtual off_t st_size() const; // { return _length; }
|
virtual off_t st_size() const; // { return _length; }
|
||||||
|
|
||||||
// FIXME - these won't work when using the '--stdout' option
|
// FIXME - these won't work when using the '--stdout' option
|
||||||
virtual void seek(off_t off, int whence);
|
virtual off_t seek(upx_int64_t off, int whence);
|
||||||
virtual void rewrite(const void *buf, int len);
|
virtual void rewrite(const void *buf, int len);
|
||||||
|
|
||||||
// util
|
// util
|
||||||
@@ -182,8 +185,4 @@ protected:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -228,8 +228,4 @@ bool Filter::scan(const upx_byte *buf_, unsigned buf_len_)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -131,8 +131,4 @@ private:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-7
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -459,7 +459,4 @@ static int s_ct24arm_be(Filter *f)
|
|||||||
#undef CT24ARM_BE
|
#undef CT24ARM_BE
|
||||||
#undef ARMCT_COND
|
#undef ARMCT_COND
|
||||||
|
|
||||||
/*
|
/* vim:set ts=4 sw=4 et: */
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -169,8 +169,4 @@ static int U(Filter *f)
|
|||||||
#undef F
|
#undef F
|
||||||
#undef U
|
#undef U
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+5
-9
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -168,8 +168,4 @@ static int U(Filter *f)
|
|||||||
#undef F
|
#undef F
|
||||||
#undef U
|
#undef U
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+10
-11
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -62,7 +62,7 @@ f80_jcc2(Filter const *f)
|
|||||||
return f80_jmp1(f);
|
return f80_jmp1(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int const N_MRU = 32; // does not have to be a power of 2
|
#define N_MRU 32 // does not have to be a power of 2
|
||||||
|
|
||||||
// Adaptively remember recent destinations.
|
// Adaptively remember recent destinations.
|
||||||
static void
|
static void
|
||||||
@@ -300,6 +300,9 @@ static int U(Filter *f)
|
|||||||
}
|
}
|
||||||
else { // not 1st time at this destination
|
else { // not 1st time at this destination
|
||||||
jc >>= 1;
|
jc >>= 1;
|
||||||
|
if (N_MRU <= jc) {
|
||||||
|
throwCompressedDataViolation();
|
||||||
|
}
|
||||||
int kh = jc + hand;
|
int kh = jc + hand;
|
||||||
if (N_MRU <= kh) {
|
if (N_MRU <= kh) {
|
||||||
kh -= N_MRU;
|
kh -= N_MRU;
|
||||||
@@ -337,12 +340,8 @@ static int U(Filter *f)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef N_MRU
|
||||||
#undef F
|
#undef F
|
||||||
#undef U
|
#undef U
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+5
-9
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -171,8 +171,4 @@ static int U(Filter *f)
|
|||||||
#undef F
|
#undef F
|
||||||
#undef U
|
#undef U
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -166,8 +166,4 @@ static int s_ctsw32_e9_e8(Filter *f)
|
|||||||
|
|
||||||
#undef CTSW32
|
#undef CTSW32
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-9
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -67,9 +67,4 @@ static int getcto(Filter *f, const unsigned char *buf, const int n=256)
|
|||||||
return ic;
|
return ic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+7
-10
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2004-2010 John F. Reiser
|
Copyright (C) 2004-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -98,7 +98,7 @@ static int F(Filter *f)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if (W_CTO != 0)
|
#if (W_CTO != 0)
|
||||||
assert((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != cto8); // this should not happen
|
assert((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != (unsigned) cto8); // this should not happen
|
||||||
#endif
|
#endif
|
||||||
lastnoncall = ic;
|
lastnoncall = ic;
|
||||||
noncalls++;
|
noncalls++;
|
||||||
@@ -133,7 +133,7 @@ static int U(Filter *f)
|
|||||||
|
|
||||||
for (ic = 0; ic<=size4; ic+=4) if (COND(b,ic)) {
|
for (ic = 0; ic<=size4; ic+=4) if (COND(b,ic)) {
|
||||||
unsigned const word = get_be32(b+ic);
|
unsigned const word = get_be32(b+ic);
|
||||||
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == f->cto) {
|
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == (unsigned) f->cto) {
|
||||||
unsigned const jc = word & (~(~0u<<(26 - W_CTO)) & (~0u<<2));
|
unsigned const jc = word & (~(~0u<<(26 - W_CTO)) & (~0u<<2));
|
||||||
set_be32(b+ic, (0xfc000003&word)|(0x03fffffc&(jc-ic-addvalue)));
|
set_be32(b+ic, (0xfc000003&word)|(0x03fffffc&(jc-ic-addvalue)));
|
||||||
f->calls++;
|
f->calls++;
|
||||||
@@ -153,7 +153,4 @@ static int U(Filter *f)
|
|||||||
|
|
||||||
#undef W_CTO
|
#undef W_CTO
|
||||||
|
|
||||||
/*
|
/* vim:set ts=4 sw=4 et: */
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-9
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -79,9 +79,4 @@
|
|||||||
assert((int)f->calls > 0); \
|
assert((int)f->calls > 0); \
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -115,8 +115,4 @@ static int s_sub16_4(Filter *f)
|
|||||||
#undef ADD16
|
#undef ADD16
|
||||||
#undef SCAN16
|
#undef SCAN16
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -115,8 +115,4 @@ static int s_sub32_4(Filter *f)
|
|||||||
#undef ADD32
|
#undef ADD32
|
||||||
#undef SCAN32
|
#undef SCAN32
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -115,8 +115,4 @@ static int s_sub8_4(Filter *f)
|
|||||||
#undef ADD8
|
#undef ADD8
|
||||||
#undef SCAN8
|
#undef SCAN8
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-9
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -180,9 +180,4 @@ static int s_sw32_e8e9(Filter *f)
|
|||||||
|
|
||||||
#undef SW32
|
#undef SW32
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -260,8 +260,4 @@ const FilterImp::FilterEntry FilterImp::filters[] = {
|
|||||||
|
|
||||||
const int FilterImp::n_filters = TABLESIZE(filters);
|
const int FilterImp::n_filters = TABLESIZE(filters);
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+44
-27
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +38,12 @@
|
|||||||
|
|
||||||
static bool head_done = 0;
|
static bool head_done = 0;
|
||||||
|
|
||||||
|
#if defined(UPX_VERSION_GITREV)
|
||||||
|
const char gitrev[] = UPX_VERSION_GITREV;
|
||||||
|
#else
|
||||||
|
const char gitrev[1] = { 0 };
|
||||||
|
#endif
|
||||||
|
|
||||||
void show_head(void)
|
void show_head(void)
|
||||||
{
|
{
|
||||||
FILE *f = con_term;
|
FILE *f = con_term;
|
||||||
@@ -51,15 +57,20 @@ void show_head(void)
|
|||||||
fg = con_fg(f,FG_GREEN);
|
fg = con_fg(f,FG_GREEN);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" Ultimate Packer for eXecutables\n"
|
" Ultimate Packer for eXecutables\n"
|
||||||
" Copyright (C) 1996 - %s\n"
|
" Copyright (C) 1996 - " UPX_VERSION_YEAR "\n"
|
||||||
"UPX %-10s Markus Oberhumer, Laszlo Molnar & John Reiser %14s\n\n",
|
#if defined(UPX_VERSION_GITREV)
|
||||||
UPX_VERSION_YEAR,
|
"UPX git-%6.6s%c"
|
||||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32)
|
#else
|
||||||
|
"UPX %-11s"
|
||||||
|
#endif
|
||||||
|
" Markus Oberhumer, Laszlo Molnar & John Reiser %14s\n\n",
|
||||||
|
#if defined(UPX_VERSION_GITREV)
|
||||||
|
gitrev,
|
||||||
|
(sizeof(gitrev)-1 > 6 && gitrev[sizeof(gitrev)-2] == '+') ? '+' : ' ',
|
||||||
|
#elif (ACC_OS_DOS16 || ACC_OS_DOS32)
|
||||||
V("d"),
|
V("d"),
|
||||||
#elif (ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
#elif (ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
V("w"),
|
V("w"),
|
||||||
#elif 0 && defined(__linux__)
|
|
||||||
V("l"),
|
|
||||||
#else
|
#else
|
||||||
UPX_VERSION_STRING,
|
UPX_VERSION_STRING,
|
||||||
#endif
|
#endif
|
||||||
@@ -129,16 +140,16 @@ static void show_all_packers(FILE *f, int verbose)
|
|||||||
{
|
{
|
||||||
options_t o; o.reset();
|
options_t o; o.reset();
|
||||||
PackerNames pn; pn.o = &o;
|
PackerNames pn; pn.o = &o;
|
||||||
PackMaster::visitAllPackers(pn.visit, NULL, &o, &pn);
|
PackMaster::visitAllPackers(PackerNames::visit, NULL, &o, &pn);
|
||||||
qsort(pn.names, pn.names_count, sizeof(PackerNames::Entry), pn.cmp_fname);
|
qsort(pn.names, pn.names_count, sizeof(PackerNames::Entry), PackerNames::cmp_fname);
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
for (size_t i = 0; i < pn.names_count; ++i)
|
for (size_t i = 0; i < pn.names_count; ++i)
|
||||||
{
|
{
|
||||||
const char *fn = pn.names[i].fname;
|
const char *fn = pn.names[i].fname;
|
||||||
const char *sn = pn.names[i].sname;
|
const char *sn = pn.names[i].sname;
|
||||||
if (verbose)
|
if (verbose > 0)
|
||||||
{
|
{
|
||||||
con_fprintf(f, " %-32s %s\n", fn, sn);
|
con_fprintf(f, " %-36s %s\n", fn, sn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -155,7 +166,7 @@ static void show_all_packers(FILE *f, int verbose)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!verbose && pn.names_count)
|
if (verbose <= 0 && pn.names_count)
|
||||||
con_fprintf(f, "\n");
|
con_fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +287,7 @@ void show_help(int verbose)
|
|||||||
" --le produce LE output [default: EXE]\n"
|
" --le produce LE output [default: EXE]\n"
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for win32/pe, rtm32/pe & arm/pe:\n");
|
con_fprintf(f,"Options for win32/pe, win64/pe, rtm32/pe & arm/pe:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --compress-exports=0 do not compress the export section\n"
|
" --compress-exports=0 do not compress the export section\n"
|
||||||
@@ -290,6 +301,12 @@ void show_help(int verbose)
|
|||||||
" --strip-relocs=0 do not strip relocations\n"
|
" --strip-relocs=0 do not strip relocations\n"
|
||||||
" --strip-relocs=1 strip relocations [default]\n"
|
" --strip-relocs=1 strip relocations [default]\n"
|
||||||
"\n");
|
"\n");
|
||||||
|
fg = con_fg(f,FG_YELLOW);
|
||||||
|
con_fprintf(f,"Options for linux/elf:\n");
|
||||||
|
fg = con_fg(f,fg);
|
||||||
|
con_fprintf(f,
|
||||||
|
" --preserve-build-id copy .gnu.note.build-id to compressed output\n"
|
||||||
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
con_fprintf(f, "file.. executables to (de)compress\n");
|
con_fprintf(f, "file.. executables to (de)compress\n");
|
||||||
@@ -306,7 +323,7 @@ void show_help(int verbose)
|
|||||||
con_fprintf(f,"\nType '%s --help' for more detailed help.\n", progname);
|
con_fprintf(f,"\nType '%s --help' for more detailed help.\n", progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
con_fprintf(f,"\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit http://upx.sf.net\n"
|
con_fprintf(f,"\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit https://upx.github.io\n"
|
||||||
// "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx -L'.\n"
|
// "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx -L'.\n"
|
||||||
"");
|
"");
|
||||||
|
|
||||||
@@ -360,7 +377,7 @@ void show_license(void)
|
|||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
"\n"
|
"\n"
|
||||||
" Markus F.X.J. Oberhumer Laszlo Molnar\n"
|
" Markus F.X.J. Oberhumer Laszlo Molnar\n"
|
||||||
" <markus@oberhumer.com> <ml1050@users.sourceforge.net>\n"
|
" <markus@oberhumer.com> <ezerotven+github@gmail.com>\n"
|
||||||
);
|
);
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
|
|
||||||
@@ -379,7 +396,11 @@ void show_version(int x)
|
|||||||
UNUSED(x);
|
UNUSED(x);
|
||||||
UNUSED(v);
|
UNUSED(v);
|
||||||
|
|
||||||
fprintf(fp, "upx %s\n", UPX_VERSION_STRING);
|
fprintf(fp, "upx %s\n", UPX_VERSION_STRING
|
||||||
|
#if defined(UPX_VERSION_GITREV)
|
||||||
|
"-git-" UPX_VERSION_GITREV
|
||||||
|
#endif
|
||||||
|
);
|
||||||
#if (WITH_NRV)
|
#if (WITH_NRV)
|
||||||
v = upx_nrv_version_string();
|
v = upx_nrv_version_string();
|
||||||
if (v != NULL && v[0])
|
if (v != NULL && v[0])
|
||||||
@@ -400,10 +421,10 @@ void show_version(int x)
|
|||||||
if (v != NULL && v[0])
|
if (v != NULL && v[0])
|
||||||
fprintf(fp, "LZMA SDK version %s\n", v);
|
fprintf(fp, "LZMA SDK version %s\n", v);
|
||||||
#endif
|
#endif
|
||||||
fprintf(fp, "Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer\n");
|
fprintf(fp, "Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer\n");
|
||||||
fprintf(fp, "Copyright (C) 1996-2010 Laszlo Molnar\n");
|
fprintf(fp, "Copyright (C) 1996-2017 Laszlo Molnar\n");
|
||||||
fprintf(fp, "Copyright (C) 2000-2010 John F. Reiser\n");
|
fprintf(fp, "Copyright (C) 2000-2017 John F. Reiser\n");
|
||||||
fprintf(fp, "Copyright (C) 2002-2010 Jens Medoch\n");
|
fprintf(fp, "Copyright (C) 2002-2017 Jens Medoch\n");
|
||||||
#if (WITH_ZLIB)
|
#if (WITH_ZLIB)
|
||||||
fprintf(fp, "Copyright (C) 1995" "-2005 Jean-loup Gailly and Mark Adler\n");
|
fprintf(fp, "Copyright (C) 1995" "-2005 Jean-loup Gailly and Mark Adler\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -413,8 +434,4 @@ void show_version(int x)
|
|||||||
fprintf(fp, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname);
|
fprintf(fp, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+5
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -338,6 +338,7 @@ void LeFile::countFixups(unsigned *counts) const
|
|||||||
break;
|
break;
|
||||||
case 6: // 16:32 pointer
|
case 6: // 16:32 pointer
|
||||||
counts[o] += 9;
|
counts[o] += 9;
|
||||||
|
// fall through
|
||||||
case 7: // 32-bit offset
|
case 7: // 32-bit offset
|
||||||
counts[fix[4]-1] += 4;
|
counts[fix[4]-1] += 4;
|
||||||
fix += (fix[1] & 0x10) ? 9 : 7;
|
fix += (fix[1] & 0x10) ? 9 : 7;
|
||||||
@@ -360,8 +361,4 @@ void LeFile::countFixups(unsigned *counts) const
|
|||||||
counts[o+1] += 4; // extra space for 0xFFFFFFFF
|
counts[o+1] += 4; // extra space for 0xFFFFFFFF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+6
-10
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -180,8 +180,8 @@ protected:
|
|||||||
|
|
||||||
InputFile *fif;
|
InputFile *fif;
|
||||||
OutputFile *fof;
|
OutputFile *fof;
|
||||||
long le_offset;
|
unsigned le_offset;
|
||||||
long exe_offset;
|
unsigned exe_offset;
|
||||||
|
|
||||||
le_header_t ih;
|
le_header_t ih;
|
||||||
le_header_t oh;
|
le_header_t oh;
|
||||||
@@ -221,8 +221,4 @@ private:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+330
-423
File diff suppressed because it is too large
Load Diff
+106
-109
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,82 +22,80 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_LINKER_H
|
#ifndef __UPX_LINKER_H
|
||||||
#define __UPX_LINKER_H 1
|
#define __UPX_LINKER_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// ElfLinker
|
// ElfLinker
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class ElfLinker : private noncopyable
|
class ElfLinker : private noncopyable {
|
||||||
{
|
|
||||||
friend class Packer;
|
friend class Packer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const N_BELE_RTP::AbstractPolicy *bele; // target endianness
|
const N_BELE_RTP::AbstractPolicy *bele; // target endianness
|
||||||
protected:
|
protected:
|
||||||
struct Section;
|
struct Section;
|
||||||
struct Symbol;
|
struct Symbol;
|
||||||
struct Relocation;
|
struct Relocation;
|
||||||
|
|
||||||
upx_byte *input;
|
upx_byte *input;
|
||||||
int inputlen;
|
int inputlen;
|
||||||
upx_byte *output;
|
upx_byte *output;
|
||||||
int outputlen;
|
int outputlen;
|
||||||
|
|
||||||
Section *head;
|
Section *head;
|
||||||
Section *tail;
|
Section *tail;
|
||||||
|
|
||||||
Section **sections;
|
Section **sections;
|
||||||
Symbol **symbols;
|
Symbol **symbols;
|
||||||
Relocation **relocations;
|
Relocation **relocations;
|
||||||
|
|
||||||
unsigned nsections;
|
unsigned nsections;
|
||||||
unsigned nsections_capacity;
|
unsigned nsections_capacity;
|
||||||
unsigned nsymbols;
|
unsigned nsymbols;
|
||||||
unsigned nsymbols_capacity;
|
unsigned nsymbols_capacity;
|
||||||
unsigned nrelocations;
|
unsigned nrelocations;
|
||||||
unsigned nrelocations_capacity;
|
unsigned nrelocations_capacity;
|
||||||
|
|
||||||
bool reloc_done;
|
bool reloc_done;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void preprocessSections(char *start, char *end);
|
void preprocessSections(char *start, char *end);
|
||||||
void preprocessSymbols(char *start, char *end);
|
void preprocessSymbols(char *start, char *end);
|
||||||
void preprocessRelocations(char *start, char *end);
|
void preprocessRelocations(char *start, char *end);
|
||||||
Section *findSection(const char *name, bool fatal=true) const;
|
Section *findSection(const char *name, bool fatal = true) const;
|
||||||
Symbol *findSymbol(const char *name, bool fatal=true) const;
|
Symbol *findSymbol(const char *name, bool fatal = true) const;
|
||||||
|
|
||||||
Symbol *addSymbol(const char *name, const char *section, unsigned offset);
|
Symbol *addSymbol(const char *name, const char *section, upx_uint64_t offset);
|
||||||
Relocation *addRelocation(const char *section, unsigned off, const char *type,
|
Relocation *addRelocation(const char *section, unsigned off, const char *type,
|
||||||
const char *symbol, unsigned add);
|
const char *symbol, upx_uint64_t add);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ElfLinker();
|
ElfLinker();
|
||||||
virtual ~ElfLinker();
|
virtual ~ElfLinker();
|
||||||
|
|
||||||
virtual void init(const void *pdata, int plen);
|
virtual void init(const void *pdata, int plen);
|
||||||
//virtual void setLoaderAlignOffset(int phase);
|
// virtual void setLoaderAlignOffset(int phase);
|
||||||
virtual int addLoader(const char *sname);
|
virtual int addLoader(const char *sname);
|
||||||
void addLoader(const char *s, va_list ap);
|
void addLoader(const char *s, va_list ap);
|
||||||
#if 1 && (ACC_CC_GNUC >= 0x040100)
|
#if 1 && (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x040100))
|
||||||
void __acc_cdecl_va addLoaderVA(const char *s, ...) __attribute__((__sentinel__));
|
void __acc_cdecl_va addLoaderVA(const char *s, ...) __attribute__((__sentinel__));
|
||||||
#else
|
#else
|
||||||
void __acc_cdecl_va addLoaderVA(const char *s, ...);
|
void __acc_cdecl_va addLoaderVA(const char *s, ...);
|
||||||
#endif
|
#endif
|
||||||
virtual Section *addSection(const char *sname, const void *sdata, int slen, unsigned p2align);
|
virtual Section *addSection(const char *sname, const void *sdata, int slen, unsigned p2align);
|
||||||
virtual int getSection(const char *sname, int *slen=NULL) const;
|
virtual int getSection(const char *sname, int *slen = NULL) const;
|
||||||
virtual int getSectionSize(const char *sname) const;
|
virtual int getSectionSize(const char *sname) const;
|
||||||
virtual upx_byte *getLoader(int *llen=NULL) const;
|
virtual upx_byte *getLoader(int *llen = NULL) const;
|
||||||
virtual void defineSymbol(const char *name, unsigned value);
|
virtual void defineSymbol(const char *name, upx_uint64_t value);
|
||||||
virtual unsigned getSymbolOffset(const char *) const;
|
virtual upx_uint64_t getSymbolOffset(const char *) const;
|
||||||
|
|
||||||
virtual void dumpSymbol(const Symbol *, unsigned flags, FILE *fp) const;
|
virtual void dumpSymbol(const Symbol *, unsigned flags, FILE *fp) const;
|
||||||
virtual void dumpSymbols(unsigned flags=0, FILE *fp=NULL) const;
|
virtual void dumpSymbols(unsigned flags = 0, FILE *fp = NULL) const;
|
||||||
|
|
||||||
void alignWithByte(unsigned len, unsigned char b);
|
void alignWithByte(unsigned len, unsigned char b);
|
||||||
virtual void alignCode(unsigned len) { alignWithByte(len, 0); }
|
virtual void alignCode(unsigned len) { alignWithByte(len, 0); }
|
||||||
@@ -105,150 +103,149 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void relocate();
|
virtual void relocate();
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
unsigned value, const char *type);
|
const char *type);
|
||||||
|
|
||||||
// target endianness abstraction
|
// target endianness abstraction
|
||||||
unsigned get_te16(const void *p) const { return bele->get16(p); }
|
unsigned get_te16(const void *p) const { return bele->get16(p); }
|
||||||
unsigned get_te32(const void *p) const { return bele->get32(p); }
|
unsigned get_te32(const void *p) const { return bele->get32(p); }
|
||||||
acc_uint64l_t get_te64(const void *p) const { return bele->get64(p); }
|
upx_uint64_t get_te64(const void *p) const { return bele->get64(p); }
|
||||||
void set_te16(void *p, unsigned v) const { bele->set16(p, v); }
|
void set_te16(void *p, unsigned v) const { bele->set16(p, v); }
|
||||||
void set_te32(void *p, unsigned v) const { bele->set32(p, v); }
|
void set_te32(void *p, unsigned v) const { bele->set32(p, v); }
|
||||||
void set_te64(void *p, acc_uint64l_t v) const { bele->set64(p, v); }
|
void set_te64(void *p, upx_uint64_t v) const { bele->set64(p, v); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ElfLinker::Section : private noncopyable {
|
||||||
struct ElfLinker::Section : private noncopyable
|
|
||||||
{
|
|
||||||
char *name;
|
char *name;
|
||||||
void *input;
|
void *input;
|
||||||
upx_byte *output;
|
upx_byte *output;
|
||||||
unsigned size;
|
unsigned size;
|
||||||
unsigned offset;
|
upx_uint64_t offset;
|
||||||
unsigned p2align; // log2
|
unsigned p2align; // log2
|
||||||
Section *next;
|
Section *next;
|
||||||
|
|
||||||
Section(const char *n, const void *i, unsigned s, unsigned a=0);
|
Section(const char *n, const void *i, unsigned s, unsigned a = 0);
|
||||||
~Section();
|
~Section();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ElfLinker::Symbol : private noncopyable {
|
||||||
struct ElfLinker::Symbol : private noncopyable
|
|
||||||
{
|
|
||||||
char *name;
|
char *name;
|
||||||
Section *section;
|
Section *section;
|
||||||
unsigned offset;
|
upx_uint64_t offset;
|
||||||
|
|
||||||
Symbol(const char *n, Section *s, unsigned o);
|
Symbol(const char *n, Section *s, upx_uint64_t o);
|
||||||
~Symbol();
|
~Symbol();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ElfLinker::Relocation : private noncopyable {
|
||||||
struct ElfLinker::Relocation : private noncopyable
|
|
||||||
{
|
|
||||||
const Section *section;
|
const Section *section;
|
||||||
unsigned offset;
|
unsigned offset;
|
||||||
const char *type;
|
const char *type;
|
||||||
const Symbol *value;
|
const Symbol *value;
|
||||||
unsigned add; // used in .rela relocations
|
upx_uint64_t add; // used in .rela relocations
|
||||||
|
|
||||||
Relocation(const Section *s, unsigned o, const char *t,
|
Relocation(const Section *s, unsigned o, const char *t, const Symbol *v, upx_uint64_t a);
|
||||||
const Symbol *v, unsigned a);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// ElfLinker arch subclasses
|
// ElfLinker arch subclasses
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class ElfLinkerAMD64 : public ElfLinker
|
class ElfLinkerAMD64 : public ElfLinker {
|
||||||
{
|
|
||||||
typedef ElfLinker super;
|
typedef ElfLinker super;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void alignCode(unsigned len) { alignWithByte(len, 0x90); }
|
virtual void alignCode(unsigned len) { alignWithByte(len, 0x90); }
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
unsigned value, const char *type);
|
const char *type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ElfLinkerArmBE : public ElfLinker {
|
||||||
class ElfLinkerArmBE : public ElfLinker
|
|
||||||
{
|
|
||||||
typedef ElfLinker super;
|
typedef ElfLinker super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ElfLinkerArmBE() { bele = &N_BELE_RTP::be_policy; }
|
ElfLinkerArmBE() { bele = &N_BELE_RTP::be_policy; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
unsigned value, const char *type);
|
const char *type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ElfLinkerArmLE : public ElfLinker {
|
||||||
class ElfLinkerArmLE : public ElfLinker
|
|
||||||
{
|
|
||||||
typedef ElfLinker super;
|
typedef ElfLinker super;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
unsigned value, const char *type);
|
const char *type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ElfLinkerArm64LE : public ElfLinker {
|
||||||
class ElfLinkerM68k : public ElfLinker
|
|
||||||
{
|
|
||||||
typedef ElfLinker super;
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type);
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerM68k : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ElfLinkerM68k() { bele = &N_BELE_RTP::be_policy; }
|
ElfLinkerM68k() { bele = &N_BELE_RTP::be_policy; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void alignCode(unsigned len);
|
virtual void alignCode(unsigned len);
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
unsigned value, const char *type);
|
const char *type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ElfLinkerMipsBE : public ElfLinker {
|
||||||
class ElfLinkerMipsBE : public ElfLinker
|
|
||||||
{
|
|
||||||
typedef ElfLinker super;
|
typedef ElfLinker super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ElfLinkerMipsBE() { bele = &N_BELE_RTP::be_policy; }
|
ElfLinkerMipsBE() { bele = &N_BELE_RTP::be_policy; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
unsigned value, const char *type);
|
const char *type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ElfLinkerMipsLE : public ElfLinker {
|
||||||
class ElfLinkerMipsLE : public ElfLinker
|
|
||||||
{
|
|
||||||
typedef ElfLinker super;
|
typedef ElfLinker super;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
unsigned value, const char *type);
|
const char *type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ElfLinkerPpc32 : public ElfLinker {
|
||||||
class ElfLinkerPpc32 : public ElfLinker
|
|
||||||
{
|
|
||||||
typedef ElfLinker super;
|
typedef ElfLinker super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ElfLinkerPpc32() { bele = &N_BELE_RTP::be_policy; }
|
ElfLinkerPpc32() { bele = &N_BELE_RTP::be_policy; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
unsigned value, const char *type);
|
const char *type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ElfLinkerPpc64le : public ElfLinker {
|
||||||
class ElfLinkerX86 : public ElfLinker
|
|
||||||
{
|
|
||||||
typedef ElfLinker super;
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type);
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerX86 : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void alignCode(unsigned len) { alignWithByte(len, 0x90); }
|
virtual void alignCode(unsigned len) { alignWithByte(len, 0x90); }
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
unsigned value, const char *type);
|
const char *type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
Submodule
+1
Submodule src/lzma-sdk added at 426fe82d12
+61
-93
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,11 +22,12 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "compress.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "packer.h"
|
#include "packer.h"
|
||||||
#include "p_elf.h"
|
#include "p_elf.h"
|
||||||
@@ -83,7 +84,6 @@ static options_t global_options;
|
|||||||
options_t *opt = &global_options;
|
options_t *opt = &global_options;
|
||||||
|
|
||||||
static int done_output_name = 0;
|
static int done_output_name = 0;
|
||||||
static int done_script_name = 0;
|
|
||||||
|
|
||||||
|
|
||||||
const char *argv0 = "";
|
const char *argv0 = "";
|
||||||
@@ -158,7 +158,7 @@ static bool set_eec(int ec, int *eec)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_ec(int ec)
|
bool set_exit_code(int ec)
|
||||||
{
|
{
|
||||||
return set_eec(ec,&exit_code);
|
return set_eec(ec,&exit_code);
|
||||||
}
|
}
|
||||||
@@ -166,25 +166,27 @@ bool set_ec(int ec)
|
|||||||
|
|
||||||
void e_exit(int ec)
|
void e_exit(int ec)
|
||||||
{
|
{
|
||||||
(void) set_ec(ec);
|
(void) set_exit_code(ec);
|
||||||
do_exit();
|
do_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void e_usage(void)
|
static void e_usage(void)
|
||||||
{
|
{
|
||||||
show_usage();
|
show_usage();
|
||||||
e_exit(EXIT_USAGE);
|
e_exit(EXIT_USAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void e_memory(void)
|
#if 0 // UNUSED
|
||||||
|
static void e_memory(void)
|
||||||
{
|
{
|
||||||
show_head();
|
show_head();
|
||||||
fflush(con_term);
|
fflush(con_term);
|
||||||
fprintf(stderr,"%s: out of memory\n", argv0);
|
fprintf(stderr,"%s: out of memory\n", argv0);
|
||||||
e_exit(EXIT_MEMORY);
|
e_exit(EXIT_MEMORY);
|
||||||
}
|
}
|
||||||
|
#endif // UNUSED
|
||||||
|
|
||||||
|
|
||||||
static void e_method(int m, int l)
|
static void e_method(int m, int l)
|
||||||
@@ -212,7 +214,7 @@ static void e_optval(const char *n)
|
|||||||
|
|
||||||
|
|
||||||
#if defined(OPTIONS_VAR)
|
#if defined(OPTIONS_VAR)
|
||||||
void e_envopt(const char *n)
|
static void e_envopt(const char *n)
|
||||||
{
|
{
|
||||||
fflush(con_term);
|
fflush(con_term);
|
||||||
if (n)
|
if (n)
|
||||||
@@ -226,18 +228,20 @@ void e_envopt(const char *n)
|
|||||||
#endif /* defined(OPTIONS_VAR) */
|
#endif /* defined(OPTIONS_VAR) */
|
||||||
|
|
||||||
|
|
||||||
void __acc_cdecl_sighandler e_sighandler(int signum)
|
#if 0 // UNUSED
|
||||||
|
static void __acc_cdecl_sighandler e_sighandler(int signum)
|
||||||
{
|
{
|
||||||
UNUSED(signum);
|
UNUSED(signum);
|
||||||
e_exit(EXIT_FATAL);
|
e_exit(EXIT_FATAL);
|
||||||
}
|
}
|
||||||
|
#endif // UNUSED
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// check options
|
// check options
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void check_not_both(bool e1, bool e2, const char *c1, const char *c2)
|
static void check_not_both(bool e1, bool e2, const char *c1, const char *c2)
|
||||||
{
|
{
|
||||||
if (e1 && e2)
|
if (e1 && e2)
|
||||||
{
|
{
|
||||||
@@ -248,7 +252,7 @@ void check_not_both(bool e1, bool e2, const char *c1, const char *c2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void check_options(int i, int argc)
|
static void check_options(int i, int argc)
|
||||||
{
|
{
|
||||||
assert(i <= argc);
|
assert(i <= argc);
|
||||||
|
|
||||||
@@ -298,7 +302,7 @@ void check_options(int i, int argc)
|
|||||||
// misc
|
// misc
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void e_help(void)
|
static void e_help(void)
|
||||||
{
|
{
|
||||||
show_help();
|
show_help();
|
||||||
e_exit(EXIT_USAGE);
|
e_exit(EXIT_USAGE);
|
||||||
@@ -327,14 +331,9 @@ static bool set_method(int m, int l)
|
|||||||
{
|
{
|
||||||
if (!Packer::isValidCompressionMethod(m))
|
if (!Packer::isValidCompressionMethod(m))
|
||||||
return false;
|
return false;
|
||||||
#if 1
|
|
||||||
// something like "--brute --lzma" should not disable "--brute"
|
// something like "--brute --lzma" should not disable "--brute"
|
||||||
if (!opt->all_methods)
|
if (!opt->all_methods)
|
||||||
#endif
|
|
||||||
{
|
|
||||||
opt->method = m;
|
opt->method = m;
|
||||||
opt->all_methods = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (l > 0)
|
if (l > 0)
|
||||||
opt->level = l;
|
opt->level = l;
|
||||||
@@ -366,29 +365,6 @@ static void set_output_name(const char *n, bool allow_m)
|
|||||||
done_output_name++;
|
done_output_name++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_script_name(const char *n, bool allow_m)
|
|
||||||
{
|
|
||||||
#if 1
|
|
||||||
if (done_script_name > 0)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"%s: option '--script' more than once given\n",argv0);
|
|
||||||
e_usage();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!n || !n[0] || (!allow_m && n[0] == '-'))
|
|
||||||
{
|
|
||||||
fprintf(stderr,"%s: missing script name\n",argv0);
|
|
||||||
e_usage();
|
|
||||||
}
|
|
||||||
if (strlen(n) >= (size_t)opt->o_unix.SCRIPT_MAX - 3)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"%s: script name too long\n",argv0);
|
|
||||||
e_usage();
|
|
||||||
}
|
|
||||||
opt->o_unix.script_name = n;
|
|
||||||
done_script_name++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// get options
|
// get options
|
||||||
@@ -439,7 +415,7 @@ char* prepare_shortopts(char *buf, const char *n,
|
|||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
int getoptvar(T *var, const T min_value, const T max_value, const char *arg_fatal)
|
static int getoptvar(T *var, const T min_value, const T max_value, const char *arg_fatal)
|
||||||
{
|
{
|
||||||
const char *p = mfx_optarg;
|
const char *p = mfx_optarg;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
@@ -469,9 +445,8 @@ done:
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1 && (ACC_CC_GNUC >= 0x030300)
|
|
||||||
template <class T, T default_value, T min_value, T max_value>
|
template <class T, T default_value, T min_value, T max_value>
|
||||||
int getoptvar(OptVar<T,default_value,min_value,max_value> *var, const char *arg_fatal)
|
static int getoptvar(OptVar<T,default_value,min_value,max_value> *var, const char *arg_fatal)
|
||||||
{
|
{
|
||||||
T v = default_value;
|
T v = default_value;
|
||||||
int r = getoptvar(&v, min_value, max_value, arg_fatal);
|
int r = getoptvar(&v, min_value, max_value, arg_fatal);
|
||||||
@@ -479,17 +454,6 @@ int getoptvar(OptVar<T,default_value,min_value,max_value> *var, const char *arg_
|
|||||||
*var = v;
|
*var = v;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
template <class T>
|
|
||||||
int getoptvar(T *var, const char *arg_fatal)
|
|
||||||
{
|
|
||||||
typename T::Type v = T::default_value_c;
|
|
||||||
int r = getoptvar(&v, T::min_value_c, T::max_value_c, arg_fatal);
|
|
||||||
if (r == 0)
|
|
||||||
*var = v;
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int do_option(int optc, const char *arg)
|
static int do_option(int optc, const char *arg)
|
||||||
@@ -594,6 +558,12 @@ static int do_option(int optc, const char *arg)
|
|||||||
if (M_IS_LZMA(opt->method))
|
if (M_IS_LZMA(opt->method))
|
||||||
opt->method = -1;
|
opt->method = -1;
|
||||||
break;
|
break;
|
||||||
|
case 723:
|
||||||
|
opt->prefer_ucl = false;
|
||||||
|
break;
|
||||||
|
case 724:
|
||||||
|
opt->prefer_ucl = true;
|
||||||
|
break;
|
||||||
|
|
||||||
// compression level
|
// compression level
|
||||||
case '1':
|
case '1':
|
||||||
@@ -856,11 +826,6 @@ static int do_option(int optc, const char *arg)
|
|||||||
case 661:
|
case 661:
|
||||||
opt->o_unix.force_execve = true;
|
opt->o_unix.force_execve = true;
|
||||||
break;
|
break;
|
||||||
case 662:
|
|
||||||
opt->o_unix.script_name = "/usr/local/lib/upx/upxX";
|
|
||||||
if (mfx_optarg && mfx_optarg[0])
|
|
||||||
set_script_name(mfx_optarg, 1);
|
|
||||||
break;
|
|
||||||
case 663:
|
case 663:
|
||||||
opt->o_unix.is_ptinterp = true;
|
opt->o_unix.is_ptinterp = true;
|
||||||
break;
|
break;
|
||||||
@@ -898,6 +863,9 @@ static int do_option(int optc, const char *arg)
|
|||||||
case 674:
|
case 674:
|
||||||
opt->o_unix.unmap_all_pages = true; // val ?
|
opt->o_unix.unmap_all_pages = true; // val ?
|
||||||
break;
|
break;
|
||||||
|
case 675:
|
||||||
|
opt->o_unix.preserve_build_id = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case '\0':
|
case '\0':
|
||||||
return -1;
|
return -1;
|
||||||
@@ -987,7 +955,9 @@ static const struct mfx_option longopts[] =
|
|||||||
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
||||||
{"nrv2e", 0x10, 0, 705}, // --nrv2e
|
{"nrv2e", 0x10, 0, 705}, // --nrv2e
|
||||||
{"lzma", 0x10, 0, 721}, // --lzma
|
{"lzma", 0x10, 0, 721}, // --lzma
|
||||||
{"no-lzma", 0x10, 0, 722}, // (disable all_methods_use_lzma)
|
{"no-lzma", 0x10, 0, 722}, // disable all_methods_use_lzma
|
||||||
|
{"prefer-nrv", 0x10, 0, 723},
|
||||||
|
{"prefer-ucl", 0x10, 0, 724},
|
||||||
// compression settings
|
// compression settings
|
||||||
{"all-filters", 0x10, 0, 523},
|
{"all-filters", 0x10, 0, 523},
|
||||||
{"all-methods", 0x10, 0, 524},
|
{"all-methods", 0x10, 0, 524},
|
||||||
@@ -1033,9 +1003,6 @@ static const struct mfx_option longopts[] =
|
|||||||
// unix
|
// unix
|
||||||
{"blocksize", 0x31, 0, 660}, // --blocksize=
|
{"blocksize", 0x31, 0, 660}, // --blocksize=
|
||||||
{"force-execve", 0x10, 0, 661}, // force linux/386 execve format
|
{"force-execve", 0x10, 0, 661}, // force linux/386 execve format
|
||||||
#if 0
|
|
||||||
{"script", 0x31, 0, 662}, // --script=
|
|
||||||
#endif
|
|
||||||
{"is_ptinterp", 0x10, 0, 663}, // linux/elf386 PT_INTERP program
|
{"is_ptinterp", 0x10, 0, 663}, // linux/elf386 PT_INTERP program
|
||||||
{"use_ptinterp", 0x10, 0, 664}, // linux/elf386 PT_INTERP program
|
{"use_ptinterp", 0x10, 0, 664}, // linux/elf386 PT_INTERP program
|
||||||
{"make_ptinterp", 0x10, 0, 665}, // linux/elf386 PT_INTERP program
|
{"make_ptinterp", 0x10, 0, 665}, // linux/elf386 PT_INTERP program
|
||||||
@@ -1048,6 +1015,7 @@ static const struct mfx_option longopts[] =
|
|||||||
{"OpenBSD", 0x10, 0, 669},
|
{"OpenBSD", 0x10, 0, 669},
|
||||||
{"openbsd", 0x10, 0, 669},
|
{"openbsd", 0x10, 0, 669},
|
||||||
{"unmap-all-pages", 0x10, 0, 674}, // linux /proc/self/exe vanishes
|
{"unmap-all-pages", 0x10, 0, 674}, // linux /proc/self/exe vanishes
|
||||||
|
{"preserve-build-id", 0, 0, 675},
|
||||||
// watcom/le
|
// watcom/le
|
||||||
{"le", 0x10, 0, 620}, // produce LE output
|
{"le", 0x10, 0, 620}, // produce LE output
|
||||||
// win32/pe
|
// win32/pe
|
||||||
@@ -1145,7 +1113,9 @@ static const struct mfx_option longopts[] =
|
|||||||
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
||||||
{"nrv2e", 0x10, 0, 705}, // --nrv2e
|
{"nrv2e", 0x10, 0, 705}, // --nrv2e
|
||||||
{"lzma", 0x10, 0, 721}, // --lzma
|
{"lzma", 0x10, 0, 721}, // --lzma
|
||||||
{"no-lzma", 0x10, 0, 722}, // (disable all_methods_use_lzma)
|
{"no-lzma", 0x10, 0, 722}, // disable all_methods_use_lzma
|
||||||
|
{"prefer-nrv", 0x10, 0, 723},
|
||||||
|
{"prefer-ucl", 0x10, 0, 724},
|
||||||
// compression settings
|
// compression settings
|
||||||
// compression runtime parameters
|
// compression runtime parameters
|
||||||
|
|
||||||
@@ -1288,10 +1258,6 @@ static bool test(void)
|
|||||||
COMPILE_TIME_ASSERT(__acc_alignof(t1) == 1)
|
COMPILE_TIME_ASSERT(__acc_alignof(t1) == 1)
|
||||||
COMPILE_TIME_ASSERT(__acc_alignof(t2) == 1)
|
COMPILE_TIME_ASSERT(__acc_alignof(t2) == 1)
|
||||||
#endif
|
#endif
|
||||||
#if 1 && (ACC_CC_WATCOMC)
|
|
||||||
test1_t t11; COMPILE_TIME_ASSERT(sizeof(t11.a) <= sizeof(t11.b))
|
|
||||||
test2_t t22; COMPILE_TIME_ASSERT(sizeof(t22.a) <= sizeof(t22.b))
|
|
||||||
#endif
|
|
||||||
#if 1 && !defined(UPX_OFFICIAL_BUILD)
|
#if 1 && !defined(UPX_OFFICIAL_BUILD)
|
||||||
T allbits; allbits = 0; allbits -= 1;
|
T allbits; allbits = 0; allbits -= 1;
|
||||||
//++allbits; allbits++; --allbits; allbits--;
|
//++allbits; allbits++; --allbits; allbits--;
|
||||||
@@ -1318,7 +1284,7 @@ static bool test(void)
|
|||||||
#undef ACCCHK_ASSERT
|
#undef ACCCHK_ASSERT
|
||||||
#include "miniacc.h"
|
#include "miniacc.h"
|
||||||
|
|
||||||
void upx_sanity_check(void)
|
__acc_static_noinline void upx_sanity_check(void)
|
||||||
{
|
{
|
||||||
#define ACC_WANT_ACC_CHK_CH 1
|
#define ACC_WANT_ACC_CHK_CH 1
|
||||||
#undef ACCCHK_ASSERT
|
#undef ACCCHK_ASSERT
|
||||||
@@ -1334,6 +1300,9 @@ void upx_sanity_check(void)
|
|||||||
|
|
||||||
COMPILE_TIME_ASSERT(sizeof(off_t) >= sizeof(long))
|
COMPILE_TIME_ASSERT(sizeof(off_t) >= sizeof(long))
|
||||||
COMPILE_TIME_ASSERT(((off_t) -1) < 0)
|
COMPILE_TIME_ASSERT(((off_t) -1) < 0)
|
||||||
|
#if (ACC_OS_POSIX_DARWIN || ACC_OS_POSIX_LINUX)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(off_t) >= 8)
|
||||||
|
#endif
|
||||||
|
|
||||||
COMPILE_TIME_ASSERT(sizeof(BE16) == 2)
|
COMPILE_TIME_ASSERT(sizeof(BE16) == 2)
|
||||||
COMPILE_TIME_ASSERT(sizeof(BE32) == 4)
|
COMPILE_TIME_ASSERT(sizeof(BE32) == 4)
|
||||||
@@ -1355,7 +1324,13 @@ void upx_sanity_check(void)
|
|||||||
COMPILE_TIME_ASSERT(sizeof(UPX_VERSION_YEAR) == 4 + 1)
|
COMPILE_TIME_ASSERT(sizeof(UPX_VERSION_YEAR) == 4 + 1)
|
||||||
assert(strlen(UPX_VERSION_YEAR) == 4);
|
assert(strlen(UPX_VERSION_YEAR) == 4);
|
||||||
assert(memcmp(UPX_VERSION_DATE_ISO, UPX_VERSION_YEAR, 4) == 0);
|
assert(memcmp(UPX_VERSION_DATE_ISO, UPX_VERSION_YEAR, 4) == 0);
|
||||||
assert(memcmp(UPX_VERSION_DATE + strlen(UPX_VERSION_DATE) - 4, UPX_VERSION_YEAR, 4) == 0);
|
assert(memcmp(&UPX_VERSION_DATE[sizeof(UPX_VERSION_DATE)-1 - 4], UPX_VERSION_YEAR, 4) == 0);
|
||||||
|
if (gitrev[0]) {
|
||||||
|
size_t revlen = strlen(gitrev);
|
||||||
|
if (strncmp(gitrev, "ERROR", 5) == 0) { assert(revlen == 5 || revlen == 6); }
|
||||||
|
else { assert(revlen == 12 || revlen == 13); }
|
||||||
|
if (revlen == 6 || revlen == 13) { assert(gitrev[revlen-1] == '+'); }
|
||||||
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
assert(TestBELE<LE16>::test());
|
assert(TestBELE<LE16>::test());
|
||||||
@@ -1366,7 +1341,7 @@ void upx_sanity_check(void)
|
|||||||
assert(TestBELE<BE64>::test());
|
assert(TestBELE<BE64>::test());
|
||||||
{
|
{
|
||||||
static const unsigned char dd[32]
|
static const unsigned char dd[32]
|
||||||
#if 1 && (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE) && defined(__ELF__)
|
#if 1 && (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE) && defined(__ELF__)
|
||||||
__attribute__((__aligned__(16)))
|
__attribute__((__aligned__(16)))
|
||||||
#endif
|
#endif
|
||||||
= { 0, 0, 0, 0, 0, 0, 0,
|
= { 0, 0, 0, 0, 0, 0, 0,
|
||||||
@@ -1400,7 +1375,7 @@ void upx_sanity_check(void)
|
|||||||
assert(get_le32(d) == 0xfcfdfeff);
|
assert(get_le32(d) == 0xfcfdfeff);
|
||||||
assert(bele->get32(d) == 0xfcfdfeff);
|
assert(bele->get32(d) == 0xfcfdfeff);
|
||||||
assert(get_le32_signed(d) == -50462977);
|
assert(get_le32_signed(d) == -50462977);
|
||||||
assert(get_le64_signed(d) == ACC_INT64_C(-506097522914230529));
|
assert(get_le64_signed(d) == UPX_INT64_C(-506097522914230529));
|
||||||
assert(find_be16(d, 2, 0xfffe) == 0);
|
assert(find_be16(d, 2, 0xfffe) == 0);
|
||||||
assert(find_le16(d, 2, 0xfeff) == 0);
|
assert(find_le16(d, 2, 0xfeff) == 0);
|
||||||
assert(find_be32(d, 4, 0xfffefdfc) == 0);
|
assert(find_be32(d, 4, 0xfffefdfc) == 0);
|
||||||
@@ -1409,7 +1384,7 @@ void upx_sanity_check(void)
|
|||||||
assert(get_be16_signed(d) == 32638);
|
assert(get_be16_signed(d) == 32638);
|
||||||
assert(get_be24_signed(d) == 8355453);
|
assert(get_be24_signed(d) == 8355453);
|
||||||
assert(get_be32_signed(d) == 2138996092);
|
assert(get_be32_signed(d) == 2138996092);
|
||||||
assert(get_be64_signed(d) == ACC_INT64_C(9186918263483431288));
|
assert(get_be64_signed(d) == UPX_INT64_C(9186918263483431288));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1424,6 +1399,9 @@ void upx_sanity_check(void)
|
|||||||
#if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
|
#if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
|
||||||
extern "C" { extern long _stksize; long _stksize = 256 * 1024L; }
|
extern "C" { extern long _stksize; long _stksize = 256 * 1024L; }
|
||||||
#endif
|
#endif
|
||||||
|
#if (ACC_OS_WIN32 || ACC_OS_WIN64) && (defined(__MINGW32__) || defined(__MINGW64__))
|
||||||
|
extern "C" { extern int _dowildcard; int _dowildcard = -1; }
|
||||||
|
#endif
|
||||||
|
|
||||||
int __acc_cdecl_main main(int argc, char *argv[])
|
int __acc_cdecl_main main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -1434,6 +1412,9 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
|||||||
#if 0 && defined(__DJGPP__)
|
#if 0 && defined(__DJGPP__)
|
||||||
// LFN=n may cause problems with 2.03's _rename and mkdir under WinME
|
// LFN=n may cause problems with 2.03's _rename and mkdir under WinME
|
||||||
putenv("LFN=y");
|
putenv("LFN=y");
|
||||||
|
#endif
|
||||||
|
#if (ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_MSC) && defined(_WRITE_ABORT_MSG) && defined(_CALL_REPORTFAULT)
|
||||||
|
_set_abort_behavior(_WRITE_ABORT_MSG, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||||
#endif
|
#endif
|
||||||
acc_wildargv(&argc, &argv);
|
acc_wildargv(&argc, &argv);
|
||||||
|
|
||||||
@@ -1469,8 +1450,7 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
|||||||
|
|
||||||
set_term(stderr);
|
set_term(stderr);
|
||||||
|
|
||||||
#if (WITH_UCL)
|
if (upx_ucl_init() != 0)
|
||||||
if (ucl_init() != UCL_E_OK)
|
|
||||||
{
|
{
|
||||||
show_head();
|
show_head();
|
||||||
fprintf(stderr,"ucl_init() failed - check your UCL installation !\n");
|
fprintf(stderr,"ucl_init() failed - check your UCL installation !\n");
|
||||||
@@ -1479,17 +1459,10 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
|||||||
(long) UCL_VERSION, (long) ucl_version());
|
(long) UCL_VERSION, (long) ucl_version());
|
||||||
e_exit(EXIT_INIT);
|
e_exit(EXIT_INIT);
|
||||||
}
|
}
|
||||||
#endif
|
assert(upx_lzma_init() == 0);
|
||||||
|
assert(upx_zlib_init() == 0);
|
||||||
#if (WITH_NRV)
|
#if (WITH_NRV)
|
||||||
if (nrv_init() != NRV_E_OK || NRV_VERSION != nrv_version())
|
assert(upx_nrv_init() == 0);
|
||||||
{
|
|
||||||
show_head();
|
|
||||||
fprintf(stderr,"nrv_init() failed - check your NRV installation !\n");
|
|
||||||
if (NRV_VERSION != nrv_version())
|
|
||||||
fprintf(stderr,"library version conflict (%lx, %lx) - check your NRV installation !\n",
|
|
||||||
(long) NRV_VERSION, (long) nrv_version());
|
|
||||||
e_exit(EXIT_INIT);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//srand((int) time(NULL));
|
//srand((int) time(NULL));
|
||||||
@@ -1557,7 +1530,7 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
|||||||
set_term(stdout);
|
set_term(stdout);
|
||||||
do_files(i,argc,argv);
|
do_files(i,argc,argv);
|
||||||
|
|
||||||
#if 0 && (UPX_VERSION_HEX < 0x030000)
|
if (gitrev[0])
|
||||||
{
|
{
|
||||||
FILE *f = stdout;
|
FILE *f = stdout;
|
||||||
int fg = con_fg(f,FG_RED);
|
int fg = con_fg(f,FG_RED);
|
||||||
@@ -1565,7 +1538,6 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
|||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
UNUSED(fg);
|
UNUSED(fg);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0 && defined(__GLIBC__)
|
#if 0 && defined(__GLIBC__)
|
||||||
//malloc_stats();
|
//malloc_stats();
|
||||||
@@ -1575,8 +1547,4 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
|||||||
|
|
||||||
#endif /* !(WITH_GUI) */
|
#endif /* !(WITH_GUI) */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+40
-55
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,40 +31,37 @@
|
|||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
// bool use_simple_mcheck()
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
static int use_mcheck = -1;
|
#if defined(__SANITIZE_ADDRESS__)
|
||||||
|
__acc_static_forceinline bool use_simple_mcheck() { return false; }
|
||||||
static int mcheck_init()
|
#elif (WITH_VALGRIND) && defined(RUNNING_ON_VALGRIND)
|
||||||
|
static int use_simple_mcheck_flag = -1;
|
||||||
|
__acc_static_noinline void use_simple_mcheck_init()
|
||||||
{
|
{
|
||||||
if (use_mcheck < 0)
|
use_simple_mcheck_flag = 1;
|
||||||
{
|
if (RUNNING_ON_VALGRIND) {
|
||||||
use_mcheck = 1;
|
use_simple_mcheck_flag = 0;
|
||||||
#if (WITH_VALGRIND) && defined(RUNNING_ON_VALGRIND)
|
//fprintf(stderr, "upx: detected RUNNING_ON_VALGRIND\n");
|
||||||
if (RUNNING_ON_VALGRIND)
|
|
||||||
{
|
|
||||||
//fprintf(stderr, "upx: detected RUNNING_ON_VALGRIND\n");
|
|
||||||
use_mcheck = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return use_mcheck;
|
|
||||||
}
|
}
|
||||||
|
__acc_static_forceinline bool use_simple_mcheck()
|
||||||
|
{
|
||||||
|
if __acc_unlikely(use_simple_mcheck_flag < 0)
|
||||||
|
use_simple_mcheck_init();
|
||||||
|
return (bool) use_simple_mcheck_flag;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
__acc_static_forceinline bool use_simple_mcheck() { return true; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
MemBuffer::MemBuffer() :
|
MemBuffer::MemBuffer(upx_uint64_t size) :
|
||||||
b(NULL), b_size(0)
|
|
||||||
{
|
|
||||||
if (use_mcheck < 0)
|
|
||||||
mcheck_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
MemBuffer::MemBuffer(unsigned size) :
|
|
||||||
b(NULL), b_size(0)
|
b(NULL), b_size(0)
|
||||||
{
|
{
|
||||||
alloc(size);
|
alloc(size);
|
||||||
@@ -78,10 +75,10 @@ MemBuffer::~MemBuffer()
|
|||||||
|
|
||||||
void MemBuffer::dealloc()
|
void MemBuffer::dealloc()
|
||||||
{
|
{
|
||||||
if (b)
|
if (b != NULL)
|
||||||
{
|
{
|
||||||
checkState();
|
checkState();
|
||||||
if (use_mcheck)
|
if (use_simple_mcheck())
|
||||||
{
|
{
|
||||||
// remove magic constants
|
// remove magic constants
|
||||||
set_be32(b - 8, 0);
|
set_be32(b - 8, 0);
|
||||||
@@ -103,23 +100,19 @@ void MemBuffer::dealloc()
|
|||||||
|
|
||||||
unsigned MemBuffer::getSizeForCompression(unsigned uncompressed_size, unsigned extra)
|
unsigned MemBuffer::getSizeForCompression(unsigned uncompressed_size, unsigned extra)
|
||||||
{
|
{
|
||||||
assert((int)uncompressed_size > 0);
|
size_t bytes = mem_size(1, uncompressed_size, extra);
|
||||||
assert((int)extra >= 0);
|
bytes += uncompressed_size/8 + 256;
|
||||||
unsigned size = uncompressed_size + uncompressed_size/8 + 256 + extra;
|
return ACC_ICONV(unsigned, bytes);
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned MemBuffer::getSizeForUncompression(unsigned uncompressed_size, unsigned extra)
|
unsigned MemBuffer::getSizeForUncompression(unsigned uncompressed_size, unsigned extra)
|
||||||
{
|
{
|
||||||
assert((int)uncompressed_size > 0);
|
size_t bytes = mem_size(1, uncompressed_size, extra);
|
||||||
assert((int)extra >= 0);
|
|
||||||
unsigned size = uncompressed_size + extra;
|
|
||||||
// size += 512; // 512 safety bytes
|
|
||||||
// INFO: 3 bytes are the allowed overrun for the i386 asm_fast decompressors
|
// INFO: 3 bytes are the allowed overrun for the i386 asm_fast decompressors
|
||||||
#if (ACC_ARCH_I386)
|
#if (ACC_ARCH_I386)
|
||||||
size += 3;
|
bytes += 3;
|
||||||
#endif
|
#endif
|
||||||
return size;
|
return ACC_ICONV(unsigned, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -154,7 +147,7 @@ void MemBuffer::fill(unsigned off, unsigned len, int value)
|
|||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#define PTR(p) ((unsigned) ((acc_uintptr_t)(p) & 0xffffffff))
|
#define PTR(p) ((unsigned) ((upx_uintptr_t)(p) & 0xffffffff))
|
||||||
#define MAGIC1(p) (PTR(p) ^ 0xfefdbeeb)
|
#define MAGIC1(p) (PTR(p) ^ 0xfefdbeeb)
|
||||||
#define MAGIC2(p) (PTR(p) ^ 0xfefdbeeb ^ 0x80024001)
|
#define MAGIC2(p) (PTR(p) ^ 0xfefdbeeb ^ 0x80024001)
|
||||||
|
|
||||||
@@ -165,7 +158,7 @@ void MemBuffer::checkState() const
|
|||||||
{
|
{
|
||||||
if (!b)
|
if (!b)
|
||||||
throwInternalError("block not allocated");
|
throwInternalError("block not allocated");
|
||||||
if (use_mcheck)
|
if (use_simple_mcheck())
|
||||||
{
|
{
|
||||||
if (get_be32(b - 4) != MAGIC1(b))
|
if (get_be32(b - 4) != MAGIC1(b))
|
||||||
throwInternalError("memory clobbered before allocated block 1");
|
throwInternalError("memory clobbered before allocated block 1");
|
||||||
@@ -178,23 +171,19 @@ void MemBuffer::checkState() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MemBuffer::alloc(unsigned size)
|
void MemBuffer::alloc(upx_uint64_t size)
|
||||||
{
|
{
|
||||||
if (use_mcheck < 0)
|
|
||||||
mcheck_init();
|
|
||||||
|
|
||||||
// NOTE: we don't automatically free a used buffer
|
// NOTE: we don't automatically free a used buffer
|
||||||
assert(b == NULL);
|
assert(b == NULL);
|
||||||
assert(b_size == 0);
|
assert(b_size == 0);
|
||||||
//
|
//
|
||||||
assert((int)size > 0);
|
assert(size > 0);
|
||||||
unsigned total = use_mcheck ? size + 32 : size;
|
size_t bytes = mem_size(1, size, use_simple_mcheck() ? 32 : 0);
|
||||||
assert((int)total > 0);
|
unsigned char *p = (unsigned char *) malloc(bytes);
|
||||||
unsigned char *p = (unsigned char *) malloc(total);
|
|
||||||
if (!p)
|
if (!p)
|
||||||
throwOutOfMemoryException();
|
throwOutOfMemoryException();
|
||||||
b_size = size;
|
b_size = ACC_ICONV(unsigned, size);
|
||||||
if (use_mcheck)
|
if (use_simple_mcheck())
|
||||||
{
|
{
|
||||||
b = p + 16;
|
b = p + 16;
|
||||||
// store magic constants to detect buffer overruns
|
// store magic constants to detect buffer overruns
|
||||||
@@ -209,8 +198,4 @@ void MemBuffer::alloc(unsigned size)
|
|||||||
//fill(0, b_size, (rand() & 0xff) | 1); // debug
|
//fill(0, b_size, (rand() & 0xff) | 1); // debug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -37,14 +37,14 @@
|
|||||||
class MemBuffer
|
class MemBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MemBuffer();
|
MemBuffer() : b(NULL), b_size(0) { }
|
||||||
explicit MemBuffer(unsigned size);
|
explicit MemBuffer(upx_uint64_t size);
|
||||||
~MemBuffer();
|
~MemBuffer();
|
||||||
|
|
||||||
static unsigned getSizeForCompression(unsigned uncompressed_size, unsigned extra=0);
|
static unsigned getSizeForCompression(unsigned uncompressed_size, unsigned extra=0);
|
||||||
static unsigned getSizeForUncompression(unsigned uncompressed_size, unsigned extra=0);
|
static unsigned getSizeForUncompression(unsigned uncompressed_size, unsigned extra=0);
|
||||||
|
|
||||||
void alloc(unsigned size);
|
void alloc(upx_uint64_t size);
|
||||||
void allocForCompression(unsigned uncompressed_size, unsigned extra=0);
|
void allocForCompression(unsigned uncompressed_size, unsigned extra=0);
|
||||||
void allocForUncompression(unsigned uncompressed_size, unsigned extra=0);
|
void allocForUncompression(unsigned uncompressed_size, unsigned extra=0);
|
||||||
|
|
||||||
@@ -55,7 +55,8 @@ public:
|
|||||||
unsigned getSize() const { return b_size; }
|
unsigned getSize() const { return b_size; }
|
||||||
|
|
||||||
operator unsigned char * () { return b; }
|
operator unsigned char * () { return b; }
|
||||||
//operator const unsigned char * () const { return b; }
|
operator const unsigned char * () const { return b; }
|
||||||
|
|
||||||
void *getVoidPtr() { return (void *) b; }
|
void *getVoidPtr() { return (void *) b; }
|
||||||
const void *getVoidPtr() const { return (const void *) b; }
|
const void *getVoidPtr() const { return (const void *) b; }
|
||||||
|
|
||||||
@@ -79,8 +80,4 @@ private:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+3069
-2046
File diff suppressed because it is too large
Load Diff
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -253,8 +253,4 @@ void infoWriting(const char *what, long size)
|
|||||||
info("Writing %s: %ld bytes", what, size);
|
info("Writing %s: %ld bytes", what, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+6
-10
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -63,6 +63,7 @@ struct options_t {
|
|||||||
bool all_methods_use_lzma;
|
bool all_methods_use_lzma;
|
||||||
bool all_filters; // try all available filters ?
|
bool all_filters; // try all available filters ?
|
||||||
bool no_filter; // force no filter
|
bool no_filter; // force no filter
|
||||||
|
bool prefer_ucl; // prefer UCL
|
||||||
bool exact; // user requires byte-identical decompression
|
bool exact; // user requires byte-identical decompression
|
||||||
|
|
||||||
// other options
|
// other options
|
||||||
@@ -144,8 +145,7 @@ struct options_t {
|
|||||||
bool make_ptinterp; // make PT_INTERP [ignore current file!]
|
bool make_ptinterp; // make PT_INTERP [ignore current file!]
|
||||||
bool unmap_all_pages; // thus /proc/self/exe vanishes
|
bool unmap_all_pages; // thus /proc/self/exe vanishes
|
||||||
unsigned char osabi0; // replacement if 0==.e_ident[EI_OSABI]
|
unsigned char osabi0; // replacement if 0==.e_ident[EI_OSABI]
|
||||||
enum { SCRIPT_MAX = 32 };
|
bool preserve_build_id; // copy the build-id to the compressed binary
|
||||||
const char *script_name;
|
|
||||||
} o_unix;
|
} o_unix;
|
||||||
struct {
|
struct {
|
||||||
bool le;
|
bool le;
|
||||||
@@ -167,8 +167,4 @@ extern struct options_t *opt;
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+47
-932
File diff suppressed because it is too large
Load Diff
+20
-13
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -34,9 +34,9 @@
|
|||||||
// arm/pe
|
// arm/pe
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class PackArmPe : public PeFile
|
class PackArmPe : public PeFile32
|
||||||
{
|
{
|
||||||
typedef PeFile super;
|
typedef PeFile32 super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PackArmPe(InputFile *f);
|
PackArmPe(InputFile *f);
|
||||||
@@ -46,19 +46,29 @@ public:
|
|||||||
virtual const char *getFullName(const options_t *) const { return "arm-wince.pe"; }
|
virtual const char *getFullName(const options_t *) const { return "arm-wince.pe"; }
|
||||||
virtual const int *getCompressionMethods(int method, int level) const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
virtual void defineFilterSymbols(const Filter *) {}
|
||||||
|
|
||||||
|
virtual bool handleForceOption();
|
||||||
|
virtual void callCompressWithFilters(Filter &, int filter_strategy,
|
||||||
|
unsigned ih_codebase);
|
||||||
|
virtual void defineSymbols(unsigned ncsection, unsigned upxsection,
|
||||||
|
unsigned sizeof_oh, unsigned isize_isplit,
|
||||||
|
unsigned s1addr);
|
||||||
|
virtual void addNewRelocations(Reloc &, unsigned upxsection);
|
||||||
|
virtual unsigned getProcessImportParam(unsigned upxsection);
|
||||||
|
virtual void setOhDataBase(const pe_section_t *osection);
|
||||||
|
virtual void setOhHeaderSize(const pe_section_t *osection);
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|
||||||
virtual bool canPack();
|
virtual bool canPack();
|
||||||
virtual int canUnpack();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void buildLoader(const Filter *ft);
|
virtual void buildLoader(const Filter *ft);
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
|
|
||||||
virtual unsigned processImports();
|
virtual const char *kernelDll() const { return "COREDLL.dll"; }
|
||||||
virtual void processImports(unsigned, unsigned);
|
virtual void processImports2(unsigned, unsigned);
|
||||||
virtual void rebuildImports(upx_byte *&);
|
virtual void addStubImports();
|
||||||
|
|
||||||
virtual void processTls(Interval *);
|
virtual void processTls(Interval *);
|
||||||
|
|
||||||
@@ -68,7 +78,4 @@ protected:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -266,8 +266,4 @@ Linker* PackCom::newLinker() const
|
|||||||
return new ElfLinkerX86();
|
return new ElfLinkerX86();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -66,8 +66,4 @@ protected:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+10
-14
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -138,16 +138,16 @@ void PackDjgpp2::handleStub(OutputFile *fo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool is_dlm(InputFile *fi, long coff_offset)
|
static bool is_dlm(InputFile *fi, unsigned coff_offset)
|
||||||
{
|
{
|
||||||
unsigned char buf[4];
|
unsigned char buf[4];
|
||||||
long off;
|
unsigned off;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fi->seek(coff_offset, SEEK_SET);
|
fi->seek(coff_offset, SEEK_SET);
|
||||||
fi->readx(buf, 4);
|
fi->readx(buf, 4);
|
||||||
off = get_le32(buf);
|
off = get_le32(buf);
|
||||||
if (off < 0 || off > coff_offset + 4)
|
if (off > coff_offset + 4)
|
||||||
return false;
|
return false;
|
||||||
fi->seek(off, SEEK_SET);
|
fi->seek(off, SEEK_SET);
|
||||||
fi->readx(buf, 4);
|
fi->readx(buf, 4);
|
||||||
@@ -170,9 +170,9 @@ static void handle_allegropak(InputFile *fi, OutputFile *fo)
|
|||||||
if (memcmp(buf, "slh+", 4) != 0)
|
if (memcmp(buf, "slh+", 4) != 0)
|
||||||
return;
|
return;
|
||||||
pfsize = get_be32_signed(buf+4);
|
pfsize = get_be32_signed(buf+4);
|
||||||
if (pfsize <= 8 || (off_t) pfsize >= (off_t) fi->st.st_size)
|
if (pfsize <= 8 || pfsize >= (off_t) fi->st.st_size)
|
||||||
return;
|
return;
|
||||||
fi->seek(-pfsize, SEEK_END);
|
fi->seek(-(off_t)pfsize, SEEK_END);
|
||||||
} catch (const IOException&) {
|
} catch (const IOException&) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -344,7 +344,7 @@ void PackDjgpp2::pack(OutputFile *fo)
|
|||||||
|
|
||||||
// because of a feature (bug?) in stub.asm we need some padding
|
// because of a feature (bug?) in stub.asm we need some padding
|
||||||
memcpy(obuf+data->size, "UPX", 3);
|
memcpy(obuf+data->size, "UPX", 3);
|
||||||
data->size = ALIGN_UP(data->size, 4);
|
data->size = ALIGN_UP(data->size, 4u);
|
||||||
|
|
||||||
linker->defineSymbol("DJ2MAIN1", coff_hdr.a_entry);
|
linker->defineSymbol("DJ2MAIN1", coff_hdr.a_entry);
|
||||||
relocateLoader();
|
relocateLoader();
|
||||||
@@ -469,8 +469,4 @@ void PackDjgpp2::unpack(OutputFile *fo)
|
|||||||
handle_allegropak(fi, fo);
|
handle_allegropak(fi, fo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+5
-9
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ protected:
|
|||||||
virtual void buildLoader(const Filter *ft);
|
virtual void buildLoader(const Filter *ft);
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
|
|
||||||
long coff_offset;
|
unsigned coff_offset;
|
||||||
|
|
||||||
__packed_struct(external_scnhdr_t)
|
__packed_struct(external_scnhdr_t)
|
||||||
char _[12]; // name, paddr
|
char _[12]; // name, paddr
|
||||||
@@ -107,8 +107,4 @@ protected:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -438,8 +438,4 @@ typedef ElfClass_LE64::External_Note Elf_LE64_External_Note;
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+54
-6
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -146,12 +146,14 @@
|
|||||||
DT_STRTAB = 5, /* String table */
|
DT_STRTAB = 5, /* String table */
|
||||||
DT_SYMTAB = 6, /* Symbol table */
|
DT_SYMTAB = 6, /* Symbol table */
|
||||||
DT_RELA = 7, /* Relocations which do contain an addend */
|
DT_RELA = 7, /* Relocations which do contain an addend */
|
||||||
|
DT_RELASZ = 8, /* Total size of Rela relocs */
|
||||||
DT_RELAENT = 9, /* Size of one RELA relocation */
|
DT_RELAENT = 9, /* Size of one RELA relocation */
|
||||||
DT_INIT = 12, /* Address of init function */
|
DT_INIT = 12, /* Address of init function */
|
||||||
DT_REL = 17, /* Relocations which contain no addend */
|
DT_REL = 17, /* Relocations which contain no addend */
|
||||||
DT_RELENT = 19, /* Size of one Rel relocation */
|
DT_RELENT = 19, /* Size of one Rel relocation */
|
||||||
DT_STRSZ = 10, /* Sizeof string table */
|
DT_STRSZ = 10, /* Sizeof string table */
|
||||||
DT_PLTREL = 20, /* Type of reloc in PLT */
|
DT_PLTREL = 20, /* Type of reloc in PLT */
|
||||||
|
DT_TEXTREL = 22, /* Reloc might modify .text */
|
||||||
DT_JMPREL = 23, /* Address of PLT relocs */
|
DT_JMPREL = 23, /* Address of PLT relocs */
|
||||||
DT_CHECKSUM = 0x6ffffdf8, /* Only for prelink? */
|
DT_CHECKSUM = 0x6ffffdf8, /* Only for prelink? */
|
||||||
DT_GNU_HASH = 0x6ffffef5, /* GNU-style hash table */
|
DT_GNU_HASH = 0x6ffffef5, /* GNU-style hash table */
|
||||||
@@ -195,7 +197,53 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
#ifdef WANT_NHDR_ENUM
|
||||||
vi:ts=4:et
|
#undef WANT_NHDR_ENUM
|
||||||
*/
|
enum { // ELF PT_NOTE types
|
||||||
|
#define ELF_NOTE_GNU_NAME "GNU\0"
|
||||||
|
NT_GNU_ABI_TAG = 1,
|
||||||
|
NT_GNU_HWCAP = 2,
|
||||||
|
NT_GNU_BUILD_ID = 3,
|
||||||
|
|
||||||
|
#define ELF_NOTE_OPENBSD_NAME "OpenBSD\0"
|
||||||
|
NHDR_OPENBSD_TAG = 1,
|
||||||
|
|
||||||
|
#define ELF_NOTE_NETBSD_NAME "NetBSD\0"
|
||||||
|
NHDR_NETBSD_TAG = 1,
|
||||||
|
NHDR_CHECKSUM_TAG = 2,
|
||||||
|
NHDR_PAX_TAG = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // descsz descriptor sizes
|
||||||
|
GNU_ABI_DESCSZ = 16, // int GNU_OS, major, minor, subminor;
|
||||||
|
NETBSD_DESCSZ = 4, // major_ver * (10**8) + minor
|
||||||
|
OPENBSD_DESCSZ = 4, // 32-bit zero
|
||||||
|
// CHECKSUM_DESCSZ is 2*sizeof(short) + sizeof(checksum)
|
||||||
|
PAX_DESCSZ = 4 // 32-bit mask
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // GNU OS/version
|
||||||
|
GNU_OS_LINUX = 0,
|
||||||
|
GNU_OS_HURD = 1,
|
||||||
|
GNU_OS_SOLARIS = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // NetBSD checksum methods
|
||||||
|
CHECKSUM_CRC32 = 1,
|
||||||
|
CHECKSUM_MD5 = 2,
|
||||||
|
CHECKSUM_SHA1 = 3,
|
||||||
|
CHECKSUM_SHA256 = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ELF_NOTE_PAX_NAME "PaX\0"
|
||||||
|
enum { // NetBSD PaX bit values
|
||||||
|
PAX_MPROTECT = (1<<0), /* force enable Mprotect */
|
||||||
|
PAX_NOMPROTECT = (1<<1), /* force disable Mprotect */
|
||||||
|
PAX_GUARD = (1<<2), /* force enable SEGVguard */
|
||||||
|
PAX_NOGUARD = (1<<3), /* force disable SEGVguard */
|
||||||
|
PAX_ASLR = (1<<4), /* force enable ASLR */
|
||||||
|
PAX_NOASLR = (1<<5) /* force disable ASLR */
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|||||||
-179
@@ -1,179 +0,0 @@
|
|||||||
/* p_elks.cpp --
|
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
|
||||||
All Rights Reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
|
||||||
and/or modify them under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING.
|
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
#include "file.h"
|
|
||||||
#include "filter.h"
|
|
||||||
#include "packer.h"
|
|
||||||
#include "p_vmlinz.h"
|
|
||||||
|
|
||||||
// FIXME
|
|
||||||
static const
|
|
||||||
#include "stub/l_vmlinz.h"
|
|
||||||
|
|
||||||
// from elks-0.0.83/Documentation/boot.txt
|
|
||||||
static const unsigned kernel_entry = 0x100000;
|
|
||||||
static const unsigned stack_during_uncompression = 0x90000;
|
|
||||||
static const unsigned zimage_offset = 0x1000;
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
const int *PackElks8086::getCompressionMethods(int method, int level) const
|
|
||||||
{
|
|
||||||
return Packer::getDefaultCompressionMethods_8(method, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const int *PackElks8086::getFilters() const
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
// common util routines
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
int PackElks8086::decompressKernel()
|
|
||||||
{
|
|
||||||
// not used
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PackElks8086::readKernel()
|
|
||||||
{
|
|
||||||
int klen = file_size - setup_size;
|
|
||||||
fi->seek(0, SEEK_SET);
|
|
||||||
|
|
||||||
setup_buf.alloc(setup_size);
|
|
||||||
fi->readx(setup_buf, setup_size);
|
|
||||||
|
|
||||||
ibuf.alloc(klen);
|
|
||||||
fi->readx(ibuf, klen);
|
|
||||||
|
|
||||||
obuf.allocForCompression(klen);
|
|
||||||
|
|
||||||
ph.u_len = klen;
|
|
||||||
ph.filter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
void PackElks8086::buildLoader(const Filter *ft)
|
|
||||||
{
|
|
||||||
// prepare loader
|
|
||||||
initLoader(nrv_loader, sizeof(nrv_loader));
|
|
||||||
// FIXME
|
|
||||||
UNUSED(ft);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PackElks8086::pack(OutputFile *fo)
|
|
||||||
{
|
|
||||||
readKernel();
|
|
||||||
|
|
||||||
// prepare filter
|
|
||||||
Filter ft(ph.level);
|
|
||||||
ft.buf_len = ph.u_len;
|
|
||||||
ft.addvalue = kernel_entry;
|
|
||||||
// compress
|
|
||||||
compressWithFilters(&ft, overlap_range, NULL_cconf);
|
|
||||||
|
|
||||||
const unsigned lsize = getLoaderSize();
|
|
||||||
MemBuffer loader(lsize);
|
|
||||||
memcpy(loader, getLoader(), lsize);
|
|
||||||
|
|
||||||
patchPackHeader(loader, lsize);
|
|
||||||
#if 0
|
|
||||||
// FIXME
|
|
||||||
defineFilterSymbols(&ft);
|
|
||||||
defineDecompressorSymbols();
|
|
||||||
//patch_le32(loader, lsize, "ESI1", zimage_offset + lsize);
|
|
||||||
//patch_le32(loader, lsize, "KEIP", kernel_entry);
|
|
||||||
//patch_le32(loader, lsize, "STAK", stack_during_uncompression);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
boot_sect_t * const bs = (boot_sect_t *) ((unsigned char *) setup_buf);
|
|
||||||
bs->sys_size = ALIGN_UP(lsize + ph.c_len, 16) / 16;
|
|
||||||
|
|
||||||
fo->write(setup_buf, setup_buf.getSize());
|
|
||||||
fo->write(loader, lsize);
|
|
||||||
fo->write(obuf, ph.c_len);
|
|
||||||
#if 0
|
|
||||||
printf("%-13s: setup : %8ld bytes\n", getName(), (long) setup_buf.getSize());
|
|
||||||
printf("%-13s: loader : %8ld bytes\n", getName(), (long) lsize);
|
|
||||||
printf("%-13s: compressed : %8ld bytes\n", getName(), (long) ph.c_len);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// finally check the compression ratio
|
|
||||||
if (!checkFinalCompressionRatio(fo))
|
|
||||||
throwNotCompressible();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
// unpack
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
int PackElks8086::canUnpack()
|
|
||||||
{
|
|
||||||
if (readFileHeader() != getFormat())
|
|
||||||
return false;
|
|
||||||
fi->seek(setup_size, SEEK_SET);
|
|
||||||
return readPackHeader(1024) ? 1 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PackElks8086::unpack(OutputFile *)
|
|
||||||
{
|
|
||||||
// no uncompression support for this format yet
|
|
||||||
|
|
||||||
// FIXME: but we could write the uncompressed "Image" image
|
|
||||||
|
|
||||||
throwCantUnpack("build a new kernel instead :-)");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* if 0 */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -870,8 +870,4 @@ DDnneelllCCCCCCCCCCCCCCCCCCCCCCCCC
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -118,8 +118,4 @@ protected:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+1367
-345
File diff suppressed because it is too large
Load Diff
+133
-49
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -50,7 +50,7 @@ protected:
|
|||||||
// because they depend on Elf32 or Elf64 data structures, which differ.
|
// because they depend on Elf32 or Elf64 data structures, which differ.
|
||||||
|
|
||||||
virtual void pack1(OutputFile *, Filter &) = 0; // generate executable header
|
virtual void pack1(OutputFile *, Filter &) = 0; // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &) = 0; // append compressed data
|
virtual int pack2(OutputFile *, Filter &) = 0; // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &) = 0; // append loader
|
virtual void pack3(OutputFile *, Filter &) = 0; // append loader
|
||||||
//virtual void pack4(OutputFile *, Filter &) = 0; // append pack header
|
//virtual void pack4(OutputFile *, Filter &) = 0; // append pack header
|
||||||
|
|
||||||
@@ -63,30 +63,40 @@ protected:
|
|||||||
virtual void addStubEntrySections(Filter const *);
|
virtual void addStubEntrySections(Filter const *);
|
||||||
virtual void unpack(OutputFile *fo);
|
virtual void unpack(OutputFile *fo);
|
||||||
|
|
||||||
virtual unsigned elf_get_offset_from_address(acc_uint64l_t) const = 0;
|
//virtual void const *elf_find_dynamic(unsigned) const = 0;
|
||||||
virtual void const *elf_find_dynamic(unsigned) const = 0;
|
virtual upx_uint64_t elf_unsigned_dynamic(unsigned) const = 0;
|
||||||
virtual acc_uint64l_t elf_unsigned_dynamic(unsigned) const = 0;
|
static unsigned elf_hash(char const *) /*const*/;
|
||||||
|
static unsigned gnu_hash(char const *) /*const*/;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
unsigned e_type;
|
||||||
unsigned e_phnum; /* Program header table entry count */
|
unsigned e_phnum; /* Program header table entry count */
|
||||||
char *file_image; // if ET_DYN investigation
|
unsigned e_shnum;
|
||||||
|
MemBuffer file_image; // if ET_DYN investigation
|
||||||
char const *dynstr; // from DT_STRTAB
|
char const *dynstr; // from DT_STRTAB
|
||||||
|
|
||||||
unsigned sz_phdrs; // sizeof Phdr[]
|
unsigned sz_phdrs; // sizeof Phdr[]
|
||||||
unsigned sz_elf_hdrs; // all Elf headers
|
unsigned sz_elf_hdrs; // all Elf headers
|
||||||
unsigned sz_pack2; // after pack2(), before loader
|
unsigned sz_pack2; // after pack2(), before loader
|
||||||
|
unsigned sz_pack2a; // after pack2() of all PT_LOAD
|
||||||
unsigned lg2_page; // log2(PAGE_SIZE)
|
unsigned lg2_page; // log2(PAGE_SIZE)
|
||||||
unsigned page_size; // 1u<<lg2_page
|
unsigned page_size; // 1u<<lg2_page
|
||||||
|
bool is_big; // stub style: must use area above the brk
|
||||||
unsigned xct_off; // shared library: file offset of SHT_EXECINSTR
|
unsigned xct_off; // shared library: file offset of SHT_EXECINSTR
|
||||||
unsigned hatch_off; // file offset of escape hatch
|
unsigned hatch_off; // file offset of escape hatch
|
||||||
acc_uint64l_t load_va; // PT_LOAD[0].p_vaddr
|
upx_uint64_t load_va; // PT_LOAD[0].p_vaddr
|
||||||
acc_uint64l_t xct_va; // minimum SHT_EXECINSTR virtual address
|
upx_uint64_t xct_va; // minimum SHT_EXECINSTR virtual address
|
||||||
|
upx_uint64_t jni_onload_va; // runtime &JNI_OnLoad
|
||||||
|
|
||||||
unsigned short e_machine;
|
upx_uint16_t e_machine;
|
||||||
unsigned char ei_class;
|
unsigned char ei_class;
|
||||||
unsigned char ei_data;
|
unsigned char ei_data;
|
||||||
unsigned char ei_osabi;
|
unsigned char ei_osabi;
|
||||||
char const *osabi_note;
|
char const *osabi_note;
|
||||||
|
|
||||||
|
unsigned char const *buildid_data;
|
||||||
|
int o_elf_shnum; // num output Shdrs
|
||||||
|
static unsigned char o_shstrtab[];
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackLinuxElf32 : public PackLinuxElf
|
class PackLinuxElf32 : public PackLinuxElf
|
||||||
@@ -96,6 +106,7 @@ public:
|
|||||||
PackLinuxElf32(InputFile *f);
|
PackLinuxElf32(InputFile *f);
|
||||||
virtual ~PackLinuxElf32();
|
virtual ~PackLinuxElf32();
|
||||||
protected:
|
protected:
|
||||||
|
virtual void PackLinuxElf32help1(InputFile *f);
|
||||||
virtual int checkEhdr(Elf32_Ehdr const *ehdr) const;
|
virtual int checkEhdr(Elf32_Ehdr const *ehdr) const;
|
||||||
virtual bool canPack();
|
virtual bool canPack();
|
||||||
|
|
||||||
@@ -103,9 +114,10 @@ protected:
|
|||||||
// but the class hierarchy splits after this class.
|
// but the class hierarchy splits after this class.
|
||||||
virtual void ARM_defineSymbols(Filter const *ft);
|
virtual void ARM_defineSymbols(Filter const *ft);
|
||||||
virtual void ARM_updateLoader(OutputFile *);
|
virtual void ARM_updateLoader(OutputFile *);
|
||||||
|
virtual int ARM_is_QNX(void);
|
||||||
|
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
virtual int pack2(OutputFile *, Filter &); // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &); // append pack header
|
virtual void pack4(OutputFile *, Filter &); // append pack header
|
||||||
virtual void unpack(OutputFile *fo);
|
virtual void unpack(OutputFile *fo);
|
||||||
@@ -129,18 +141,21 @@ protected:
|
|||||||
unsigned const e_phnum);
|
unsigned const e_phnum);
|
||||||
virtual off_t getbase(const Elf32_Phdr *phdr, int e_phnum) const;
|
virtual off_t getbase(const Elf32_Phdr *phdr, int e_phnum) const;
|
||||||
|
|
||||||
static unsigned elf_hash(char const *) /*const*/;
|
|
||||||
static unsigned gnu_hash(char const *) /*const*/;
|
|
||||||
virtual Elf32_Sym const *elf_lookup(char const *) const;
|
virtual Elf32_Sym const *elf_lookup(char const *) const;
|
||||||
virtual unsigned elf_get_offset_from_address(acc_uint64l_t) const;
|
virtual unsigned elf_get_offset_from_address(unsigned) const;
|
||||||
Elf32_Shdr const *elf_find_section_name(char const *) const;
|
Elf32_Shdr const *elf_find_section_name(char const *) const;
|
||||||
Elf32_Shdr const *elf_find_section_type(unsigned) const;
|
Elf32_Shdr const *elf_find_section_type(unsigned) const;
|
||||||
void const *elf_find_dynamic(unsigned) const;
|
void const *elf_find_dynamic(unsigned) const;
|
||||||
acc_uint64l_t elf_unsigned_dynamic(unsigned) const;
|
Elf32_Dyn const *elf_has_dynamic(unsigned) const;
|
||||||
|
virtual upx_uint64_t elf_unsigned_dynamic(unsigned) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Elf32_Ehdr ehdri; // from input file
|
Elf32_Ehdr ehdri; // from input file
|
||||||
Elf32_Phdr *phdri; // for input file
|
Elf32_Phdr *phdri; // for input file
|
||||||
|
unsigned e_phoff;
|
||||||
|
unsigned e_shoff;
|
||||||
|
unsigned char *note_body; // concatenated contents of PT_NOTEs, if any
|
||||||
|
unsigned note_size; // total size of PT_NOTEs
|
||||||
Elf32_Shdr const *shdri; // from input file
|
Elf32_Shdr const *shdri; // from input file
|
||||||
unsigned page_mask; // AND clears the offset-within-page
|
unsigned page_mask; // AND clears the offset-within-page
|
||||||
|
|
||||||
@@ -148,8 +163,8 @@ protected:
|
|||||||
unsigned int const *hashtab; // from DT_HASH
|
unsigned int const *hashtab; // from DT_HASH
|
||||||
unsigned int const *gashtab; // from DT_GNU_HASH
|
unsigned int const *gashtab; // from DT_GNU_HASH
|
||||||
Elf32_Sym const *dynsym; // from DT_SYMTAB
|
Elf32_Sym const *dynsym; // from DT_SYMTAB
|
||||||
|
Elf32_Sym const *jni_onload_sym;
|
||||||
char const *shstrtab; // via Elf32_Shdr
|
char const *shstrtab; // via Elf32_Shdr
|
||||||
int n_elf_shnum; // via e_shnum
|
|
||||||
|
|
||||||
Elf32_Shdr const *sec_strndx;
|
Elf32_Shdr const *sec_strndx;
|
||||||
Elf32_Shdr const *sec_dynsym;
|
Elf32_Shdr const *sec_dynsym;
|
||||||
@@ -173,23 +188,36 @@ protected:
|
|||||||
l_info linfo;
|
l_info linfo;
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
cprElfHdr3 elfout;
|
__packed_struct(cprElfHdrNetBSD)
|
||||||
|
Elf32_Ehdr ehdr;
|
||||||
|
Elf32_Phdr phdr[4];
|
||||||
|
unsigned char notes[512];
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
struct Elf32_Note {
|
cprElfHdrNetBSD elfout;
|
||||||
unsigned namesz; // 8
|
|
||||||
unsigned descsz; // 4
|
__packed_struct(cprElfShdr3)
|
||||||
unsigned type; // 1
|
Elf32_Shdr shdr[3];
|
||||||
char text[0x18 - 4*4]; // "OpenBSD"
|
__packed_struct_end()
|
||||||
unsigned end; // 0
|
|
||||||
} elfnote;
|
cprElfShdr3 shdrout;
|
||||||
|
|
||||||
|
struct Elf32_Nhdr {
|
||||||
|
unsigned namesz;
|
||||||
|
unsigned descsz;
|
||||||
|
unsigned type;
|
||||||
|
//unsigned char body[0];
|
||||||
|
};
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() {
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 52 + 1*32 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 52 + 1*32 + 12)
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 52 + 2*32 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 52 + 2*32 + 12)
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 52 + 3*32 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 52 + 3*32 + 12)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdrNetBSD) == 52 + 4*32 + 512)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdrNetBSD)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -203,10 +231,11 @@ public:
|
|||||||
/*virtual void buildLoader(const Filter *);*/
|
/*virtual void buildLoader(const Filter *);*/
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void PackLinuxElf64help1(InputFile *f);
|
||||||
virtual int checkEhdr(Elf64_Ehdr const *ehdr) const;
|
virtual int checkEhdr(Elf64_Ehdr const *ehdr) const;
|
||||||
|
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
virtual int pack2(OutputFile *, Filter &); // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &); // append pack header
|
virtual void pack4(OutputFile *, Filter &); // append pack header
|
||||||
virtual void unpack(OutputFile *fo);
|
virtual void unpack(OutputFile *fo);
|
||||||
@@ -229,24 +258,30 @@ protected:
|
|||||||
virtual unsigned find_LOAD_gap(Elf64_Phdr const *const phdri, unsigned const k,
|
virtual unsigned find_LOAD_gap(Elf64_Phdr const *const phdri, unsigned const k,
|
||||||
unsigned const e_phnum);
|
unsigned const e_phnum);
|
||||||
|
|
||||||
virtual unsigned elf_get_offset_from_address(acc_uint64l_t) const;
|
virtual Elf64_Sym const *elf_lookup(char const *) const;
|
||||||
|
virtual upx_uint64_t elf_get_offset_from_address(upx_uint64_t) const;
|
||||||
Elf64_Shdr const *elf_find_section_name(char const *) const;
|
Elf64_Shdr const *elf_find_section_name(char const *) const;
|
||||||
Elf64_Shdr const *elf_find_section_type(unsigned) const;
|
Elf64_Shdr const *elf_find_section_type(unsigned) const;
|
||||||
void const *elf_find_dynamic(unsigned) const;
|
void const *elf_find_dynamic(unsigned) const;
|
||||||
acc_uint64l_t elf_unsigned_dynamic(unsigned) const;
|
Elf64_Dyn const *elf_has_dynamic(unsigned) const;
|
||||||
|
virtual upx_uint64_t elf_unsigned_dynamic(unsigned) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Elf64_Ehdr ehdri; // from input file
|
Elf64_Ehdr ehdri; // from input file
|
||||||
Elf64_Phdr *phdri; // for input file
|
Elf64_Phdr *phdri; // for input file
|
||||||
|
upx_uint64_t e_phoff;
|
||||||
|
upx_uint64_t e_shoff;
|
||||||
|
unsigned char *note_body; // concatenated contents of PT_NOTEs, if any
|
||||||
|
unsigned note_size; // total size of PT_NOTEs
|
||||||
Elf64_Shdr const *shdri; // from input file
|
Elf64_Shdr const *shdri; // from input file
|
||||||
acc_uint64l_t page_mask; // AND clears the offset-within-page
|
upx_uint64_t page_mask; // AND clears the offset-within-page
|
||||||
|
|
||||||
Elf64_Dyn const *dynseg; // from PT_DYNAMIC
|
Elf64_Dyn const *dynseg; // from PT_DYNAMIC
|
||||||
unsigned int const *hashtab; // from DT_HASH
|
unsigned int const *hashtab; // from DT_HASH
|
||||||
unsigned int const *gashtab; // from DT_GNU_HASH
|
unsigned int const *gashtab; // from DT_GNU_HASH
|
||||||
Elf64_Sym const *dynsym; // from DT_SYMTAB
|
Elf64_Sym const *dynsym; // from DT_SYMTAB
|
||||||
|
Elf64_Sym const *jni_onload_sym;
|
||||||
char const *shstrtab; // via Elf64_Shdr
|
char const *shstrtab; // via Elf64_Shdr
|
||||||
int n_elf_shnum; // via e_shnum
|
|
||||||
|
|
||||||
Elf64_Shdr const *sec_strndx;
|
Elf64_Shdr const *sec_strndx;
|
||||||
Elf64_Shdr const *sec_dynsym;
|
Elf64_Shdr const *sec_dynsym;
|
||||||
@@ -270,15 +305,29 @@ protected:
|
|||||||
l_info linfo;
|
l_info linfo;
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
cprElfHdr3 elfout;
|
__packed_struct(cprElfHdr4)
|
||||||
|
Elf64_Ehdr ehdr;
|
||||||
|
Elf64_Phdr phdr[4];
|
||||||
|
l_info linfo;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
cprElfHdr4 elfout;
|
||||||
|
|
||||||
|
__packed_struct(cprElfShdr3)
|
||||||
|
Elf64_Shdr shdr[3];
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
cprElfShdr3 shdrout;
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() {
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 64 + 1*56 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 64 + 1*56 + 12)
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 64 + 2*56 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 64 + 2*56 + 12)
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 64 + 3*56 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 64 + 3*56 + 12)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr4) == 64 + 4*56 + 12)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr4)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -288,7 +337,7 @@ class PackLinuxElf32Be : public PackLinuxElf32
|
|||||||
protected:
|
protected:
|
||||||
PackLinuxElf32Be(InputFile *f) : super(f) {
|
PackLinuxElf32Be(InputFile *f) : super(f) {
|
||||||
bele = &N_BELE_RTP::be_policy;
|
bele = &N_BELE_RTP::be_policy;
|
||||||
e_phnum = get_te16(&ehdri.e_phnum);
|
PackLinuxElf32help1(f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -298,7 +347,7 @@ class PackLinuxElf32Le : public PackLinuxElf32
|
|||||||
protected:
|
protected:
|
||||||
PackLinuxElf32Le(InputFile *f) : super(f) {
|
PackLinuxElf32Le(InputFile *f) : super(f) {
|
||||||
bele = &N_BELE_RTP::le_policy;
|
bele = &N_BELE_RTP::le_policy;
|
||||||
e_phnum = get_te16(&ehdri.e_phnum);
|
PackLinuxElf32help1(f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -307,8 +356,10 @@ class PackLinuxElf64Le : public PackLinuxElf64
|
|||||||
typedef PackLinuxElf64 super;
|
typedef PackLinuxElf64 super;
|
||||||
protected:
|
protected:
|
||||||
PackLinuxElf64Le(InputFile *f) : super(f) {
|
PackLinuxElf64Le(InputFile *f) : super(f) {
|
||||||
|
lg2_page=16;
|
||||||
|
page_size=1u<<lg2_page;
|
||||||
bele = &N_BELE_RTP::le_policy;
|
bele = &N_BELE_RTP::le_policy;
|
||||||
e_phnum = get_te16(&ehdri.e_phnum);
|
PackLinuxElf64help1(f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -324,7 +375,7 @@ public:
|
|||||||
PackLinuxElf64amd(InputFile *f);
|
PackLinuxElf64amd(InputFile *f);
|
||||||
virtual ~PackLinuxElf64amd();
|
virtual ~PackLinuxElf64amd();
|
||||||
virtual int getFormat() const { return UPX_F_LINUX_ELF64_AMD; }
|
virtual int getFormat() const { return UPX_F_LINUX_ELF64_AMD; }
|
||||||
virtual const char *getName() const { return "linux/ElfAMD"; }
|
virtual const char *getName() const { return "linux/amd64"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "amd64-linux.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "amd64-linux.elf"; }
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
virtual bool canPack();
|
virtual bool canPack();
|
||||||
@@ -348,7 +399,7 @@ public:
|
|||||||
PackLinuxElf32ppc(InputFile *f);
|
PackLinuxElf32ppc(InputFile *f);
|
||||||
virtual ~PackLinuxElf32ppc();
|
virtual ~PackLinuxElf32ppc();
|
||||||
virtual int getFormat() const { return UPX_F_LINUX_ELFPPC32; }
|
virtual int getFormat() const { return UPX_F_LINUX_ELFPPC32; }
|
||||||
virtual const char *getName() const { return "linux/ElfPPC"; }
|
virtual const char *getName() const { return "linux/ppc32"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "powerpc-linux.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "powerpc-linux.elf"; }
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
protected:
|
protected:
|
||||||
@@ -357,6 +408,29 @@ protected:
|
|||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// linux/elf64ppcle
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
class PackLinuxElf64ppcle : public PackLinuxElf64Le
|
||||||
|
{
|
||||||
|
typedef PackLinuxElf64Le super;
|
||||||
|
public:
|
||||||
|
PackLinuxElf64ppcle(InputFile *f);
|
||||||
|
virtual ~PackLinuxElf64ppcle();
|
||||||
|
virtual int getFormat() const { return UPX_F_LINUX_ELFPPC64LE; }
|
||||||
|
virtual const char *getName() const { return "linux/ppc64le"; }
|
||||||
|
virtual const char *getFullName(const options_t *) const { return "powerpc64le-linux.elf"; }
|
||||||
|
virtual const int *getFilters() const;
|
||||||
|
protected:
|
||||||
|
unsigned lg2_page; // log2(PAGE_SIZE)
|
||||||
|
unsigned page_size; // 1u<<lg2_page
|
||||||
|
virtual bool canPack();
|
||||||
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
|
virtual void buildLoader(const Filter *);
|
||||||
|
virtual Linker* newLinker() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// linux/elf386
|
// linux/elf386
|
||||||
@@ -369,7 +443,7 @@ public:
|
|||||||
PackLinuxElf32x86(InputFile *f);
|
PackLinuxElf32x86(InputFile *f);
|
||||||
virtual ~PackLinuxElf32x86();
|
virtual ~PackLinuxElf32x86();
|
||||||
virtual int getFormat() const { return UPX_F_LINUX_ELF_i386; }
|
virtual int getFormat() const { return UPX_F_LINUX_ELF_i386; }
|
||||||
virtual const char *getName() const { return "linux/elf386"; }
|
virtual const char *getName() const { return "linux/i386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-linux.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-linux.elf"; }
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
@@ -388,8 +462,9 @@ class PackBSDElf32x86 : public PackLinuxElf32x86
|
|||||||
public:
|
public:
|
||||||
PackBSDElf32x86(InputFile *f);
|
PackBSDElf32x86(InputFile *f);
|
||||||
virtual ~PackBSDElf32x86();
|
virtual ~PackBSDElf32x86();
|
||||||
virtual int getFormat() const { return UPX_F_BSD_ELF_i386; }
|
virtual int getFormat() const = 0;
|
||||||
virtual const char *getName() const { return "BSD/elf386"; }
|
virtual const char *getName() const = 0;
|
||||||
|
virtual const char *getFullName(const options_t *) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
@@ -403,16 +478,27 @@ class PackFreeBSDElf32x86 : public PackBSDElf32x86
|
|||||||
public:
|
public:
|
||||||
PackFreeBSDElf32x86(InputFile *f);
|
PackFreeBSDElf32x86(InputFile *f);
|
||||||
virtual ~PackFreeBSDElf32x86();
|
virtual ~PackFreeBSDElf32x86();
|
||||||
|
virtual int getFormat() const { return UPX_F_BSD_ELF_i386; }
|
||||||
|
virtual const char *getName() const { return "freebsd/i386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-freebsd.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-freebsd.elf"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackNetBSDElf32x86 : public PackBSDElf32x86
|
class PackNetBSDElf32x86 : public PackLinuxElf32x86
|
||||||
{
|
{
|
||||||
typedef PackBSDElf32x86 super;
|
typedef PackLinuxElf32x86 super;
|
||||||
public:
|
public:
|
||||||
PackNetBSDElf32x86(InputFile *f);
|
PackNetBSDElf32x86(InputFile *f);
|
||||||
virtual ~PackNetBSDElf32x86();
|
virtual ~PackNetBSDElf32x86();
|
||||||
|
virtual int getFormat() const { return UPX_F_BSD_ELF_i386; }
|
||||||
|
virtual const char *getName() const { return "netbsd/i386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-netbsd.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-netbsd.elf"; }
|
||||||
|
protected:
|
||||||
|
virtual void buildLoader(const Filter *ft);
|
||||||
|
virtual void generateElfHdr(
|
||||||
|
OutputFile *,
|
||||||
|
void const *proto,
|
||||||
|
unsigned const brka
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackOpenBSDElf32x86 : public PackBSDElf32x86
|
class PackOpenBSDElf32x86 : public PackBSDElf32x86
|
||||||
@@ -421,6 +507,8 @@ class PackOpenBSDElf32x86 : public PackBSDElf32x86
|
|||||||
public:
|
public:
|
||||||
PackOpenBSDElf32x86(InputFile *f);
|
PackOpenBSDElf32x86(InputFile *f);
|
||||||
virtual ~PackOpenBSDElf32x86();
|
virtual ~PackOpenBSDElf32x86();
|
||||||
|
virtual int getFormat() const { return UPX_F_BSD_ELF_i386; }
|
||||||
|
virtual const char *getName() const { return "openbsd/i386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-openbsd.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-openbsd.elf"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -444,7 +532,7 @@ public:
|
|||||||
PackLinuxElf32armLe(InputFile *f);
|
PackLinuxElf32armLe(InputFile *f);
|
||||||
virtual ~PackLinuxElf32armLe();
|
virtual ~PackLinuxElf32armLe();
|
||||||
virtual int getFormat() const { return UPX_F_LINUX_ELF32_ARMEL; }
|
virtual int getFormat() const { return UPX_F_LINUX_ELF32_ARMEL; }
|
||||||
virtual const char *getName() const { return "linux/armel"; }
|
virtual const char *getName() const { return "linux/arm"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "arm-linux.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "arm-linux.elf"; }
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
@@ -484,7 +572,7 @@ public:
|
|||||||
PackLinuxElf32mipseb(InputFile *f);
|
PackLinuxElf32mipseb(InputFile *f);
|
||||||
virtual ~PackLinuxElf32mipseb();
|
virtual ~PackLinuxElf32mipseb();
|
||||||
virtual int getFormat() const { return UPX_F_LINUX_ELF32_MIPSEB; }
|
virtual int getFormat() const { return UPX_F_LINUX_ELF32_MIPSEB; }
|
||||||
virtual const char *getName() const { return "linux/mipseb"; }
|
virtual const char *getName() const { return "linux/mips"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "mips-linux.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "mips-linux.elf"; }
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
@@ -518,8 +606,4 @@ protected:
|
|||||||
|
|
||||||
#endif /*} already included */
|
#endif /*} already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+9
-13
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2001-2010 John F. Reiser
|
Copyright (C) 2001-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -375,7 +375,7 @@ PackLinuxI386::buildLinuxLoader(
|
|||||||
addLoader("FOLDEXEC", NULL);
|
addLoader("FOLDEXEC", NULL);
|
||||||
if (M_IS_LZMA(ph.method)) {
|
if (M_IS_LZMA(ph.method)) {
|
||||||
const lzma_compress_result_t *res = &ph.compress_result.result_lzma;
|
const lzma_compress_result_t *res = &ph.compress_result.result_lzma;
|
||||||
acc_uint32e_t properties = // lc, lp, pb, dummy
|
upx_uint32_t properties = // lc, lp, pb, dummy
|
||||||
(res->lit_context_bits << 0) |
|
(res->lit_context_bits << 0) |
|
||||||
(res->lit_pos_bits << 8) |
|
(res->lit_pos_bits << 8) |
|
||||||
(res->pos_bits << 16);
|
(res->pos_bits << 16);
|
||||||
@@ -449,7 +449,7 @@ int PackLinuxI386::getLoaderPrefixSize() const
|
|||||||
// some ELF utitlity functions
|
// some ELF utitlity functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// basic check of an Linux ELF Ehdr
|
// basic check of a Linux ELF Ehdr
|
||||||
int PackLinuxI386::checkEhdr(const Elf_LE32_Ehdr *ehdr) const
|
int PackLinuxI386::checkEhdr(const Elf_LE32_Ehdr *ehdr) const
|
||||||
{
|
{
|
||||||
const unsigned char * const buf = ehdr->e_ident;
|
const unsigned char * const buf = ehdr->e_ident;
|
||||||
@@ -601,11 +601,11 @@ void PackLinuxI386::patchLoaderChecksum()
|
|||||||
// checksum for loader + p_info
|
// checksum for loader + p_info
|
||||||
lp->l_checksum = 0;
|
lp->l_checksum = 0;
|
||||||
lp->l_magic = UPX_ELF_MAGIC;
|
lp->l_magic = UPX_ELF_MAGIC;
|
||||||
lp->l_lsize = (unsigned short) lsize;
|
set_te16(&lp->l_lsize, (upx_uint16_t) lsize);
|
||||||
lp->l_version = (unsigned char) ph.version;
|
lp->l_version = (unsigned char) ph.version;
|
||||||
lp->l_format = (unsigned char) ph.format;
|
lp->l_format = (unsigned char) ph.format;
|
||||||
// INFO: lp->l_checksum is currently unused
|
// INFO: lp->l_checksum is currently unused
|
||||||
lp->l_checksum = upx_adler32(ptr, lsize);
|
set_te32(&lp->l_checksum, upx_adler32(ptr, lsize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -614,8 +614,4 @@ void PackLinuxI386::updateLoader(OutputFile *fo)
|
|||||||
elfout.ehdr.e_entry = fo->getBytesWritten() + elfout.phdr[0].p_vaddr;
|
elfout.ehdr.e_entry = fo->getBytesWritten() + elfout.phdr[0].p_vaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+6
-10
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
unsigned const brka
|
unsigned const brka
|
||||||
);
|
);
|
||||||
virtual int getFormat() const { return UPX_F_LINUX_i386; }
|
virtual int getFormat() const { return UPX_F_LINUX_i386; }
|
||||||
virtual const char *getName() const { return "linux/386"; }
|
virtual const char *getName() const { return "linux.exec/i386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-linux.elf.execve"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-linux.elf.execve"; }
|
||||||
virtual const int *getCompressionMethods(int method, int level) const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
@@ -135,7 +135,7 @@ class PackBSDI386 : public PackLinuxI386
|
|||||||
public:
|
public:
|
||||||
PackBSDI386(InputFile *f);
|
PackBSDI386(InputFile *f);
|
||||||
virtual int getFormat() const { return UPX_F_BSD_i386; }
|
virtual int getFormat() const { return UPX_F_BSD_i386; }
|
||||||
virtual const char *getName() const { return "BSD/386"; }
|
virtual const char *getName() const { return "bsd.exec/i386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-bsd.elf.execve"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-bsd.elf.execve"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -145,8 +145,4 @@ protected:
|
|||||||
};
|
};
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+9
-13
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -114,7 +114,7 @@ void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &)
|
|||||||
h3.phdr[2].p_align = 1;
|
h3.phdr[2].p_align = 1;
|
||||||
|
|
||||||
if (opt->o_unix.make_ptinterp) { // unusual "once per release"
|
if (opt->o_unix.make_ptinterp) { // unusual "once per release"
|
||||||
elfout = h3;
|
*(cprElfHdr3 *)(void *)&elfout = h3;
|
||||||
elfout.ehdr.e_phnum = 1;
|
elfout.ehdr.e_phnum = 1;
|
||||||
fo->write(&elfout, elfout.ehdr.e_ehsize + elfout.ehdr.e_phentsize);
|
fo->write(&elfout, elfout.ehdr.e_ehsize + elfout.ehdr.e_phentsize);
|
||||||
}
|
}
|
||||||
@@ -124,12 +124,12 @@ void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &)
|
|||||||
#undef E
|
#undef E
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackLinuxElf32x86interp::pack2(OutputFile *fo, Filter &ft)
|
int PackLinuxElf32x86interp::pack2(OutputFile *fo, Filter &ft)
|
||||||
{
|
{
|
||||||
if (opt->o_unix.make_ptinterp) {
|
if (opt->o_unix.make_ptinterp) {
|
||||||
return; // ignore current input file!
|
return 1; // ignore current input file!
|
||||||
}
|
}
|
||||||
super::pack2(fo, ft);
|
return super::pack2(fo, ft);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef PAGE_MASK
|
#undef PAGE_MASK
|
||||||
@@ -306,8 +306,4 @@ void PackLinuxElf32x86interp::unpack(OutputFile *fo)
|
|||||||
#undef MAX_INTERP_HDR
|
#undef MAX_INTERP_HDR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+6
-10
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -54,15 +54,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
virtual int pack2(OutputFile *, Filter &); // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &); // build loader
|
virtual void pack3(OutputFile *, Filter &); // build loader
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /*} already included */
|
#endif /*} already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+5
-8
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -168,7 +168,4 @@ PackLinuxI386sh::pack3(OutputFile *fo, Filter &ft)
|
|||||||
elfout.phdr[0].p_filesz = fo->getBytesWritten();
|
elfout.phdr[0].p_filesz = fo->getBytesWritten();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* vim:set ts=4 sw=4 et: */
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+6
-10
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
virtual ~PackLinuxI386sh();
|
virtual ~PackLinuxI386sh();
|
||||||
virtual int getVersion() const { return 13; }
|
virtual int getVersion() const { return 13; }
|
||||||
virtual int getFormat() const { return UPX_F_LINUX_SH_i386; }
|
virtual int getFormat() const { return UPX_F_LINUX_SH_i386; }
|
||||||
virtual const char *getName() const { return "linux/sh386"; }
|
virtual const char *getName() const { return "linux.sh/i386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-linux.elf.shell"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-linux.elf.shell"; }
|
||||||
virtual const int *getFilters() const { return NULL; }
|
virtual const int *getFilters() const { return NULL; }
|
||||||
virtual void buildLoader(const Filter *);
|
virtual void buildLoader(const Filter *);
|
||||||
@@ -71,8 +71,4 @@ protected:
|
|||||||
|
|
||||||
#endif /*} already included */
|
#endif /*} already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+1149
-318
File diff suppressed because it is too large
Load Diff
+576
-95
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -32,10 +32,15 @@
|
|||||||
|
|
||||||
__packed_struct(Mach_fat_header)
|
__packed_struct(Mach_fat_header)
|
||||||
BE32 magic;
|
BE32 magic;
|
||||||
|
# if 0
|
||||||
enum { // note conflict with java bytecode PackLinuxI386
|
enum { // note conflict with java bytecode PackLinuxI386
|
||||||
FAT_MAGIC = 0xcafebabe,
|
FAT_MAGIC = 0xcafebabe,
|
||||||
FAT_MAGIC_SWAB = 0xbebafeca
|
FAT_MAGIC_SWAB = 0xbebafeca
|
||||||
};
|
};
|
||||||
|
# else
|
||||||
|
static const unsigned FAT_MAGIC = 0xcafebabe;
|
||||||
|
static const unsigned FAT_MAGIC_SWAB = 0xbebafeca;
|
||||||
|
# endif
|
||||||
BE32 nfat_arch; // Number of Mach_fat_arch which follow.
|
BE32 nfat_arch; // Number of Mach_fat_arch which follow.
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
@@ -47,7 +52,6 @@ __packed_struct(Mach_fat_arch)
|
|||||||
BE32 align; /* shift count; log base 2 */
|
BE32 align; /* shift count; log base 2 */
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// Mach Mach Object executable; all structures are target-endian
|
// Mach Mach Object executable; all structures are target-endian
|
||||||
// 'otool' is the Mach analog of 'readelf' (convert executable file to ASCII).
|
// 'otool' is the Mach analog of 'readelf' (convert executable file to ASCII).
|
||||||
@@ -71,7 +75,7 @@ __packed_struct(Mach_header)
|
|||||||
|
|
||||||
Word magic;
|
Word magic;
|
||||||
Word cputype;
|
Word cputype;
|
||||||
Word cpysubtype;
|
Word cpusubtype;
|
||||||
Word filetype;
|
Word filetype;
|
||||||
Word ncmds;
|
Word ncmds;
|
||||||
Word sizeofcmds;
|
Word sizeofcmds;
|
||||||
@@ -87,7 +91,7 @@ __packed_struct(Mach_header64)
|
|||||||
|
|
||||||
Word magic;
|
Word magic;
|
||||||
Word cputype;
|
Word cputype;
|
||||||
Word cpysubtype;
|
Word cpusubtype;
|
||||||
Word filetype;
|
Word filetype;
|
||||||
Word ncmds;
|
Word ncmds;
|
||||||
Word sizeofcmds;
|
Word sizeofcmds;
|
||||||
@@ -97,6 +101,17 @@ __packed_struct(Mach_header64)
|
|||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_command) // generic prefix
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd;
|
||||||
|
Word cmdsize;
|
||||||
|
Word data[2]; // because cmdsize >= 16
|
||||||
|
#define WANT_MACH_SEGMENT_ENUM 1
|
||||||
|
#include "p_mach_enum.h"
|
||||||
|
__packed_struct_end();
|
||||||
|
|
||||||
template <class TMachITypes>
|
template <class TMachITypes>
|
||||||
__packed_struct(Mach_segment_command)
|
__packed_struct(Mach_segment_command)
|
||||||
typedef typename TMachITypes::Word Word;
|
typedef typename TMachITypes::Word Word;
|
||||||
@@ -258,7 +273,6 @@ __packed_struct_end()
|
|||||||
template <class TMachITypes>
|
template <class TMachITypes>
|
||||||
__packed_struct(Mach_twolevel_hints_command)
|
__packed_struct(Mach_twolevel_hints_command)
|
||||||
typedef typename TMachITypes::Word Word;
|
typedef typename TMachITypes::Word Word;
|
||||||
typedef typename TMachITypes::Addr Addr;
|
|
||||||
typedef typename TMachITypes::Off Off;
|
typedef typename TMachITypes::Off Off;
|
||||||
|
|
||||||
Word cmd;
|
Word cmd;
|
||||||
@@ -269,6 +283,138 @@ __packed_struct(Mach_twolevel_hints_command)
|
|||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_linkedit_data_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd;
|
||||||
|
Word cmdsize;
|
||||||
|
Word dataoff; // file offset of data in __LINKEDIT segment
|
||||||
|
Word datasize; // file size of data in __LINKEDIT segment
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_uuid_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd; // LC_UUID
|
||||||
|
Word cmdsize; // 24
|
||||||
|
unsigned char uuid[16];
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes, class TMachThreadState>
|
||||||
|
__packed_struct(Mach_thread_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd; /* LC_THREAD or LC_UNIXTHREAD */
|
||||||
|
Word cmdsize; /* total size of this command */
|
||||||
|
Word flavor;
|
||||||
|
Word count; /* sizeof(following_thread_state)/4 */
|
||||||
|
TMachThreadState state;
|
||||||
|
#define WANT_MACH_THREAD_ENUM 1
|
||||||
|
#include "p_mach_enum.h"
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_main_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
typedef typename TMachITypes::Xword Xword;
|
||||||
|
|
||||||
|
Word cmd; // LC_MAIN; MH_EXECUTE only
|
||||||
|
Word cmdsize; // 24
|
||||||
|
Xword entryoff; // file offset of main() [expected in __TEXT]
|
||||||
|
Xword stacksize; // non-default initial stack size
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_source_version_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd; // LC_SOURCE_VERSION
|
||||||
|
Word cmdsize; // 16
|
||||||
|
Word version;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_version_min_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd; // LC_VERSION_MIN_MACOSX
|
||||||
|
Word cmdsize; // 16
|
||||||
|
Word version; // X.Y.Z ==> xxxx.yy.zz
|
||||||
|
Word sdk; // X.Y.Z ==> xxxx.yy.zz
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_dyld_info_only_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd; // LC_DYLD_INFO_ONLY
|
||||||
|
Word cmdsize; // 48
|
||||||
|
Word rebase_off;
|
||||||
|
Word rebase_size;
|
||||||
|
Word bind_off;
|
||||||
|
Word bind_size;
|
||||||
|
Word weak_bind_off;
|
||||||
|
Word weak_bind_size;
|
||||||
|
Word lazy_bind_off;
|
||||||
|
Word lazy_bind_size;
|
||||||
|
Word export_off;
|
||||||
|
Word export_size;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_load_dylinker_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd;
|
||||||
|
Word cmdsize;
|
||||||
|
Word name;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_dylib)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word name; /* library's path name */
|
||||||
|
Word timestamp; /* library's build time stamp */
|
||||||
|
Word current_version; /* library's current version number */
|
||||||
|
Word compatibility_version; /* library's compatibility vers number*/
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_load_dylib_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd;
|
||||||
|
Word cmdsize;
|
||||||
|
Mach_dylib<TMachITypes> dylib;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_function_starts_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd;
|
||||||
|
Word cmdsize;
|
||||||
|
Word dataoff;
|
||||||
|
Word datasize;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_data_in_code_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd;
|
||||||
|
Word cmdsize;
|
||||||
|
Word dataoff;
|
||||||
|
Word datasize;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
} // namespace N_Mach
|
||||||
|
|
||||||
|
namespace N_Mach32 {
|
||||||
|
|
||||||
template <class TMachITypes>
|
template <class TMachITypes>
|
||||||
__packed_struct(Mach_ppc_thread_state)
|
__packed_struct(Mach_ppc_thread_state)
|
||||||
typedef typename TMachITypes::Addr Addr;
|
typedef typename TMachITypes::Addr Addr;
|
||||||
@@ -301,29 +447,6 @@ __packed_struct(Mach_i386_thread_state)
|
|||||||
Word ds, es, fs, gs;
|
Word ds, es, fs, gs;
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
template <class TMachITypes>
|
|
||||||
__packed_struct(Mach_AMD64_thread_state)
|
|
||||||
typedef typename TMachITypes::Xword Xword;
|
|
||||||
|
|
||||||
Xword rax, rbx, rcx, rdx;
|
|
||||||
Xword rdi, rsi, rbp, rsp;
|
|
||||||
Xword r8, r9, r10, r11;
|
|
||||||
Xword r12, r13, r14, r15;
|
|
||||||
Xword rip, rflags;
|
|
||||||
Xword cs, fs, gs;
|
|
||||||
__packed_struct_end()
|
|
||||||
|
|
||||||
template <class TMachITypes>
|
|
||||||
__packed_struct(Mach_i386_new_thread_state)
|
|
||||||
typedef typename TMachITypes::Word Word;
|
|
||||||
|
|
||||||
Word gs, fs, es, ds;
|
|
||||||
Word edi, esi, ebp, esp;
|
|
||||||
Word ebx, edx, ecx, eax;
|
|
||||||
Word eip, cs, efl;
|
|
||||||
Word uesp, ss;
|
|
||||||
__packed_struct_end()
|
|
||||||
|
|
||||||
template <class TMachITypes>
|
template <class TMachITypes>
|
||||||
__packed_struct(Mach_ARM_thread_state)
|
__packed_struct(Mach_ARM_thread_state)
|
||||||
typedef typename TMachITypes::Word Word;
|
typedef typename TMachITypes::Word Word;
|
||||||
@@ -335,14 +458,22 @@ __packed_struct(Mach_ARM_thread_state)
|
|||||||
Word cpsr;
|
Word cpsr;
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
} // namespace N_Mach
|
|
||||||
|
|
||||||
namespace N_Mach32 {
|
|
||||||
|
|
||||||
} // namespace N_Mach32
|
} // namespace N_Mach32
|
||||||
|
|
||||||
namespace N_Mach64 {
|
namespace N_Mach64 {
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_AMD64_thread_state)
|
||||||
|
typedef typename TMachITypes::Xword Xword;
|
||||||
|
|
||||||
|
Xword rax, rbx, rcx, rdx;
|
||||||
|
Xword rdi, rsi, rbp, rsp;
|
||||||
|
Xword r8, r9, r10, r11;
|
||||||
|
Xword r12, r13, r14, r15;
|
||||||
|
Xword rip, rflags;
|
||||||
|
Xword cs, fs, gs;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
template <class TMachITypes>
|
template <class TMachITypes>
|
||||||
__packed_struct(Mach_ppc_thread_state64)
|
__packed_struct(Mach_ppc_thread_state64)
|
||||||
typedef typename TMachITypes::Word Word;
|
typedef typename TMachITypes::Word Word;
|
||||||
@@ -363,6 +494,42 @@ __packed_struct(Mach_ppc_thread_state64)
|
|||||||
Word vrsave; /* Vector Save Register */
|
Word vrsave; /* Vector Save Register */
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_ppcle_thread_state64)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
typedef typename TMachITypes::Xword Xword;
|
||||||
|
|
||||||
|
Xword srr0; /* Instruction address register (PC; entry addr) */
|
||||||
|
Xword srr1; /* Machine state register (supervisor) */
|
||||||
|
Xword r0, r1, r2, r3, r4, r5, r6, r7;
|
||||||
|
Xword r8, r9,r10,r11,r12,r13,r14,r15;
|
||||||
|
Xword r16,r17,r18,r19,r20,r21,r22,r23;
|
||||||
|
Xword r24,r25,r26,r27,r28,r29,r30,r31;
|
||||||
|
|
||||||
|
Word cr; /* Condition register */ // FIXME: Xword?
|
||||||
|
Xword xer; /* User's integer exception register */
|
||||||
|
Xword lr; /* Link register */
|
||||||
|
Xword ctr; /* Count register */
|
||||||
|
|
||||||
|
Word vrsave; /* Vector Save Register */
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes> __packed_struct(Mach_ARM64_thread_state)
|
||||||
|
typedef typename TMachITypes::Xword Xword;
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Xword x0, x1, x2, x3;
|
||||||
|
Xword x4, x5, x6, x7;
|
||||||
|
Xword x8, x9, x10, x11;
|
||||||
|
Xword x12, x13, x14, x15;
|
||||||
|
Xword x16, x17, x18, x19;
|
||||||
|
Xword x20, x21, x22, x23;
|
||||||
|
Xword x24, x25, x26, x27;
|
||||||
|
Xword x28, fp, lr, sp;
|
||||||
|
Xword pc;
|
||||||
|
Word cpsr;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
} // namespace N_Mach64
|
} // namespace N_Mach64
|
||||||
|
|
||||||
namespace N_Mach {
|
namespace N_Mach {
|
||||||
@@ -377,14 +544,11 @@ struct MachClass_32
|
|||||||
typedef typename TP::U32 TE32;
|
typedef typename TP::U32 TE32;
|
||||||
typedef typename TP::U64 TE64;
|
typedef typename TP::U64 TE64;
|
||||||
typedef N_Mach::MachITypes<TE32, TE64, TE32, TE32> MachITypes;
|
typedef N_Mach::MachITypes<TE32, TE64, TE32, TE32> MachITypes;
|
||||||
#if (ACC_CC_BORLANDC)
|
|
||||||
typedef TE32 Addr;
|
|
||||||
#else
|
|
||||||
typedef typename MachITypes::Addr Addr;
|
typedef typename MachITypes::Addr Addr;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Mach types
|
// Mach types
|
||||||
typedef N_Mach::Mach_header<MachITypes> Mach_header;
|
typedef N_Mach::Mach_header<MachITypes> Mach_header;
|
||||||
|
typedef N_Mach::Mach_command<MachITypes> Mach_command;
|
||||||
typedef N_Mach::Mach_segment_command<MachITypes> Mach_segment_command;
|
typedef N_Mach::Mach_segment_command<MachITypes> Mach_segment_command;
|
||||||
typedef N_Mach::Mach_section_command<MachITypes> Mach_section_command;
|
typedef N_Mach::Mach_section_command<MachITypes> Mach_section_command;
|
||||||
typedef N_Mach::Mach_symtab_command<MachITypes> Mach_symtab_command;
|
typedef N_Mach::Mach_symtab_command<MachITypes> Mach_symtab_command;
|
||||||
@@ -392,10 +556,21 @@ struct MachClass_32
|
|||||||
typedef N_Mach::Mach_segsplit_info_command<MachITypes> Mach_segsplit_info_command;
|
typedef N_Mach::Mach_segsplit_info_command<MachITypes> Mach_segsplit_info_command;
|
||||||
typedef N_Mach::Mach_routines_command<MachITypes> Mach_routines_command;
|
typedef N_Mach::Mach_routines_command<MachITypes> Mach_routines_command;
|
||||||
typedef N_Mach::Mach_twolevel_hints_command<MachITypes> Mach_twolevel_hints_command;
|
typedef N_Mach::Mach_twolevel_hints_command<MachITypes> Mach_twolevel_hints_command;
|
||||||
typedef N_Mach::Mach_ppc_thread_state<MachITypes> Mach_ppc_thread_state;
|
typedef N_Mach::Mach_linkedit_data_command<MachITypes> Mach_linkedit_data_command;
|
||||||
typedef N_Mach::Mach_i386_thread_state<MachITypes> Mach_i386_thread_state;
|
typedef N_Mach::Mach_uuid_command<MachITypes> Mach_uuid_command;
|
||||||
typedef N_Mach::Mach_AMD64_thread_state<MachITypes> Mach_AMD64_thread_state;
|
typedef N_Mach::Mach_data_in_code_command<MachITypes> Mach_data_in_code_command;
|
||||||
typedef N_Mach::Mach_ARM_thread_state<MachITypes> Mach_ARM_thread_state;
|
typedef N_Mach::Mach_function_starts_command<MachITypes> Mach_function_starts_command;
|
||||||
|
typedef N_Mach::Mach_load_dylib_command<MachITypes> Mach_load_dylib_command;
|
||||||
|
typedef N_Mach::Mach_dylib<MachITypes> Mach_dylib;
|
||||||
|
typedef N_Mach::Mach_load_dylinker_command<MachITypes> Mach_load_dylinker_command;
|
||||||
|
typedef N_Mach::Mach_dyld_info_only_command<MachITypes> Mach_dyld_info_only_command;
|
||||||
|
typedef N_Mach::Mach_version_min_command<MachITypes> Mach_version_min_command;
|
||||||
|
typedef N_Mach::Mach_source_version_command<MachITypes> Mach_source_version_command;
|
||||||
|
typedef N_Mach::Mach_main_command<MachITypes> Mach_main_command;
|
||||||
|
|
||||||
|
typedef N_Mach32::Mach_ppc_thread_state<MachITypes> Mach_ppc_thread_state;
|
||||||
|
typedef N_Mach32::Mach_i386_thread_state<MachITypes> Mach_i386_thread_state;
|
||||||
|
typedef N_Mach32::Mach_ARM_thread_state<MachITypes> Mach_ARM_thread_state;
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() {
|
||||||
BeLePolicy::compileTimeAssertions();
|
BeLePolicy::compileTimeAssertions();
|
||||||
@@ -413,14 +588,11 @@ struct MachClass_64
|
|||||||
typedef typename TP::U32 TE32;
|
typedef typename TP::U32 TE32;
|
||||||
typedef typename TP::U64 TE64;
|
typedef typename TP::U64 TE64;
|
||||||
typedef N_Mach::MachITypes<TE32, TE64, TE64, TE64> MachITypes;
|
typedef N_Mach::MachITypes<TE32, TE64, TE64, TE64> MachITypes;
|
||||||
#if (ACC_CC_BORLANDC)
|
|
||||||
typedef TE64 Addr;
|
|
||||||
#else
|
|
||||||
typedef typename MachITypes::Addr Addr;
|
typedef typename MachITypes::Addr Addr;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Mach types
|
// Mach types
|
||||||
typedef N_Mach::Mach_header64<MachITypes> Mach_header;
|
typedef N_Mach::Mach_header64<MachITypes> Mach_header;
|
||||||
|
typedef N_Mach::Mach_command<MachITypes> Mach_command;
|
||||||
typedef N_Mach::Mach_segment_command<MachITypes> Mach_segment_command;
|
typedef N_Mach::Mach_segment_command<MachITypes> Mach_segment_command;
|
||||||
typedef N_Mach::Mach_section_command_64<MachITypes> Mach_section_command;
|
typedef N_Mach::Mach_section_command_64<MachITypes> Mach_section_command;
|
||||||
typedef N_Mach::Mach_symtab_command<MachITypes> Mach_symtab_command;
|
typedef N_Mach::Mach_symtab_command<MachITypes> Mach_symtab_command;
|
||||||
@@ -428,6 +600,21 @@ struct MachClass_64
|
|||||||
typedef N_Mach::Mach_segsplit_info_command<MachITypes> Mach_segsplit_info_command;
|
typedef N_Mach::Mach_segsplit_info_command<MachITypes> Mach_segsplit_info_command;
|
||||||
typedef N_Mach::Mach_routines_command_64<MachITypes> Mach_routines_command;
|
typedef N_Mach::Mach_routines_command_64<MachITypes> Mach_routines_command;
|
||||||
typedef N_Mach::Mach_twolevel_hints_command<MachITypes> Mach_twolevel_hints_command;
|
typedef N_Mach::Mach_twolevel_hints_command<MachITypes> Mach_twolevel_hints_command;
|
||||||
|
typedef N_Mach::Mach_linkedit_data_command<MachITypes> Mach_linkedit_data_command;
|
||||||
|
typedef N_Mach::Mach_uuid_command<MachITypes> Mach_uuid_command;
|
||||||
|
typedef N_Mach::Mach_data_in_code_command<MachITypes> Mach_data_in_code_command;
|
||||||
|
typedef N_Mach::Mach_function_starts_command<MachITypes> Mach_function_starts_command;
|
||||||
|
typedef N_Mach::Mach_load_dylib_command<MachITypes> Mach_load_dylib_command;
|
||||||
|
typedef N_Mach::Mach_dylib<MachITypes> Mach_dylib;
|
||||||
|
typedef N_Mach::Mach_load_dylinker_command<MachITypes> Mach_load_dylinker_command;
|
||||||
|
typedef N_Mach::Mach_dyld_info_only_command<MachITypes> Mach_dyld_info_only_command;
|
||||||
|
typedef N_Mach::Mach_version_min_command<MachITypes> Mach_version_min_command;
|
||||||
|
typedef N_Mach::Mach_source_version_command<MachITypes> Mach_source_version_command;
|
||||||
|
typedef N_Mach::Mach_main_command<MachITypes> Mach_main_command;
|
||||||
|
|
||||||
|
typedef N_Mach64::Mach_ppcle_thread_state64<MachITypes> Mach_ppcle_thread_state64;
|
||||||
|
typedef N_Mach64::Mach_AMD64_thread_state<MachITypes> Mach_AMD64_thread_state;
|
||||||
|
typedef N_Mach64::Mach_ARM64_thread_state<MachITypes> Mach_ARM64_thread_state;
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() {
|
||||||
BeLePolicy::compileTimeAssertions();
|
BeLePolicy::compileTimeAssertions();
|
||||||
@@ -452,6 +639,17 @@ typedef MachClass_Host32::Mach_dysymtab_command Mach32_dysymtab_command;
|
|||||||
typedef MachClass_Host32::Mach_segsplit_info_command Mach32_segsplit_info_command;
|
typedef MachClass_Host32::Mach_segsplit_info_command Mach32_segsplit_info_command;
|
||||||
typedef MachClass_Host32::Mach_routines_command Mach32_routines_command;
|
typedef MachClass_Host32::Mach_routines_command Mach32_routines_command;
|
||||||
typedef MachClass_Host32::Mach_twolevel_hints_command Mach32_twolevel_hints_command;
|
typedef MachClass_Host32::Mach_twolevel_hints_command Mach32_twolevel_hints_command;
|
||||||
|
typedef MachClass_Host32::Mach_linkedit_data_command Mach32_linkedit_data_command;
|
||||||
|
typedef MachClass_Host32::Mach_uuid_command Mach32_uuid_command;
|
||||||
|
typedef MachClass_Host32::Mach_main_command Mach32_main_command;
|
||||||
|
typedef MachClass_Host32::Mach_data_in_code_command Mach32_data_in_code_command;
|
||||||
|
typedef MachClass_Host32::Mach_function_starts_command Mach32_function_starts_command;
|
||||||
|
typedef MachClass_Host32::Mach_load_dylib_command Mach32_load_dylib_command;
|
||||||
|
typedef MachClass_Host32::Mach_dylib Mach32_dylib;
|
||||||
|
typedef MachClass_Host32::Mach_load_dylinker_command Mach32_load_dylinker_command;
|
||||||
|
typedef MachClass_Host32::Mach_dyld_info_only_command Mach32_dyld_info_only_command;
|
||||||
|
typedef MachClass_Host32::Mach_version_min_command Mach32_version_min_command;
|
||||||
|
typedef MachClass_Host32::Mach_source_version_command Mach32_source_version_command;
|
||||||
|
|
||||||
typedef MachClass_Host64::Mach_segment_command Mach64_segment_command;
|
typedef MachClass_Host64::Mach_segment_command Mach64_segment_command;
|
||||||
typedef MachClass_Host64::Mach_section_command Mach64_section_command;
|
typedef MachClass_Host64::Mach_section_command Mach64_section_command;
|
||||||
@@ -460,6 +658,17 @@ typedef MachClass_Host64::Mach_dysymtab_command Mach64_dysymtab_command;
|
|||||||
typedef MachClass_Host64::Mach_segsplit_info_command Mach64_segsplit_info_command;
|
typedef MachClass_Host64::Mach_segsplit_info_command Mach64_segsplit_info_command;
|
||||||
typedef MachClass_Host64::Mach_routines_command Mach64_routines_command;
|
typedef MachClass_Host64::Mach_routines_command Mach64_routines_command;
|
||||||
typedef MachClass_Host64::Mach_twolevel_hints_command Mach64_twolevel_hints_command;
|
typedef MachClass_Host64::Mach_twolevel_hints_command Mach64_twolevel_hints_command;
|
||||||
|
typedef MachClass_Host64::Mach_linkedit_data_command Mach64_linkedit_data_command;
|
||||||
|
typedef MachClass_Host64::Mach_uuid_command Mach64_uuid_command;
|
||||||
|
typedef MachClass_Host64::Mach_main_command Mach64_main_command;
|
||||||
|
typedef MachClass_Host64::Mach_data_in_code_command Mach64_data_in_code_command;
|
||||||
|
typedef MachClass_Host64::Mach_function_starts_command Mach64_function_starts_command;
|
||||||
|
typedef MachClass_Host64::Mach_load_dylib_command Mach64_load_dylib_command;
|
||||||
|
typedef MachClass_Host64::Mach_dylib Mach64_dylib;
|
||||||
|
typedef MachClass_Host64::Mach_load_dylinker_command Mach64_load_dylinker_command;
|
||||||
|
typedef MachClass_Host64::Mach_dyld_info_only_command Mach64_dyld_info_only_command;
|
||||||
|
typedef MachClass_Host64::Mach_version_min_command Mach64_version_min_command;
|
||||||
|
typedef MachClass_Host64::Mach_source_version_command Mach64_source_version_command;
|
||||||
|
|
||||||
typedef MachClass_BE32::Mach_segment_command MachBE32_segment_command;
|
typedef MachClass_BE32::Mach_segment_command MachBE32_segment_command;
|
||||||
typedef MachClass_BE32::Mach_section_command MachBE32_section_command;
|
typedef MachClass_BE32::Mach_section_command MachBE32_section_command;
|
||||||
@@ -468,6 +677,17 @@ typedef MachClass_BE32::Mach_dysymtab_command MachBE32_dysymtab_command;
|
|||||||
typedef MachClass_BE32::Mach_segsplit_info_command MachBE32_segsplit_info_command;
|
typedef MachClass_BE32::Mach_segsplit_info_command MachBE32_segsplit_info_command;
|
||||||
typedef MachClass_BE32::Mach_routines_command MachBE32_routines_command;
|
typedef MachClass_BE32::Mach_routines_command MachBE32_routines_command;
|
||||||
typedef MachClass_BE32::Mach_twolevel_hints_command MachBE32_twolevel_hints_command;
|
typedef MachClass_BE32::Mach_twolevel_hints_command MachBE32_twolevel_hints_command;
|
||||||
|
typedef MachClass_BE32::Mach_linkedit_data_command MachBE32_linkedit_data_command;
|
||||||
|
typedef MachClass_BE32::Mach_uuid_command MachBE32_uuid_command;
|
||||||
|
typedef MachClass_BE32::Mach_main_command MachBE32_main_command;
|
||||||
|
typedef MachClass_BE32::Mach_data_in_code_command MachBE32_data_in_code_command;
|
||||||
|
typedef MachClass_BE32::Mach_function_starts_command MachBE32_function_starts_command;
|
||||||
|
typedef MachClass_BE32::Mach_load_dylib_command MachBE32_load_dylib_command;
|
||||||
|
typedef MachClass_BE32::Mach_dylib MachBE32_dylib;
|
||||||
|
typedef MachClass_BE32::Mach_load_dylinker_command MachBE32_load_dylinker_command;
|
||||||
|
typedef MachClass_BE32::Mach_dyld_info_only_command MachBE32_dyld_info_only_command;
|
||||||
|
typedef MachClass_BE32::Mach_version_min_command MachBE32_version_min_command;
|
||||||
|
typedef MachClass_BE32::Mach_source_version_command MachBE32_source_version_command;
|
||||||
|
|
||||||
typedef MachClass_BE64::Mach_segment_command MachBE64_segment_command;
|
typedef MachClass_BE64::Mach_segment_command MachBE64_segment_command;
|
||||||
typedef MachClass_BE64::Mach_section_command MachBE64_section_command;
|
typedef MachClass_BE64::Mach_section_command MachBE64_section_command;
|
||||||
@@ -476,6 +696,17 @@ typedef MachClass_BE64::Mach_dysymtab_command MachBE64_dysymtab_command;
|
|||||||
typedef MachClass_BE64::Mach_segsplit_info_command MachBE64_segsplit_info_command;
|
typedef MachClass_BE64::Mach_segsplit_info_command MachBE64_segsplit_info_command;
|
||||||
typedef MachClass_BE64::Mach_routines_command MachBE64_routines_command;
|
typedef MachClass_BE64::Mach_routines_command MachBE64_routines_command;
|
||||||
typedef MachClass_BE64::Mach_twolevel_hints_command MachBE64_twolevel_hints_command;
|
typedef MachClass_BE64::Mach_twolevel_hints_command MachBE64_twolevel_hints_command;
|
||||||
|
typedef MachClass_BE64::Mach_linkedit_data_command MachBE64_linkedit_data_command;
|
||||||
|
typedef MachClass_BE64::Mach_uuid_command MachBE64_uuid_command;
|
||||||
|
typedef MachClass_BE64::Mach_main_command MachBE64_main_command;
|
||||||
|
typedef MachClass_BE64::Mach_data_in_code_command MachBE64_data_in_code_command;
|
||||||
|
typedef MachClass_BE64::Mach_function_starts_command MachBE64_function_starts_command;
|
||||||
|
typedef MachClass_BE64::Mach_load_dylib_command MachBE64_load_dylib_command;
|
||||||
|
typedef MachClass_BE64::Mach_dylib MachBE64_dylib;
|
||||||
|
typedef MachClass_BE64::Mach_load_dylinker_command MachBE64_load_dylinker_command;
|
||||||
|
typedef MachClass_BE64::Mach_dyld_info_only_command MachBE64_dyld_info_only_command;
|
||||||
|
typedef MachClass_BE64::Mach_version_min_command MachBE64_version_min_command;
|
||||||
|
typedef MachClass_BE64::Mach_source_version_command MachBE64_source_version_command;
|
||||||
|
|
||||||
typedef MachClass_LE32::Mach_segment_command MachLE32_segment_command;
|
typedef MachClass_LE32::Mach_segment_command MachLE32_segment_command;
|
||||||
typedef MachClass_LE32::Mach_section_command MachLE32_section_command;
|
typedef MachClass_LE32::Mach_section_command MachLE32_section_command;
|
||||||
@@ -484,6 +715,17 @@ typedef MachClass_LE32::Mach_dysymtab_command MachLE32_dysymtab_command;
|
|||||||
typedef MachClass_LE32::Mach_segsplit_info_command MachLE32_segsplit_info_command;
|
typedef MachClass_LE32::Mach_segsplit_info_command MachLE32_segsplit_info_command;
|
||||||
typedef MachClass_LE32::Mach_routines_command MachLE32_routines_command;
|
typedef MachClass_LE32::Mach_routines_command MachLE32_routines_command;
|
||||||
typedef MachClass_LE32::Mach_twolevel_hints_command MachLE32_twolevel_hints_command;
|
typedef MachClass_LE32::Mach_twolevel_hints_command MachLE32_twolevel_hints_command;
|
||||||
|
typedef MachClass_LE32::Mach_linkedit_data_command MachLE32_linkedit_data_command;
|
||||||
|
typedef MachClass_LE32::Mach_uuid_command MachLE32_uuid_command;
|
||||||
|
typedef MachClass_LE32::Mach_main_command MachLE32_main_command;
|
||||||
|
typedef MachClass_LE32::Mach_data_in_code_command MachLE32_data_in_code_command;
|
||||||
|
typedef MachClass_LE32::Mach_function_starts_command MachLE32_function_starts_command;
|
||||||
|
typedef MachClass_LE32::Mach_load_dylib_command MachLE32_load_dylib_command;
|
||||||
|
typedef MachClass_LE32::Mach_dylib MachLE32_dylib;
|
||||||
|
typedef MachClass_LE32::Mach_load_dylinker_command MachLE32_load_dylinker_command;
|
||||||
|
typedef MachClass_LE32::Mach_dyld_info_only_command MachLE32_dyld_info_only_command;
|
||||||
|
typedef MachClass_LE32::Mach_version_min_command MachLE32_version_min_command;
|
||||||
|
typedef MachClass_LE32::Mach_source_version_command MachLE32_source_version_command;
|
||||||
|
|
||||||
typedef MachClass_LE64::Mach_segment_command MachLE64_segment_command;
|
typedef MachClass_LE64::Mach_segment_command MachLE64_segment_command;
|
||||||
typedef MachClass_LE64::Mach_section_command MachLE64_section_command;
|
typedef MachClass_LE64::Mach_section_command MachLE64_section_command;
|
||||||
@@ -492,10 +734,23 @@ typedef MachClass_LE64::Mach_dysymtab_command MachLE64_dysymtab_command;
|
|||||||
typedef MachClass_LE64::Mach_segsplit_info_command MachLE64_segsplit_info_command;
|
typedef MachClass_LE64::Mach_segsplit_info_command MachLE64_segsplit_info_command;
|
||||||
typedef MachClass_LE64::Mach_routines_command MachLE64_routines_command;
|
typedef MachClass_LE64::Mach_routines_command MachLE64_routines_command;
|
||||||
typedef MachClass_LE64::Mach_twolevel_hints_command MachLE64_twolevel_hints_command;
|
typedef MachClass_LE64::Mach_twolevel_hints_command MachLE64_twolevel_hints_command;
|
||||||
|
typedef MachClass_LE64::Mach_linkedit_data_command MachLE64_linkedit_data_command;
|
||||||
|
typedef MachClass_LE64::Mach_uuid_command MachLE64_uuid_command;
|
||||||
|
typedef MachClass_LE64::Mach_main_command MachLE64_main_command;
|
||||||
|
typedef MachClass_LE64::Mach_data_in_code_command MachLE64_data_in_code_command;
|
||||||
|
typedef MachClass_LE64::Mach_function_starts_command MachLE64_function_starts_command;
|
||||||
|
typedef MachClass_LE64::Mach_load_dylib_command MachLE64_load_dylib_command;
|
||||||
|
typedef MachClass_LE64::Mach_dylib MachLE64_dylib;
|
||||||
|
typedef MachClass_LE64::Mach_load_dylinker_command MachLE64_load_dylinker_command;
|
||||||
|
typedef MachClass_LE64::Mach_dyld_info_only_command MachLE64_dyld_info_only_command;
|
||||||
|
typedef MachClass_LE64::Mach_version_min_command MachLE64_version_min_command;
|
||||||
|
typedef MachClass_LE64::Mach_source_version_command MachLE64_source_version_command;
|
||||||
|
|
||||||
typedef MachClass_BE32::Mach_ppc_thread_state Mach_ppc_thread_state;
|
typedef MachClass_BE32::Mach_ppc_thread_state Mach_ppc_thread_state;
|
||||||
|
typedef MachClass_LE64::Mach_ppcle_thread_state64 Mach_ppcle_thread_state64;
|
||||||
typedef MachClass_LE32::Mach_i386_thread_state Mach_i386_thread_state;
|
typedef MachClass_LE32::Mach_i386_thread_state Mach_i386_thread_state;
|
||||||
typedef MachClass_LE32::Mach_AMD64_thread_state Mach_AMD64_thread_state; // FIXME LE32 vs AMD64
|
typedef MachClass_LE64::Mach_AMD64_thread_state Mach_AMD64_thread_state;
|
||||||
|
typedef MachClass_LE64::Mach_ARM64_thread_state Mach_ARM64_thread_state;
|
||||||
typedef MachClass_LE32::Mach_ARM_thread_state Mach_ARM_thread_state;
|
typedef MachClass_LE32::Mach_ARM_thread_state Mach_ARM_thread_state;
|
||||||
#include "p_unix.h"
|
#include "p_unix.h"
|
||||||
|
|
||||||
@@ -515,6 +770,7 @@ protected:
|
|||||||
typedef typename MachClass::Addr Addr;
|
typedef typename MachClass::Addr Addr;
|
||||||
// Mach types
|
// Mach types
|
||||||
typedef typename MachClass::Mach_header Mach_header;
|
typedef typename MachClass::Mach_header Mach_header;
|
||||||
|
typedef typename MachClass::Mach_command Mach_command;
|
||||||
typedef typename MachClass::Mach_segment_command Mach_segment_command;
|
typedef typename MachClass::Mach_segment_command Mach_segment_command;
|
||||||
typedef typename MachClass::Mach_section_command Mach_section_command;
|
typedef typename MachClass::Mach_section_command Mach_section_command;
|
||||||
typedef typename MachClass::Mach_symtab_command Mach_symtab_command;
|
typedef typename MachClass::Mach_symtab_command Mach_symtab_command;
|
||||||
@@ -522,6 +778,17 @@ protected:
|
|||||||
typedef typename MachClass::Mach_segsplit_info_command Mach_segsplit_info_command;
|
typedef typename MachClass::Mach_segsplit_info_command Mach_segsplit_info_command;
|
||||||
typedef typename MachClass::Mach_routines_command Mach_routines_command;
|
typedef typename MachClass::Mach_routines_command Mach_routines_command;
|
||||||
typedef typename MachClass::Mach_twolevel_hints_command Mach_twolevel_hints_command;
|
typedef typename MachClass::Mach_twolevel_hints_command Mach_twolevel_hints_command;
|
||||||
|
typedef typename MachClass::Mach_linkedit_data_command Mach_linkedit_data_command;
|
||||||
|
typedef typename MachClass::Mach_uuid_command Mach_uuid_command;
|
||||||
|
typedef typename MachClass::Mach_main_command Mach_main_command;
|
||||||
|
typedef typename MachClass::Mach_data_in_code_command Mach_data_in_code_command;
|
||||||
|
typedef typename MachClass::Mach_function_starts_command Mach_function_starts_command;
|
||||||
|
typedef typename MachClass::Mach_load_dylib_command Mach_load_dylib_command;
|
||||||
|
typedef typename MachClass::Mach_dylib Mach_dylib;
|
||||||
|
typedef typename MachClass::Mach_load_dylinker_command Mach_load_dylinker_command;
|
||||||
|
typedef typename MachClass::Mach_dyld_info_only_command Mach_dyld_info_only_command;
|
||||||
|
typedef typename MachClass::Mach_version_min_command Mach_version_min_command;
|
||||||
|
typedef typename MachClass::Mach_source_version_command Mach_source_version_command;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PackMachBase(InputFile *, unsigned cpuid, unsigned filetype,
|
PackMachBase(InputFile *, unsigned cpuid, unsigned filetype,
|
||||||
@@ -532,22 +799,28 @@ public:
|
|||||||
|
|
||||||
// called by the generic pack()
|
// called by the generic pack()
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
virtual int pack2(OutputFile *, Filter &); // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &) = 0; // append loader
|
virtual void pack3(OutputFile *, Filter &) /*= 0*/; // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &) = 0; // append PackHeader
|
virtual void pack4(OutputFile *, Filter &) /*= 0*/; // append PackHeader
|
||||||
|
|
||||||
virtual void pack4dylib(OutputFile *, Filter &, Addr init_address);
|
virtual void pack4dylib(OutputFile *, Filter &, Addr init_address);
|
||||||
|
|
||||||
|
virtual int threado_size() const = 0;
|
||||||
|
virtual void threado_setPC(upx_uint64_t pc) = 0;
|
||||||
|
virtual void threado_rewrite(OutputFile *) = 0;
|
||||||
|
virtual void threado_write(OutputFile *) = 0;
|
||||||
virtual void pack1_setup_threado(OutputFile *const fo) = 0;
|
virtual void pack1_setup_threado(OutputFile *const fo) = 0;
|
||||||
virtual void unpack(OutputFile *fo);
|
virtual void unpack(OutputFile *fo);
|
||||||
|
|
||||||
virtual bool canPack();
|
virtual bool canPack();
|
||||||
virtual unsigned find_SEGMENT_gap(unsigned const k);
|
virtual int canUnpack();
|
||||||
|
virtual unsigned find_SEGMENT_gap(unsigned const k, unsigned pos_eof);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void patchLoader();
|
virtual void patchLoader();
|
||||||
virtual void patchLoaderChecksum();
|
virtual void patchLoaderChecksum();
|
||||||
virtual void updateLoader(OutputFile *);
|
virtual void updateLoader(OutputFile *);
|
||||||
|
virtual void buildLoader(const Filter *ft);
|
||||||
virtual void buildMachLoader(
|
virtual void buildMachLoader(
|
||||||
upx_byte const *const proto,
|
upx_byte const *const proto,
|
||||||
unsigned const szproto,
|
unsigned const szproto,
|
||||||
@@ -559,7 +832,11 @@ protected:
|
|||||||
|
|
||||||
static int __acc_cdecl_qsort compare_segment_command(void const *aa, void const *bb);
|
static int __acc_cdecl_qsort compare_segment_command(void const *aa, void const *bb);
|
||||||
|
|
||||||
|
virtual upx_uint64_t threadc_getPC(void /*MachThreadCommand*/ const *) = 0;
|
||||||
|
|
||||||
|
upx_uint64_t entryVMA;
|
||||||
unsigned my_cputype;
|
unsigned my_cputype;
|
||||||
|
unsigned my_cpusubtype;
|
||||||
unsigned my_filetype;
|
unsigned my_filetype;
|
||||||
unsigned my_thread_flavor;
|
unsigned my_thread_flavor;
|
||||||
unsigned my_thread_state_word_count;
|
unsigned my_thread_state_word_count;
|
||||||
@@ -568,14 +845,29 @@ protected:
|
|||||||
unsigned n_segment;
|
unsigned n_segment;
|
||||||
unsigned sz_segment;
|
unsigned sz_segment;
|
||||||
unsigned sz_mach_headers;
|
unsigned sz_mach_headers;
|
||||||
|
unsigned sz_stub_entry;
|
||||||
|
unsigned sz_stub_fold;
|
||||||
|
unsigned sz_stub_main;
|
||||||
|
upx_byte const *stub_entry;
|
||||||
|
upx_byte const *stub_fold;
|
||||||
|
upx_byte const *stub_main;
|
||||||
Mach_segment_command *rawmseg; // as input, with sections
|
Mach_segment_command *rawmseg; // as input, with sections
|
||||||
Mach_segment_command *msegcmd; // LC_SEGMENT first, without sections
|
Mach_segment_command *msegcmd; // LC_SEGMENT first, without sections
|
||||||
unsigned o_routines_cmd; // file offset to LC_ROUINTES
|
unsigned o_routines_cmd; // file offset to LC_ROUINTES
|
||||||
acc_uint64l_t prev_init_address;
|
upx_uint64_t prev_init_address;
|
||||||
Mach_header mhdri;
|
Mach_header mhdri;
|
||||||
|
|
||||||
Mach_header mhdro;
|
Mach_header mhdro;
|
||||||
Mach_segment_command segcmdo;
|
Mach_segment_command segZERO;
|
||||||
|
Mach_segment_command segXHDR; // location to put eXtra headers
|
||||||
|
Mach_section_command secXHDR;
|
||||||
|
Mach_segment_command segTEXT;
|
||||||
|
Mach_section_command secTEXT;
|
||||||
|
Mach_segment_command segLINK;
|
||||||
|
Mach_linkedit_data_command linkitem;
|
||||||
|
Mach_uuid_command cmdUUID; // copied from input, then incremented
|
||||||
|
Mach_source_version_command cmdSRCVER; // copied from input
|
||||||
|
Mach_version_min_command cmdVERMIN; // copied from input
|
||||||
|
|
||||||
__packed_struct(b_info) // 12-byte header before each compressed block
|
__packed_struct(b_info) // 12-byte header before each compressed block
|
||||||
TE32 sz_unc; // uncompressed_size
|
TE32 sz_unc; // uncompressed_size
|
||||||
@@ -622,29 +914,101 @@ public:
|
|||||||
PackMachPPC32(InputFile *f);
|
PackMachPPC32(InputFile *f);
|
||||||
|
|
||||||
virtual int getFormat() const { return UPX_F_MACH_PPC32; }
|
virtual int getFormat() const { return UPX_F_MACH_PPC32; }
|
||||||
virtual const char *getName() const { return "Mach/ppc32"; }
|
virtual const char *getName() const { return "macho/ppc32"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "powerpc-darwin.macho"; }
|
virtual const char *getFullName(const options_t *) const { return "powerpc-darwin.macho"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack1_setup_threado(OutputFile *const fo);
|
virtual void pack1_setup_threado(OutputFile *const fo);
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
|
||||||
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
virtual void buildLoader(const Filter *ft);
|
virtual void addStubEntrySections(Filter const *);
|
||||||
|
|
||||||
__packed_struct(Mach_thread_command)
|
__packed_struct(Mach_thread_command)
|
||||||
BE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
|
TE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
|
||||||
BE32 cmdsize; /* total size of this command */
|
TE32 cmdsize; /* total size of this command */
|
||||||
BE32 flavor;
|
TE32 flavor;
|
||||||
BE32 count; /* sizeof(following_thread_state)/4 */
|
TE32 count; /* sizeof(following_thread_state)/4 */
|
||||||
Mach_ppc_thread_state state;
|
Mach_ppc_thread_state state;
|
||||||
#define WANT_MACH_THREAD_ENUM 1
|
#define WANT_MACH_THREAD_ENUM 1
|
||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
Mach_thread_command threado;
|
Mach_thread_command threado;
|
||||||
|
int threado_size() const { return sizeof(threado); }
|
||||||
|
void threado_setPC(upx_uint64_t pc) {
|
||||||
|
memset(&threado, 0, sizeof(threado));
|
||||||
|
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
|
||||||
|
threado.cmdsize = sizeof(threado);
|
||||||
|
threado.flavor = my_thread_flavor;
|
||||||
|
threado.count = my_thread_state_word_count;
|
||||||
|
threado.state.srr0 = pc;
|
||||||
|
}
|
||||||
|
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
|
||||||
|
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
|
||||||
|
|
||||||
|
upx_uint64_t threadc_getPC(void const *ptr) {
|
||||||
|
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
|
||||||
|
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|
||||||
|
|| tc->cmdsize!=sizeof(threado)
|
||||||
|
|| tc->flavor!=my_thread_flavor
|
||||||
|
|| tc->count!=my_thread_state_word_count) {
|
||||||
|
return ~0ull;
|
||||||
|
}
|
||||||
|
return tc->state.srr0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class PackMachPPC64LE : public PackMachBase<MachClass_LE64>
|
||||||
|
{
|
||||||
|
typedef PackMachBase<MachClass_LE64> super;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PackMachPPC64LE(InputFile *f);
|
||||||
|
|
||||||
|
virtual int getFormat() const { return UPX_F_MACH_PPC64LE; }
|
||||||
|
virtual const char *getName() const { return "macho/ppc64le"; }
|
||||||
|
virtual const char *getFullName(const options_t *) const { return "powerpc64le-darwin.macho"; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
|
virtual void pack1_setup_threado(OutputFile *const fo);
|
||||||
|
virtual Linker* newLinker() const;
|
||||||
|
|
||||||
|
__packed_struct(Mach_thread_command)
|
||||||
|
LE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
|
||||||
|
LE32 cmdsize; /* total size of this command */
|
||||||
|
LE32 flavor;
|
||||||
|
LE32 count; /* sizeof(following_thread_state)/4 */
|
||||||
|
Mach_ppcle_thread_state64 state64;
|
||||||
|
#define WANT_MACH_THREAD_ENUM 1
|
||||||
|
#include "p_mach_enum.h"
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
Mach_thread_command threado;
|
||||||
|
int threado_size() const { return sizeof(threado); }
|
||||||
|
void threado_setPC(upx_uint64_t pc) {
|
||||||
|
memset(&threado, 0, sizeof(threado));
|
||||||
|
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
|
||||||
|
threado.cmdsize = sizeof(threado);
|
||||||
|
threado.flavor = my_thread_flavor;
|
||||||
|
threado.count = my_thread_state_word_count;
|
||||||
|
threado.state64.srr0 = pc;
|
||||||
|
}
|
||||||
|
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
|
||||||
|
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
|
||||||
|
|
||||||
|
upx_uint64_t threadc_getPC(void const *ptr) {
|
||||||
|
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
|
||||||
|
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|
||||||
|
|| tc->cmdsize!=sizeof(threado)
|
||||||
|
|| tc->flavor!=my_thread_flavor
|
||||||
|
|| tc->count!=my_thread_state_word_count) {
|
||||||
|
return ~0ull;
|
||||||
|
}
|
||||||
|
return tc->state64.srr0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackDylibPPC32 : public PackMachPPC32
|
class PackDylibPPC32 : public PackMachPPC32
|
||||||
@@ -655,12 +1019,26 @@ public:
|
|||||||
PackDylibPPC32(InputFile *f);
|
PackDylibPPC32(InputFile *f);
|
||||||
|
|
||||||
virtual int getFormat() const { return UPX_F_DYLIB_PPC32; }
|
virtual int getFormat() const { return UPX_F_DYLIB_PPC32; }
|
||||||
virtual const char *getName() const { return "Dylib/ppc32"; }
|
virtual const char *getName() const { return "dylib/ppc32"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "powerpc-darwin.dylib"; }
|
virtual const char *getFullName(const options_t *) const { return "powerpc-darwin.dylib"; }
|
||||||
protected:
|
protected:
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
||||||
virtual void buildLoader(const Filter *ft);
|
};
|
||||||
|
|
||||||
|
class PackDylibPPC64LE : public PackMachPPC64LE
|
||||||
|
{
|
||||||
|
typedef PackMachPPC64LE super;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PackDylibPPC64LE(InputFile *f);
|
||||||
|
|
||||||
|
virtual int getFormat() const { return UPX_F_DYLIB_PPC64LE; }
|
||||||
|
virtual const char *getName() const { return "dylib/ppc64le"; }
|
||||||
|
virtual const char *getFullName(const options_t *) const { return "powerpc64le-darwin.dylib"; }
|
||||||
|
protected:
|
||||||
|
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
|
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackMachI386 : public PackMachBase<MachClass_LE32>
|
class PackMachI386 : public PackMachBase<MachClass_LE32>
|
||||||
@@ -671,16 +1049,13 @@ public:
|
|||||||
PackMachI386(InputFile *f);
|
PackMachI386(InputFile *f);
|
||||||
|
|
||||||
virtual int getFormat() const { return UPX_F_MACH_i386; }
|
virtual int getFormat() const { return UPX_F_MACH_i386; }
|
||||||
virtual const char *getName() const { return "Mach/i386"; }
|
virtual const char *getName() const { return "macho/i386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-darwin.macho"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-darwin.macho"; }
|
||||||
protected:
|
protected:
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack1_setup_threado(OutputFile *const fo);
|
virtual void pack1_setup_threado(OutputFile *const fo);
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
|
||||||
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
virtual void buildLoader(const Filter *ft);
|
|
||||||
virtual void addStubEntrySections(Filter const *);
|
virtual void addStubEntrySections(Filter const *);
|
||||||
|
|
||||||
__packed_struct(Mach_thread_command)
|
__packed_struct(Mach_thread_command)
|
||||||
@@ -694,6 +1069,28 @@ protected:
|
|||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
Mach_thread_command threado;
|
Mach_thread_command threado;
|
||||||
|
int threado_size() const { return sizeof(threado); }
|
||||||
|
void threado_setPC(upx_uint64_t pc) {
|
||||||
|
memset(&threado, 0, sizeof(threado));
|
||||||
|
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
|
||||||
|
threado.cmdsize = sizeof(threado);
|
||||||
|
threado.flavor = my_thread_flavor;
|
||||||
|
threado.count = my_thread_state_word_count;
|
||||||
|
threado.state.eip = pc;
|
||||||
|
}
|
||||||
|
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
|
||||||
|
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
|
||||||
|
|
||||||
|
upx_uint64_t threadc_getPC(void const *ptr) {
|
||||||
|
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
|
||||||
|
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|
||||||
|
|| tc->cmdsize!=sizeof(threado)
|
||||||
|
|| tc->flavor!=my_thread_flavor
|
||||||
|
|| tc->count!=my_thread_state_word_count) {
|
||||||
|
return ~0ull;
|
||||||
|
}
|
||||||
|
return tc->state.eip;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackDylibI386 : public PackMachI386
|
class PackDylibI386 : public PackMachI386
|
||||||
@@ -704,12 +1101,11 @@ public:
|
|||||||
PackDylibI386(InputFile *f);
|
PackDylibI386(InputFile *f);
|
||||||
|
|
||||||
virtual int getFormat() const { return UPX_F_DYLIB_i386; }
|
virtual int getFormat() const { return UPX_F_DYLIB_i386; }
|
||||||
virtual const char *getName() const { return "Dylib/i386"; }
|
virtual const char *getName() const { return "dylib/i386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-darwin.dylib"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-darwin.dylib"; }
|
||||||
protected:
|
protected:
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
||||||
virtual void buildLoader(const Filter *ft);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackMachAMD64 : public PackMachBase<MachClass_LE64>
|
class PackMachAMD64 : public PackMachBase<MachClass_LE64>
|
||||||
@@ -720,29 +1116,49 @@ public:
|
|||||||
PackMachAMD64(InputFile *f);
|
PackMachAMD64(InputFile *f);
|
||||||
|
|
||||||
virtual int getFormat() const { return UPX_F_MACH_AMD64; }
|
virtual int getFormat() const { return UPX_F_MACH_AMD64; }
|
||||||
virtual const char *getName() const { return "Mach/AMD64"; }
|
virtual const char *getName() const { return "macho/amd64"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "AMD64-darwin.macho"; }
|
virtual const char *getFullName(const options_t *) const { return "amd64-darwin.macho"; }
|
||||||
protected:
|
protected:
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack1_setup_threado(OutputFile *const fo);
|
virtual void pack1_setup_threado(OutputFile *const fo);
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
|
||||||
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
virtual void buildLoader(const Filter *ft);
|
|
||||||
virtual void addStubEntrySections(Filter const *);
|
virtual void addStubEntrySections(Filter const *);
|
||||||
|
|
||||||
__packed_struct(Mach_thread_command)
|
__packed_struct(Mach_thread_command)
|
||||||
LE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
|
typedef MachITypes::Word Word;
|
||||||
LE32 cmdsize; /* total size of this command */
|
Word cmd; /* LC_THREAD or LC_UNIXTHREAD */
|
||||||
LE32 flavor;
|
Word cmdsize; /* total size of this command */
|
||||||
LE32 count; /* sizeof(following_thread_state)/4 */
|
Word flavor;
|
||||||
|
Word count; /* sizeof(following_thread_state)/4 */
|
||||||
Mach_AMD64_thread_state state;
|
Mach_AMD64_thread_state state;
|
||||||
#define WANT_MACH_THREAD_ENUM 1
|
#define WANT_MACH_THREAD_ENUM 1
|
||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
Mach_thread_command threado;
|
Mach_thread_command threado;
|
||||||
|
int threado_size() const { return sizeof(threado); }
|
||||||
|
void threado_setPC(upx_uint64_t pc) {
|
||||||
|
memset(&threado, 0, sizeof(threado));
|
||||||
|
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
|
||||||
|
threado.cmdsize = sizeof(threado);
|
||||||
|
threado.flavor = my_thread_flavor;
|
||||||
|
threado.count = my_thread_state_word_count;
|
||||||
|
threado.state.rip = pc;
|
||||||
|
}
|
||||||
|
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
|
||||||
|
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
|
||||||
|
|
||||||
|
upx_uint64_t threadc_getPC(void const *ptr) {
|
||||||
|
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
|
||||||
|
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|
||||||
|
|| tc->cmdsize!=sizeof(threado)
|
||||||
|
|| tc->flavor!=my_thread_flavor
|
||||||
|
|| tc->count!=my_thread_state_word_count) {
|
||||||
|
return ~0ull;
|
||||||
|
}
|
||||||
|
return tc->state.rip;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackDylibAMD64 : public PackMachAMD64
|
class PackDylibAMD64 : public PackMachAMD64
|
||||||
@@ -753,12 +1169,11 @@ public:
|
|||||||
PackDylibAMD64(InputFile *f);
|
PackDylibAMD64(InputFile *f);
|
||||||
|
|
||||||
virtual int getFormat() const { return UPX_F_DYLIB_AMD64; }
|
virtual int getFormat() const { return UPX_F_DYLIB_AMD64; }
|
||||||
virtual const char *getName() const { return "Dylib/AMD64"; }
|
virtual const char *getName() const { return "dylib/amd64"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "AMD64-darwin.dylib"; }
|
virtual const char *getFullName(const options_t *) const { return "amd64-darwin.dylib"; }
|
||||||
protected:
|
protected:
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
||||||
virtual void buildLoader(const Filter *ft);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackMachARMEL : public PackMachBase<MachClass_LE32>
|
class PackMachARMEL : public PackMachBase<MachClass_LE32>
|
||||||
@@ -769,17 +1184,14 @@ public:
|
|||||||
PackMachARMEL(InputFile *f);
|
PackMachARMEL(InputFile *f);
|
||||||
|
|
||||||
virtual int getFormat() const { return UPX_F_MACH_ARMEL; }
|
virtual int getFormat() const { return UPX_F_MACH_ARMEL; }
|
||||||
virtual const char *getName() const { return "Mach/ARMEL"; }
|
virtual const char *getName() const { return "macho/arm"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "ARMEL-darwin.macho"; }
|
virtual const char *getFullName(const options_t *) const { return "arm-darwin.macho"; }
|
||||||
protected:
|
protected:
|
||||||
virtual const int *getCompressionMethods(int method, int level) const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack1_setup_threado(OutputFile *const fo);
|
virtual void pack1_setup_threado(OutputFile *const fo);
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
|
||||||
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
virtual void buildLoader(const Filter *ft);
|
|
||||||
virtual void addStubEntrySections(Filter const *);
|
virtual void addStubEntrySections(Filter const *);
|
||||||
|
|
||||||
__packed_struct(Mach_thread_command)
|
__packed_struct(Mach_thread_command)
|
||||||
@@ -793,6 +1205,81 @@ protected:
|
|||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
Mach_thread_command threado;
|
Mach_thread_command threado;
|
||||||
|
int threado_size() const { return sizeof(threado); }
|
||||||
|
void threado_setPC(upx_uint64_t pc) {
|
||||||
|
memset(&threado, 0, sizeof(threado));
|
||||||
|
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
|
||||||
|
threado.cmdsize = sizeof(threado);
|
||||||
|
threado.flavor = my_thread_flavor;
|
||||||
|
threado.count = my_thread_state_word_count;
|
||||||
|
threado.state.pc = pc;
|
||||||
|
}
|
||||||
|
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
|
||||||
|
void threado_write(OutputFile *fo) { return fo->write(&threado, sizeof(threado)); }
|
||||||
|
|
||||||
|
upx_uint64_t threadc_getPC(void const *ptr) {
|
||||||
|
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
|
||||||
|
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|
||||||
|
|| tc->cmdsize!=sizeof(threado)
|
||||||
|
|| tc->flavor!=my_thread_flavor
|
||||||
|
|| tc->count!=my_thread_state_word_count) {
|
||||||
|
return ~0ull;
|
||||||
|
}
|
||||||
|
return tc->state.pc;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class PackMachARM64EL : public PackMachBase<MachClass_LE64>
|
||||||
|
{
|
||||||
|
typedef PackMachBase<MachClass_LE64> super;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PackMachARM64EL(InputFile *f);
|
||||||
|
|
||||||
|
virtual int getFormat() const { return UPX_F_MACH_ARM64EL; }
|
||||||
|
virtual const char *getName() const { return "macho/arm64"; }
|
||||||
|
virtual const char *getFullName(const options_t *) const { return "arm64-darwin.macho"; }
|
||||||
|
protected:
|
||||||
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
|
virtual void pack1_setup_threado(OutputFile *const fo);
|
||||||
|
virtual Linker* newLinker() const;
|
||||||
|
virtual void addStubEntrySections(Filter const *);
|
||||||
|
|
||||||
|
__packed_struct(Mach_thread_command)
|
||||||
|
LE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */
|
||||||
|
LE32 cmdsize; /* total size of this command */
|
||||||
|
LE32 flavor;
|
||||||
|
LE32 count; /* sizeof(following_thread_state)/4 */
|
||||||
|
Mach_ARM64_thread_state state;
|
||||||
|
#define WANT_MACH_THREAD_ENUM 1
|
||||||
|
#include "p_mach_enum.h"
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
Mach_thread_command threado;
|
||||||
|
int threado_size() const { return sizeof(threado); }
|
||||||
|
void threado_setPC(upx_uint64_t pc) {
|
||||||
|
memset(&threado, 0, sizeof(threado));
|
||||||
|
threado.cmd = Mach_segment_command::LC_UNIXTHREAD;
|
||||||
|
threado.cmdsize = sizeof(threado);
|
||||||
|
threado.flavor = my_thread_flavor;
|
||||||
|
threado.count = my_thread_state_word_count;
|
||||||
|
threado.state.pc = pc;
|
||||||
|
}
|
||||||
|
void threado_rewrite(OutputFile *fo) { fo->rewrite(&threado, sizeof(threado)); }
|
||||||
|
void threado_write(OutputFile *fo) { fo->write(&threado, sizeof(threado)); }
|
||||||
|
|
||||||
|
upx_uint64_t threadc_getPC(void const *ptr) {
|
||||||
|
Mach_thread_command const *tc = (Mach_thread_command const *)ptr;
|
||||||
|
if (tc->cmd!=Mach_segment_command::LC_UNIXTHREAD
|
||||||
|
|| tc->cmdsize!=sizeof(threado)
|
||||||
|
|| tc->flavor!=my_thread_flavor
|
||||||
|
|| tc->count!=my_thread_state_word_count) {
|
||||||
|
return ~0ull;
|
||||||
|
}
|
||||||
|
return tc->state.pc;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackMachFat : public Packer
|
class PackMachFat : public Packer
|
||||||
@@ -804,13 +1291,14 @@ public:
|
|||||||
|
|
||||||
virtual int getVersion() const { return 13; }
|
virtual int getVersion() const { return 13; }
|
||||||
virtual int getFormat() const { return UPX_F_MACH_FAT; }
|
virtual int getFormat() const { return UPX_F_MACH_FAT; }
|
||||||
virtual const char *getName() const { return "Mach/fat"; }
|
virtual const char *getName() const { return "macho/fat"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "fat-darwin.macho"; }
|
virtual const char *getFullName(const options_t *) const { return "fat-darwin.macho"; }
|
||||||
virtual const int *getCompressionMethods(int method, int level) const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// implementation
|
// implementation
|
||||||
|
virtual unsigned check_fat_head(); // number of architectures
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
virtual void unpack(OutputFile *fo);
|
virtual void unpack(OutputFile *fo);
|
||||||
virtual void list();
|
virtual void list();
|
||||||
@@ -824,9 +1312,6 @@ protected:
|
|||||||
virtual void buildLoader(const Filter *ft);
|
virtual void buildLoader(const Filter *ft);
|
||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
|
|
||||||
#if (ACC_CC_BORLANDC)
|
|
||||||
public:
|
|
||||||
#endif
|
|
||||||
enum { N_FAT_ARCH = 5 };
|
enum { N_FAT_ARCH = 5 };
|
||||||
protected:
|
protected:
|
||||||
__packed_struct(Fat_head)
|
__packed_struct(Fat_head)
|
||||||
@@ -847,8 +1332,4 @@ protected:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+27
-13
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 2007-2010 John F. Reiser
|
Copyright (C) 2007-2017 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -35,15 +35,20 @@
|
|||||||
|
|
||||||
#ifdef WANT_MACH_HEADER_ENUM /*{*/
|
#ifdef WANT_MACH_HEADER_ENUM /*{*/
|
||||||
#undef WANT_MACH_HEADER_ENUM
|
#undef WANT_MACH_HEADER_ENUM
|
||||||
|
# if 0
|
||||||
enum { // magic
|
enum { // magic
|
||||||
MH_MAGIC = 0xfeedface
|
MH_MAGIC = 0xfeedface
|
||||||
};
|
};
|
||||||
|
# else
|
||||||
|
static const unsigned MH_MAGIC = 0xfeedface;
|
||||||
|
# endif
|
||||||
enum { // cputype
|
enum { // cputype
|
||||||
CPU_TYPE_I386 = 7,
|
CPU_TYPE_I386 = 7,
|
||||||
CPU_TYPE_X86_64 = 0x01000007,
|
CPU_TYPE_X86_64 = 0x01000007,
|
||||||
CPU_TYPE_ARM = 12,
|
CPU_TYPE_ARM = 12,
|
||||||
CPU_TYPE_POWERPC = 0x00000012,
|
CPU_TYPE_POWERPC = 0x00000012,
|
||||||
CPU_TYPE_POWERPC64 = 0x01000012
|
CPU_TYPE_POWERPC64 = 0x01000012,
|
||||||
|
CPU_TYPE_POWERPC64LE = 0x01000021
|
||||||
};
|
};
|
||||||
enum { // cpusubtype
|
enum { // cpusubtype
|
||||||
CPU_SUBTYPE_ARM_ALL = 0,
|
CPU_SUBTYPE_ARM_ALL = 0,
|
||||||
@@ -52,16 +57,22 @@
|
|||||||
};
|
};
|
||||||
enum { // filetype
|
enum { // filetype
|
||||||
MH_EXECUTE = 2,
|
MH_EXECUTE = 2,
|
||||||
MH_DYLIB = 6
|
MH_DYLIB = 6,
|
||||||
|
MH_BUNDLE = 8 /* dynamically bound bundle file */
|
||||||
};
|
};
|
||||||
enum { // flags
|
enum { // flags
|
||||||
MH_NOUNDEFS = 1
|
MH_NOUNDEFS = 1,
|
||||||
|
MH_DYLDLINK = 4, /* code signing demands this */
|
||||||
|
MH_BINDATLOAD = 0x8, // DT_BIND_NOW
|
||||||
|
MH_TWOLEVEL = 0x80,
|
||||||
|
MH_PIE = 0x200000 // ASLR
|
||||||
};
|
};
|
||||||
#endif /*}*/
|
#endif /*}*/
|
||||||
|
|
||||||
#ifdef WANT_MACH_SEGMENT_ENUM /*{*/
|
#ifdef WANT_MACH_SEGMENT_ENUM /*{*/
|
||||||
#undef WANT_MACH_SEGMENT_ENUM
|
#undef WANT_MACH_SEGMENT_ENUM
|
||||||
enum { // cmd
|
enum { // cmd
|
||||||
|
LC_REQ_DYLD = 0x80000000, // OR'ed ==> must not ignore
|
||||||
LC_SEGMENT = 0x1,
|
LC_SEGMENT = 0x1,
|
||||||
LC_SYMTAB = 0x2,
|
LC_SYMTAB = 0x2,
|
||||||
LC_THREAD = 0x4,
|
LC_THREAD = 0x4,
|
||||||
@@ -79,10 +90,15 @@
|
|||||||
LC_CODE_SIGNATURE = 0x1d,
|
LC_CODE_SIGNATURE = 0x1d,
|
||||||
LC_SEGMENT_SPLIT_INFO = 0x1e,
|
LC_SEGMENT_SPLIT_INFO = 0x1e,
|
||||||
LC_REEXPORT_DYLIB = 0x1f,
|
LC_REEXPORT_DYLIB = 0x1f,
|
||||||
LC_LAZY_LOAD_DYLIB= 0X20,
|
LC_LAZY_LOAD_DYLIB= 0x20,
|
||||||
LC_ENCRYPTION_INFO= 0X21,
|
LC_ENCRYPTION_INFO= 0x21,
|
||||||
LC_DYLD_INFO = 0X22, // compressed dyld information (10.6.x)
|
LC_DYLD_INFO = 0x22, // compressed dyld information (10.6.x)
|
||||||
LC_REQ_DYLD = 0x80000000 // OR'ed ==> must not ignore
|
LC_DYLD_INFO_ONLY = (0x22|LC_REQ_DYLD),
|
||||||
|
LC_VERSION_MIN_MACOSX= 0x24,
|
||||||
|
LC_FUNCTION_STARTS= 0x26,
|
||||||
|
LC_MAIN = (0x28|LC_REQ_DYLD),
|
||||||
|
LC_DATA_IN_CODE = 0x29,
|
||||||
|
LC_SOURCE_VERSION = 0x2a,
|
||||||
};
|
};
|
||||||
enum { // maxprot
|
enum { // maxprot
|
||||||
VM_PROT_READ = 1,
|
VM_PROT_READ = 1,
|
||||||
@@ -111,8 +127,9 @@
|
|||||||
S_16BYTE_LITERALS,
|
S_16BYTE_LITERALS,
|
||||||
S_DTRACE_DOF
|
S_DTRACE_DOF
|
||||||
};
|
};
|
||||||
|
static const unsigned S_ATTR_PURE_INSTRUCTIONS = 0x80000000;
|
||||||
enum { // section flags (high 24 bits)
|
enum { // section flags (high 24 bits)
|
||||||
S_ATTR_PURE_INSTRUCTIONS = 0x80000000,
|
//S_ATTR_PURE_INSTRUCTIONS = 0x80000000,
|
||||||
S_ATTR_NO_TOC = 0x40000000,
|
S_ATTR_NO_TOC = 0x40000000,
|
||||||
S_ATTR_STRIP_STATIC_SYMS = 0x20000000,
|
S_ATTR_STRIP_STATIC_SYMS = 0x20000000,
|
||||||
S_ATTR_NO_DEAD_STRIP = 0x10000000,
|
S_ATTR_NO_DEAD_STRIP = 0x10000000,
|
||||||
@@ -137,7 +154,4 @@
|
|||||||
};
|
};
|
||||||
#endif /*}*/
|
#endif /*}*/
|
||||||
|
|
||||||
/*
|
/* vim:set ts=4 sw=4 et: */
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+12
-15
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2002-2010 Jens Medoch
|
Copyright (C) 2002-2017 Jens Medoch
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
Jens Medoch
|
Jens Medoch
|
||||||
<jssg@users.sourceforge.net>
|
<jssg@users.sourceforge.net>
|
||||||
@@ -418,7 +418,7 @@ void PackPs1::buildLoader(const Filter *)
|
|||||||
bool PackPs1::findBssSection()
|
bool PackPs1::findBssSection()
|
||||||
{
|
{
|
||||||
unsigned char reg;
|
unsigned char reg;
|
||||||
LE32 *p1 = (LE32 *)(ibuf + (ih.epc - ih.tx_ptr));
|
const LE32 * const p1 = ACC_CCAST(const LE32 *, ibuf + (ih.epc - ih.tx_ptr));
|
||||||
|
|
||||||
if ((ih.epc - ih.tx_ptr + (BSS_CHK_LIMIT * 4)) > fdata_size)
|
if ((ih.epc - ih.tx_ptr + (BSS_CHK_LIMIT * 4)) > fdata_size)
|
||||||
return false;
|
return false;
|
||||||
@@ -426,15 +426,15 @@ bool PackPs1::findBssSection()
|
|||||||
// check 18 opcodes for sw zero,0(x)
|
// check 18 opcodes for sw zero,0(x)
|
||||||
for (signed i = BSS_CHK_LIMIT; i >= 0; i--)
|
for (signed i = BSS_CHK_LIMIT; i >= 0; i--)
|
||||||
{
|
{
|
||||||
unsigned short op = p1[i] >> 16;
|
upx_uint16_t op = p1[i] >> 16;
|
||||||
if (IS_SW_ZERO(op))
|
if (IS_SW_ZERO(op))
|
||||||
{
|
{
|
||||||
// found! get reg (x) for bss_start
|
// found! get reg (x) for bss_start
|
||||||
reg = REG1(op);
|
reg = REG1(op);
|
||||||
for (; i >= 0; i--)
|
for (; i >= 0; i--)
|
||||||
{
|
{
|
||||||
bss_nfo *p = (bss_nfo *)(void *)&p1[i];
|
const bss_nfo * const p = ACC_CCAST(const bss_nfo *, &p1[i]);
|
||||||
unsigned short op1 = p->op1, op2 = p->op2;
|
upx_uint16_t op1 = p->op1, op2 = p->op2;
|
||||||
|
|
||||||
// check for la (x),bss_start
|
// check for la (x),bss_start
|
||||||
if ((IS_LUI(op1) && REG2(op1) == reg) &&
|
if ((IS_LUI(op1) && REG2(op1) == reg) &&
|
||||||
@@ -547,7 +547,7 @@ void PackPs1::pack(OutputFile *fo)
|
|||||||
|
|
||||||
const int lsize = getLoaderSize();
|
const int lsize = getLoaderSize();
|
||||||
|
|
||||||
unsigned filelen = ALIGN_UP(ih.tx_len, 4);
|
unsigned filelen = ALIGN_UP(ih.tx_len, 4u);
|
||||||
|
|
||||||
const unsigned decomp_data_start = ih.tx_ptr;
|
const unsigned decomp_data_start = ih.tx_ptr;
|
||||||
const unsigned comp_data_start = (decomp_data_start + filelen + overlap) - ph.c_len;
|
const unsigned comp_data_start = (decomp_data_start + filelen + overlap) - ph.c_len;
|
||||||
@@ -594,7 +594,7 @@ void PackPs1::pack(OutputFile *fo)
|
|||||||
if (!opt->ps1_exe.no_align || !isCon)
|
if (!opt->ps1_exe.no_align || !isCon)
|
||||||
{
|
{
|
||||||
pad = oh.tx_len;
|
pad = oh.tx_len;
|
||||||
oh.tx_len = ALIGN_UP(oh.tx_len, CD_SEC);
|
oh.tx_len = ALIGN_UP(oh.tx_len, CD_SEC+0u);
|
||||||
pad = oh.tx_len - pad;
|
pad = oh.tx_len - pad;
|
||||||
oh.tx_ptr -= pad;
|
oh.tx_ptr -= pad;
|
||||||
}
|
}
|
||||||
@@ -709,7 +709,7 @@ void PackPs1::unpack(OutputFile *fo)
|
|||||||
{
|
{
|
||||||
// restore orig exec hdr
|
// restore orig exec hdr
|
||||||
memcpy(&oh, &ih, sizeof(ih));
|
memcpy(&oh, &ih, sizeof(ih));
|
||||||
memcpy(&oh.epc, &bh, SZ_IH_BKUP);
|
memcpy((void *) &oh.epc, &bh, SZ_IH_BKUP);
|
||||||
|
|
||||||
// check for removed sector alignment
|
// check for removed sector alignment
|
||||||
assert(oh.tx_len >= ph.u_len);
|
assert(oh.tx_len >= ph.u_len);
|
||||||
@@ -738,7 +738,4 @@ void PackPs1::unpack(OutputFile *fo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|||||||
+5
-8
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
Copyright (C) 2002-2010 Jens Medoch
|
Copyright (C) 2002-2017 Jens Medoch
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
Jens Medoch
|
Jens Medoch
|
||||||
<jssg@users.sourceforge.net>
|
<jssg@users.sourceforge.net>
|
||||||
@@ -130,7 +130,4 @@ protected:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2017 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -125,8 +125,4 @@ void PackSys::buildLoader(const Filter *ft)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user