1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00
llvm-mirror/tools/llvm-objcopy
David Blaikie d3ee11b29a llvm-objcopy: fix section size truncation/extension when dumping sections
Since this only comes up with inputs containing sections at least 4GB
large (I guess I could use a bzero section or something, so the input
file doesn't have to be 4GB, but even then the output file would have to
be 4GB, right?) I've skipped testing this. If there's a nice way to test
this without needing 4GB inputs or output files.

The subtlety here is demonstrated by this code:

struct t { operator uint64_t(); };
static_assert(std::is_same_v<int, decltype(std::declval<bool>() ? 0 : std::declval<t>())>);
static_assert(std::is_same_v<uint64_t, decltype(std::declval<bool>() ? 0 : std::declval<uint64_t>())>);

Because of this difference, the original source code was getting an int
type (truncating the actual size) and then extending it again, resulting
in bogus values (I haven't thought through this hard enough to explain
why the resulting value was 0xffff... - sign extension, possible UB, but
in any case it's the wrong answer - in this particular case I was
looking at that resulted in a size so large that we couldn't open a file
large enough to write to and ended up with a rather vague:

error: 'file_name.o': Invalid argument
2021-06-12 19:00:10 -07:00
..
COFF [llvm-objcopy] Refactor CopyConfig structure. 2021-05-20 13:14:51 +03:00
ELF llvm-objcopy: fix section size truncation/extension when dumping sections 2021-06-12 19:00:10 -07:00
MachO [llvm-objcopy][MachO] Do not strip symbols with the flag REFERENCED_DYNAMICALLY set 2021-06-11 16:34:59 -07:00
wasm [llvm-objcopy] Refactor CopyConfig structure. 2021-05-20 13:14:51 +03:00
BitcodeStripOpts.td [llvm-objcopy][MachO] Add llvm-bitcode-strip driver 2020-09-18 18:13:05 -07:00
CMakeLists.txt [llvm-objcopy] Refactor CopyConfig structure. 2021-05-20 13:14:51 +03:00
CommonConfig.h [llvm-objcopy][NFC] Refactor CopyConfig structure - remove lazy options processing. 2021-05-31 14:40:27 +03:00
CommonOpts.td [llvm-objcopy][MachO] Add support for --keep-undefined 2021-03-08 18:57:25 -08:00
ConfigManager.cpp [llvm-objcopy][NFC] Refactor CopyConfig structure - remove lazy options processing. 2021-05-31 14:40:27 +03:00
ConfigManager.h [llvm-objcopy][NFC] Refactor CopyConfig structure - remove lazy options processing. 2021-05-31 14:40:27 +03:00
InstallNameToolOpts.td [llvm-install-name-tool] Add -prepend_rpath option 2020-10-23 15:01:03 -07:00
llvm-objcopy.cpp [llvm-objcopy] Refactor CopyConfig structure. 2021-05-20 13:14:51 +03:00
llvm-objcopy.h [llvm-objcopy] Refactor CopyConfig structure. 2021-05-20 13:14:51 +03:00
MultiFormatConfig.h [llvm-objcopy] Refactor CopyConfig structure. 2021-05-20 13:14:51 +03:00
ObjcopyOpts.td [llvm-objcopy] Delete --build-id-link-{dir,input,output} 2021-02-15 11:17:32 -08:00
StripOpts.td [llvm-objcopy][MachO] Add support for removing Swift symbols 2020-05-26 16:49:56 -07:00