.init_array gets optimized away when building with -O2 and as a result,
check_cxx_section_exists failed to pass -DCOMPILER_RT_HAS_INITFINI_ARRAY
when building crtbegin.o and crtend.o, which causes binaries linked with
them encounter segmentation fault. See https://crbug.com/855759 for
details. This change prevents .init_array section to be optimized away
even with -O2 or higher optimization level.
Details
Details
- Reviewers
phosek echristo MaskRay joerg - Commits
- rG4e858e4ac00b: Merging r372038:
rG155a43edb0c1: [compiler-rt][crt] make test case nontrivial in check_cxx_section_exists
rCRT372038: [compiler-rt][crt] make test case nontrivial in check_cxx_section_exists
rL372038: [compiler-rt][crt] make test case nontrivial in check_cxx_section_exists
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Could we make the function non-trivial e.g. __attribute__((constructor)) void f() { asm volatile ("nop"::); } to ensure that it's not optimized out even at -O2?