Fix the build-id option for GCC default configuration

Message ID AS1PR01MB94658A4252306B4F0877344DE49E2@AS1PR01MB9465.eurprd01.prod.exchangelabs.com
State New
Headers
Series Fix the build-id option for GCC default configuration |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_check--master-arm warning Patch is already merged

Commit Message

Bernd Edlinger Sept. 6, 2024, 7:13 a.m. UTC
  It is possible that the compiler is configured to do
so automatically, but at least for GCC the configure option
--enable-linker-build-id is not enabled by default.
So the option -Wl,--build-id should be used regardless
of which compiler is used.
---

This prevents the following test failures when
GCC is used in default configuration:

FAIL: gdb.base/build-id-seqno.exp: find debuginfo with a single build-id file: debuginfo was read via build-id
FAIL: gdb.base/build-id-seqno.exp: find debuginfo with 4 build-id files: debuginfo was read via build-id
FAIL: gdb.base/build-id-seqno.exp: find debuginfo, first build-id file is bad: debuginfo was read via build-id
FAIL: gdb.base/build-id-seqno.exp: find debuginfo, first 2 build-id files are bad: debuginfo was read via build-id
FAIL: gdb.base/build-id-seqno.exp: find debuginfo, last build-id file is good: debuginfo was read via build-id
FAIL: gdb.base/index-cache.exp: test_cache_enabled_miss: at least one file was created
FAIL: gdb.base/index-cache.exp: test_cache_enabled_miss: couldn't get executable build id
FAIL: gdb.base/index-cache.exp: test_cache_enabled_hit: check index-cache stats
FAIL: gdb.base/index-cache.exp: couldn't remove files in temporary cache dir
FAIL: gdb.base/sysroot-debug-lookup.exp: lookup_via_build_id: sysroot_prefix=: ensure debug information was found
FAIL: gdb.base/sysroot-debug-lookup.exp: lookup_via_build_id: sysroot_prefix=: debug symbols read from correct file
FAIL: gdb.base/sysroot-debug-lookup.exp: lookup_via_build_id: sysroot_prefix=target:: ensure debug information was found
FAIL: gdb.base/sysroot-debug-lookup.exp: lookup_via_build_id: sysroot_prefix=ta
FAIL: gdb.dwarf2/per-bfd-sharing.exp: couldn't remove files in temporary cache dir

 gdb/testsuite/lib/gdb.exp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
  

Comments

Tom de Vries Sept. 6, 2024, 2:07 p.m. UTC | #1
On 9/6/24 09:13, Bernd Edlinger wrote:
> It is possible that the compiler is configured to do
> so automatically, but at least for GCC the configure option
> --enable-linker-build-id is not enabled by default.
> So the option -Wl,--build-id should be used regardless
> of which compiler is used.
> ---
> 
> This prevents the following test failures when
> GCC is used in default configuration:
> 
> FAIL: gdb.base/build-id-seqno.exp: find debuginfo with a single build-id file: debuginfo was read via build-id
> FAIL: gdb.base/build-id-seqno.exp: find debuginfo with 4 build-id files: debuginfo was read via build-id
> FAIL: gdb.base/build-id-seqno.exp: find debuginfo, first build-id file is bad: debuginfo was read via build-id
> FAIL: gdb.base/build-id-seqno.exp: find debuginfo, first 2 build-id files are bad: debuginfo was read via build-id
> FAIL: gdb.base/build-id-seqno.exp: find debuginfo, last build-id file is good: debuginfo was read via build-id
> FAIL: gdb.base/index-cache.exp: test_cache_enabled_miss: at least one file was created
> FAIL: gdb.base/index-cache.exp: test_cache_enabled_miss: couldn't get executable build id
> FAIL: gdb.base/index-cache.exp: test_cache_enabled_hit: check index-cache stats
> FAIL: gdb.base/index-cache.exp: couldn't remove files in temporary cache dir
> FAIL: gdb.base/sysroot-debug-lookup.exp: lookup_via_build_id: sysroot_prefix=: ensure debug information was found
> FAIL: gdb.base/sysroot-debug-lookup.exp: lookup_via_build_id: sysroot_prefix=: debug symbols read from correct file
> FAIL: gdb.base/sysroot-debug-lookup.exp: lookup_via_build_id: sysroot_prefix=target:: ensure debug information was found
> FAIL: gdb.base/sysroot-debug-lookup.exp: lookup_via_build_id: sysroot_prefix=ta
> FAIL: gdb.dwarf2/per-bfd-sharing.exp: couldn't remove files in temporary cache dir
> 

Hi Bernd,

thanks for the patch.

I think this is OK.

Approved-By: Tom de Vries <tdevries@suse.de>

Thanks,
- Tom

>   gdb/testsuite/lib/gdb.exp | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index d4d4acb2313..f58174de843 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -5633,10 +5633,11 @@ proc gdb_compile {source dest type options} {
>       }
>   
>       # If the 'build-id' option is used, then ensure that we generate a
> -    # build-id.  GCC does this by default, but Clang does not, so
> -    # enable it now.
> -    if {[lsearch -exact $options build-id] > 0
> -	&& [test_compiler_info "clang-*"]} {
> +    # build-id.  It is possible that the compiler is configured to do
> +    # so automatically, but at least for GCC the configure option
> +    # --enable-linker-build-id is not enabled by default.
> +    # So to be sure, enable it explicitly.
> +    if {[lsearch -exact $options build-id] > 0} {
>   	lappend new_options "ldflags=-Wl,--build-id"
>       }
>
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d4d4acb2313..f58174de843 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5633,10 +5633,11 @@  proc gdb_compile {source dest type options} {
     }
 
     # If the 'build-id' option is used, then ensure that we generate a
-    # build-id.  GCC does this by default, but Clang does not, so
-    # enable it now.
-    if {[lsearch -exact $options build-id] > 0
-	&& [test_compiler_info "clang-*"]} {
+    # build-id.  It is possible that the compiler is configured to do
+    # so automatically, but at least for GCC the configure option
+    # --enable-linker-build-id is not enabled by default.
+    # So to be sure, enable it explicitly.
+    if {[lsearch -exact $options build-id] > 0} {
 	lappend new_options "ldflags=-Wl,--build-id"
     }