[libcxx-commits] [libcxxabi] [libc++abi] Fix test on Android (PR #74753)

Ryan Prichard via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 12 01:24:55 PST 2023


rprichard wrote:

I think the `UNSUPPORTED` is correct here.

The `RUN: %t.exe` line should be `RUN: %{exec} %t.exe`, but after fixing that, the test will still fail on Android because of the `-no-pie` compile option in `RUN: %{cxx} %{flags} %s %{link_flags} -no-pie -o %t.exe`. The Android dynamic loader rejects non-PIE executables:
```
"./t.tmp.exe": error: Android 5.0 and later only support position-independent executables (-fPIE).
```

I can't make the executable work as a PIE because the address of the landing pad would require a dynamic relocation, which can't be applied because `.gcc_except_table` is read-only. Making the section writable instead is rejected by the assembler:
```
/llvm/libcxxabi/test/native/x86_64/lpstart-zero.pass.sh.s:76:2: error: changed section flags for .gcc_except_table, expected: 0x2
        .section        .gcc_except_table,"aw", at progbits
        ^
```

Also:

```
.Lexception0:
	.byte	3                               # @LPStart Encoding = udata4
  .long 0
	.byte	155                             # @TType Encoding = indirect pcrel sdata4
	.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:
	.byte	11                              # Call site Encoding = udata4
```

`DW_EH_PE_udata4` is 3 but `DW_EH_PE_sdata4` is 11. I think the comment on the call side encoding is wrong -- it should be `sdata4` instead of `udata4`.


https://github.com/llvm/llvm-project/pull/74753


More information about the libcxx-commits mailing list