[PATCH] D63432: [ELF] Allow placing SHF_MERGE sections with different alignments into the same MergeSyntheticSection

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 4 03:38:25 PDT 2019


MaskRay added a comment.

In D63432#1570136 <https://reviews.llvm.org/D63432#1570136>, @peter.smith wrote:

> FWIW: The buildbot http://lab.llvm.org:8011/builders/clang-lld-x86_64-2stage/builds/8556/steps/test-stage2-check-all/logs/stdio build did eventually fail with the same errors. I am able to reproduce locally with:
>
> - Build clang, lld, compiler-rt with this change. Strictly speaking it might be enough to build just LLD, but by doing clang as well it makes stage 2 easier. I used
> - Install (probably not necessary, as this can probably be done out of the build directory)
> - Make new build directory
> - Do ninja check-llvm
>
>   See resulting unit test failures. There will probably be more if you do check-clang, but building just llvm is quicker.
>
>   The options I used (probably not all necessary, and you'll need to alter the local paths). For stage 2 chang -DCMAKE_C_COMPILER to the installed clang or build directory from stage 1. ``` cmake -GNinja ../../llvm \ -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \ -DCMAKE_C_COMPILER=/work/clang8.0.0/bin/clang\ -DCMAKE_CXX_COMPILER=/work/clang8.0.0/bin/clang++\ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_ASSERTIONS=True \ -DCMAKE_INSTALL_PREFIX=/work/clangmaster \ -DCMAKE_CXX_FLAGS="-Wall" \ -DLLVM_BUILD_TESTS=True \ -DCMAKE_EXPORT_COMPILE_COMMANDS=True\ -DLLVM_CCACHE_BUILD=True \ -DLLVM_ENABLE_LLD=True\ -DLLVM_BINUTILS_INCDIR=/work/gnu/binutils-gdb/include ```
>
>   I think it would be sufficient to just do a ninja check-llvm with LLD as the linker being used by clang.
>
>   I've not tried to work out what is causing the problem. The full errors look like:
>
>   ```
>   - TEST 'LLVM-Unit :: tools/llvm-exegesis/X86/./LLVMExegesisX86Tests/Core2TargetTest.SetRegToVR128Value_Use_MOVDQUrm' FAILED ******************** Note: Google Test filter = Core2TargetTest.SetRegToVR128Value_Use_MOVDQUrm [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from Core2TargetTest [ RUN      ] Core2TargetTest.SetRegToVR128Value_Use_MOVDQUrm #0 0x0000000000abed74 PrintStackTraceSignalHandler(void*) (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0xabed74) #1 0x0000000000abcadc llvm::sys::RunSignalHandlers() (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0xabcadc) #2 0x0000000000abf2b8 SignalHandler(int) (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0xabf2b8) #3 0x00007fcbdf5fb390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390) #4 0x00000000009e5006 llvm::exegesis::(anonymous namespace)::X86TargetTest::X86TargetTest(char const*) (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0x9e5006) #5 0x00000000009f3d4d testing::internal::TestFactoryImpl<llvm::exegesis::(anonymous namespace)::Core2TargetTest_SetRegToVR128Value_Use_MOVDQUrm_Test>::CreateTest() (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0x9f3d4d) #6 0x0000000000d2e9ab testing::TestInfo::Run() (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0xd2e9ab) #7 0x0000000000d2f1c7 testing::TestCase::Run() (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0xd2f1c7) #8 0x0000000000d37087 testing::internal::UnitTestImpl::RunAllTests() (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0xd37087) #9 0x0000000000d36bc7 testing::UnitTest::Run() (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0xd36bc7) #10 0x0000000000d2663b main (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0xd2663b) #11 0x00007fcbde0ed830 __libc_start_main /build/glibc-LK5gWL/glibc-2.23/csu/../csu/libc-start.c:325:0 #12 0x00000000009a6029 _start (/work/llvm-project/build/buildstage2/unittests/tools/llvm-exegesis/X86/./LLVMExegesisX86Tests+0x9a6029)
>
>     ******************** Testing Time: 96.27s ******************** ```


Thank you for investigating the issue! I've also been studying this for a while and get a simpler reproduce:

  LLVM_COMMON1=(-GNinja -DCMAKE_CXX_COMPILER=$HOME/llvm/Release/bin/clang++ -DCMAKE_C_COMPILER=$HOME/llvm/Release/bin/clang -DLLVM_ENABLE_LLD=On -DLLVM_INCLUDE_GO_TESTS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_APPEND_VC_REV=OFF -DLLVM_TARGETS_TO_BUILD=X86)
  cmake -GNinja -H. -BS2Release -DCMAKE_BUILD_TYPE=Release ${LLVM_COMMON1}
  ninja -C ~/llvm/S2Release SupportTests
  ~/llvm/S2Release/unittests/Support/SupportTests #  SIGSEGV due to unaligned MOVAPS

A `SHF_STRINGS|SHF_MERGE` section is misaligned (`address%16!=0`) after the -O3 (tail merge is performed) link. I haven't narrowed down to the root cause yet. The proposed fix is at D64200 <https://reviews.llvm.org/D64200>


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63432/new/

https://reviews.llvm.org/D63432





More information about the llvm-commits mailing list