<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/147181>147181</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Android][cross-compile][glang][gdb][BFD:unable to initialize decompress status for section .debug_loclists]
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
xiaoqiang-wang
</td>
</tr>
</table>
<pre>
Hello,
I'm an **Android-Source-Code** and **ARM-GPU-DRIVER-Source-Code** user.
When I try to use default compile tool-chain **clang-18.0.1** (prebuilts/clang/host/linux-x86/clang-r522817/),
**There is something wrong**,
I can NOT use **gdb** to debug the **clang-18.0.1** generated ELF file.
When I update from **clang-18.0.1** to **clang-19.0.1**(prebuilts/clang/host/linux-x86/clang-r536225/bin/clang), the problem still exist.
I sincerely want yours can kindly help me about below **Question_1** and **Question_2**.
===
===
1.Currently, the **GPU-DRIVER-Source-Code** can be compiled and used in the **Android-Source-Code** successfully, and It's output the **malisc_host** ELF file.
2.But when I try to use "**gdb malisc_host**" command to debug, It show below error message.
```
Android_15$ gdb ./malisc_host
BFD: malisc_host: unable to initialize decompress status for section .debug_loclists
malisc_host: not in executable format: file format not recognized
```
3.But the **malisc_host** can be debug by latest l**ldb-21.0.0** tool.
```
lldb ./malisc_host //OK it works
```
4.The the output binary file **malisc_host** can be debug by **lldb**, but can NOT be debug by **gdb**.
4.1. **But the lldb is not a powerful tool, It can NOT stop on my added breakpoints**.
4.2. **So, I strongly want to use the **gdb** to debug the **malisc_host** ELF**.
5. And when I use the **readelf** command, it output below Warning message.
**Warning message .debug_str unsupported compress type: 2**
```
Android_15$ readelf -p .comment out/soong/.intermediates/product/malisc__host/linux_glibc_x86_64/unstripped/malisc_host
readelf: Warning: section '.debug_str' has unsupported compress type: 2
String dump of section '.comment':
[ 0] GCC: (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
[ 2a] GCC: (GNU) 4.8.3
[ 3c] Android (11967740, +pgo, +bolt, +lto, +mlgo, based on r522817) clang version 18.0.1 (https://android.googlesource.com/toolchain/llvm-project d8003a456d14a3deb8054cdaa529ffbf02d9b262)
[ f3] Linker: LLD 18.0.1
```
Above **readelf** command output the warning message:
5.1. I think in the **clang** generated ELF 's file header,
There must be something's **version** or **format** UN-Match with **gdb**'s expectation.
that lead to **gdb** can not correctly recognize the **malisc_host**'s format.
**Questions_1**
===
Q1.1 Does this message mean the **malisc_host**'s file header have be corrupted by **clang**,
or **clang** give a different value to the **malisc_host** ELF's **debug_section**.
Q1.2 How can we fix this error? and make **gdb** can debug the **clang**‘s output ELF **malisc_host**?
Q1.3 Is this error that is an already known problem in **clang-18.0.1**/**clang-19.0.1**?
**Below is my Machine info**
===
1.The system's is Ubuntu 20.0.4
```
Android_15$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
```
2.The **clang/clang++** used to compile **Android-Source-Code** is 18.0.1.
```
Android_15$ ./prebuilts/clang/host/linux-x86/clang-r522817/bin/clang --version
Android (11967740, +pgo, +bolt, +lto, +mlgo, based on r522817) clang version 18.0.1
(https://android.googlesource.com/toolchain/llvm-project d8003a456d14a3deb8054cdaa529ffbf02d9b262)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
3.The **gdb** used to debug is 9.2:
```
Android_15$ gdb --version
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.2) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
```
4.But when I use the default tool-chain **clang-18.0.1**(prebuilts/clang/host/linux-x86/clang-r522817/bin/clang++), compile a simple **hello_world.cpp**,
the output ELF **a.out** can be debug by **gdb** tool.
```
Android_15$ ./prebuilts/clang/host/linux-x86/clang-r522817/bin/clang++ hello_world.cpp -g
Android_15$ gdb -tui -args a.out //OK the gdb work correctly.
```
**Below is my ```file``` command's output for each ELF file.**
===
1. clang's info:
```
Android_15$ file ./prebuilts/clang/host/linux-x86/clang-r522817/bin/clang++
clang++:
ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
statically linked,
Go BuildID=CaRjX2xOY2sn3Eu50jD5/sx0sdGGnrBuwdu7dEfC8/RbpQ82--tce2MQnXDd-h/BpbhCXNCzLlerptoXX1D,
with debug_info,
not stripped
```
2. malisc_host's info
```
Android_15$ file ./malisc_host
./malisc_host:
ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV),
dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2,
for GNU/Linux 2.6.24,
BuildID[xxHash]=300f2d32f4dbacdf,
with debug_info,
not stripped
```
3. a.out's info:
```
Android_15$ file ./a.out
a.out info:
ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV),
dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2,
for GNU/Linux 3.2.0,
with debug_info,
not stripped
```
4. gdb's info
```
Android_15$ file /usr/bin/gdb
/usr/bin/gdb:
ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux),
dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=f5f8723dbedf08022a36e8449e29e717e6547316,
for GNU/Linux 3.2.0,
stripped
```
5. **readelf ./malisc_host** error message **.debug_str unsupported compress type: 2**
```
Android_15$ readelf -p .comment ./malisc_host
readelf: Warning: section '.debug_str' has unsupported compress type: 2
String dump of section '.comment':
[ 0] GCC: (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
[ 2a] GCC: (GNU) 4.8.3
[ 3c] Android (11967740, +pgo, +bolt, +lto, +mlgo, based on r522817) clang version 18.0.1 (https://android.googlesource.com/toolchain/llvm-project d8003a456d14a3deb8054cdaa529ffbf02d9b262)
[ f3] Linker: LLD 18.0.1
```
Questions_2
===
I see the **version** info between **malisc_host** and **a.out** is different.
```
./clang++ : no version info.
./malisc_host : for GNU/Linux 2.6.24,
./a.out : for GNU/Linux 3.2.0,
/usr/bin/gdb : for GNU/Linux 3.2.0,
```
Q2.1 Why did the **malisc_host**'s have a different **version** info?
Q2.2 The **malisc_host**'s **version** info generated base on what?
Q2.3 Did the "gdb malisc_host: BFD: can not recongize" error message,
caused by the **gbd** and **malisc_host** have different **version** info?
Q2.4 For make **clang** generate a **malisc_host** switch it's **version** from **GNU/Linux 2.6.24** to **GNU/Linux 3.2.0**,
Can we specific a **version** info for **malisc_host**,
or we need replace some link-libarary for the **malisc_host**?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsWklz2zj2_zT05RVZJKj14IMsRW7X33E6dtJJn1wgCYroQAT_AGhJOcxnn3oASVGbnfRSU1M1Lh0kYnn77y001ZqvSsauveGNN1xc0doUUl1vOZX_z2m58je0XF0lMttd_8KEkB6Ze-HsziPjNdASPDLzyGxWZkryzH-StUqZP5cZcwtAy6zd8_jev_31s794vPvt3eOZrbVmKvDC2ZeClXAHRu3ASHwKGctpLQykcl1xwcBIKfy0oLylnwrkNJoEYRA1t3lkUimW1FwY7ZGl3eGRZSG18chS8LLe-tvJqF3y1ZCQSTT2yNIjUyeku-lTwRQDrkHLNTMFL1ewURIvcxusOgBSWsLDh0-WX7e0ypKGFyMhY0m9AlOwyxyvWMkUNSyDd_dLyLlgqI29Quoqo4ZBruT68iVGHq5N92s_r5F4RMjQI8uEl_sDqBwrSKVkItgatOFCANtybRqGrUY0L1OmmNjBhpYGdrJW2mrpGy8zsYOCiQrWDGgiawMJE3LTsP6xZtpwWT5HJ07ULRH3uyUYL5rP4fcomNdKsdKIXcu1O_eqIyKTCWu9LbPka80y4GXviss-r-s0ZVrntXBk8fyd8chYg6xNVZveLWsquE6fnRHs6SPjk-CmNrA5iQmPkM7N4OQWjxDkf42kW-9DVu4M6EJuGnUzpaSCNdOarhy9Udh8wla-52jokQEgFQg8suyTCmcAADfLhRfPDniIZ1CXNLGhCr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