File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
llvm/lib/ExecutionEngine/JITLink Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -505,7 +505,14 @@ template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::graphifySymbols() {
505
505
TargetFlagsType Flags = makeTargetFlags (Sym);
506
506
orc::ExecutorAddrDiff Offset = getRawOffset (Sym, Flags);
507
507
508
- if (Offset + Sym.st_size > B->getSize ()) {
508
+ // Truncate symbol if it would overflow -- ELF size fields can't be
509
+ // trusted.
510
+ // FIXME: this makes the following error check unreachable, but it's
511
+ // left here to reduce merge conflicts.
512
+ uint64_t Size =
513
+ std::min (static_cast <uint64_t >(Sym.st_size ), B->getSize () - Offset);
514
+
515
+ if (Offset + Size > B->getSize ()) {
509
516
std::string ErrMsg;
510
517
raw_string_ostream ErrStream (ErrMsg);
511
518
ErrStream << " In " << G->getName () << " , symbol " ;
@@ -521,11 +528,6 @@ template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::graphifySymbols() {
521
528
return make_error<JITLinkError>(std::move (ErrMsg));
522
529
}
523
530
524
- // Truncate symbol if it would overflow -- ELF size fields can't be
525
- // trusted.
526
- uint64_t Size =
527
- std::min (static_cast <uint64_t >(Sym.st_size ), B->getSize () - Offset);
528
-
529
531
// In RISCV, temporary symbols (Used to generate dwarf, eh_frame
530
532
// sections...) will appear in object code's symbol table, and LLVM does
531
533
// not use names on these temporary symbols (RISCV gnu toolchain uses
You can’t perform that action at this time.
0 commit comments