This can reduce the binary size because counters will no longer occupy
space in the binary, instead they will be allocated by dynamic linker.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I'm looking into https://crbug.com/1180779 where a bunch of profile tests are failing with
Malformed instrumentation profile data error: No profiles could be merged.
This is the only commit that looks related in the regression range.
I also found https://lab.llvm.org/buildbot/#/builders/93/builds/1897 which has similar failures.
Is it possible for this change to cause these failures? Perhaps the host has an old static/dynamic linker that doesn't support something this requires?
Hello,
Power PC is also experiencing the same error,
Malformed instrumentation profile data error: No profiles could be merged.
I built a branch of main with this change reverted and the error goes away. Would it be possible to have this reverted for now until a proper solution has been created? Thanks!
I've managed to reproduce this locally in a Docker container. It's a bug in the older binutils bfd ld, the __start_ and __stop_ have incorrect addresses, it's working correctly in gold and also in newer binutils versions. I'll send a change to conditionally enable this feature with -fbinutils-version=, I'm just trying to identify what version of binutils this was fixed in.
Kazu has seen this error
error: SHT_NOBITS section '__llvm_prf_cnts' cannot have non-zero
initializers
This is with lld.
David
I have bisected this to binutils 2.28 and I have sent D97336 to conditionalize the use of nobits to binutils >=2.28.
I'm also seeing this in a bootstrapped PGO build.
$ ./tools/clang/scripts/build.py --llvm-force-head-revision --without-android --without-fuchsia --pgo --bootstrap
https://source.chromium.org/chromium/chromium/src/+/master:tools/clang/scripts/build.py?q=f:tools%2Fclang%2Fscripts%2Fbuild.py&ss=chromium
It appears using LLD after profile generation in the final optimized Clang build. e.g.
[72/3520] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ELFAttributeParser.cpp.o <unknown>:0: error: SHT_NOBITS section '__llvm_prf_cnts' cannot have non-zero initializers
Sorry, it's actually while building the instrumented compiler, not the final optimized compiler.
I'm still debugging this, but it looks like counters for global constructors (_GLOBAL__sub_I_ symbols) aren't marked as zeroinitializer which looks like a bug to me.
The problem seems to be that Global Value Optimizer may evaluate and eliminate global initializer, and propagate the value to the counter symbol which is no longer zero initialized in that case. This is working as intended. Given that, we may have to change the logic to first ensure that the section content is all zeros before choosing the nobits type. I have reverted this change for now while I work on the implementation.