facebookarchive / BOLT

Binary Optimization and Layout Tool - A linux command-line utility used for optimizing performance of binaries
2.51k stars 176 forks source link

perf2bolt: JumpTableBD->getEndAddress() <= UpperBound ERROR #151

Open zpget opened 3 years ago

zpget commented 3 years ago

BOLT-ERROR:JumpTableBD->getEndAddress() <= UpperBound, address 0x44ac618 type:1 in function protobuf_common_5finfo_2eproto12_GLOBAL__N_126protobuf_AssignDescriptorsEv/1(2)3338perf2bolt: llvm/tools/llvm-bolt/src/BinaryContext.cpp:577: bool llvm::bolt::BinaryContext::analyzeJumpTable(uint64_t, llvm::bolt::JumpTable::JumpTableType, llvm::bolt::BinaryFunction&, uint64_t, llvm::bolt::JumpTable::OffsetsType): Assertion `JumpTableBD->getEndAddress() <= UpperBound && "data object cannot cross a section boundary"' failed.

aaupov commented 3 years ago

Hi, can you please share steps for us to repro the issue? What’s the program you’re running perf2bolt on, the OS, which compiler is used with which options.

zpget commented 3 years ago

Hi, can you please share steps for us to repro the issue? What’s the program you’re running perf2bolt on, the OS, which compiler is used with which options.

self develop program x86_64 GNU/Linux gcc10, options are many : -msse3 -pipe -fPIC -Wextra -Wall -Wno-parentheses -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-deprecated-declarations -pthread -std=c++11 -fno-omit-frame-pointer -Werror=return-local-addr -Werror=return-type -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable

yota9 commented 3 years ago

@zpget Hello. Will the -fno-reorder-blocks-and-partition flag make any difference?

zpget commented 3 years ago

@zpget Hello. Will the -fno-reorder-blocks-and-partition flag make any difference?

add -fno-reorder-blocks-and-partition remian the same core bolt:llvm/tools/llvm-bolt/src/BinaryContext.cpp:577: bool llvm::bolt::BinaryContext::analyzeJumpTable(uint64_t, llvm::bolt::JumpTable::JumpTableType, llvm::bolt::BinaryFunction&, uint64_t, llvm::bolt::JumpTable::OffsetsType*): Assertion `JumpTableBD->getEndAddress() <= UpperBound && "data object cannot cross a section boundary"' failed.

aaupov commented 3 years ago

Thank you for more details! Thank you @yota9 for on-spot suggestion. One thing I've noticed is that you don't have options to preserve relocations in the resulting binary. Can you please add -Wl,--emit-relocs -znow to you compilation flags and verify if the issue persists?