Closed zcfh closed 3 months ago
I also got the same error when I ran LlvmPropellerProfileWriterTest
. Is it a problem with my build environment or is it due to other reasons?
According to the comment information, I adjusted
if (r == kBuildIdNoteName) {
// Or use shdr.sh_addralign instead of 0?
- llvm::ArrayRef<uint8_t> build_id = note.getDesc(/*Align=*/0);
+ llvm::ArrayRef<uint8_t> build_id = note.getDesc(/*Align=*/shdr.sh_addralign);
std::string build_id_str(build_id.size() * 2, '0');
int k = 0;
template <class ELFT>
struct Elf_Nhdr_Impl {
LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
Elf_Word n_namesz;
Elf_Word n_descsz;
...
If Align = 0
, getDesc will use the offset of n_namesz
, this seems to be a bug?
But a new error occurred.
#0 0x00007f9031e48387 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007f9031e48387 in raise () from /lib64/libc.so.6
#1 0x00007f9031e49a78 in abort () from /lib64/libc.so.6
#2 0x00007f9031e411a6 in __assert_fail_base () from /lib64/libc.so.6
#3 0x00007f9031e41252 in __assert_fail () from /lib64/libc.so.6
#4 0x000000000046db9c in llvm::object::BBAddrMap::getFunctionAddress (this=0x7f9028002a10)
at autofdo/third_party/llvm-project/llvm/include/llvm/Object/ELFTypes.h:924
#5 0x00000000004f052a in devtools_crosstool_autofdo::PropellerWholeProgramInfo::DropNonSelectedFunctions (this=0x29f9270, selected_functions=...)
at autofdo/llvm_propeller_whole_program_info.cc:584
#6 0x00000000004f1349 in devtools_crosstool_autofdo::PropellerWholeProgramInfo::SelectFunctions (this=0x29f9270,
cfg_creation_mode=devtools_crosstool_autofdo::CfgCreationMode::kOnlyHotFunctions, lbr_aggregation=0x7fff41e6a808)
at autofdo/llvm_propeller_whole_program_info.cc:689
#7 0x00000000004f1a57 in devtools_crosstool_autofdo::PropellerWholeProgramInfo::CreateCfgs (this=0x29f9270,
cfg_creation_mode=devtools_crosstool_autofdo::CfgCreationMode::kOnlyHotFunctions)
at autofdo/llvm_propeller_whole_program_info.cc:748
#8 0x00000000004dae4c in devtools_crosstool_autofdo::PropellerProfWriter::Create (options=..., perf_data_provider=..., frontend_status=0x29f1440)
at autofdo/llvm_propeller_profile_writer.cc:158
#9 0x00000000004da8f4 in devtools_crosstool_autofdo::GeneratePropellerProfiles (opts=..., perf_data_provider=...)
at autofdo/llvm_propeller_profile_writer.cc:121
#10 0x00000000004da56b in devtools_crosstool_autofdo::GeneratePropellerProfiles (opts=...)
at autofdo/llvm_propeller_profile_writer.cc:92
#11 0x0000000000440b09 in main (argc=8, argv=0x7fff41e6c2f8) at autofdo/create_llvm_prof.cc:197
llvm_propeller_whole_program_info.cc
void PropellerWholeProgramInfo::DropNonSelectedFunctions(
const absl::btree_set<int> &selected_functions) {
for (int i = 0; i != bb_addr_map_.size(); ++i) {
if (selected_functions.contains(i))
continue;
bb_addr_map_[i].BBRanges.clear();
bb_addr_map_[i].BBRanges.shrink_to_fit();
if (!options_.keep_frontend_intermediate_data())
symtab_.erase(bb_addr_map_[i].getFunctionAddress());
}
}
In the new llvm api, getFunctionAddress
core dumps due to bb_addr_map_[i].BBRanges.clear();
.
The address should be saved before call BBRanges.clear()
;
uint64_t getFunctionAddress() const {
assert(!BBRanges.empty());
Return BBRanges.front().BaseAddress;
}
Fixed buildid and getFunctionAddress problems (so we can drop the --profiled_binary_name flag) with https://github.com/google/autofdo/pull/192 . And as to the performance, we are running experiments to see whether this regress the origin results. Will report back shortly.
create_llvm_prof can not found build id, but use format=text can work well
error log
I use readelf -n , will report same build id as perf.data.
I try --profiled_binary_name will appear
Segmentation fault
.and I try debug mode create_llvm_prof, it core in assert