public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/31566] New: [gdb/testsuite] is_aarch32_target return false on aarch32
@ 2024-03-27 15:28 vries at gcc dot gnu.org
  2024-03-27 15:32 ` [Bug testsuite/31566] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-27 15:28 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31566

            Bug ID: 31566
           Summary: [gdb/testsuite] is_aarch32_target return false on
                    aarch32
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

While running tests on aarch64-linux, I noticed:
...
Executing on host: gcc  -fno-stack-protector  -fdiagnostics-color=never -w -c
-g  -o /data/vries/gdb/build/gdb/testsuite/temp/1485517/aarch32.o
/data/vries/gdb/build/gdb/testsuite/temp/1485517/aarch32.c    (timeout = 300)
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector -fdiagnostics-color=never
-w -c -g -o /data/vries/gdb/build/gdb/testsuite/temp/1485517/aarch32.o
/data/vries/gdb/build/gdb/testsuite/temp/1485517/aarch32.c^M
/data/vries/gdb/build/gdb/testsuite/temp/1485517/aarch32.c:1:9: error: unknown
type name 'mov'^M
    1 |         mov r0, r0^M
      |         ^~~^M
...

This is is_aarch32_target:
...
gdb_caching_proc is_aarch32_target {} {
    if { [istarget "arm*-*-*"] } {
        return 1
    }

    if { ![istarget "aarch64*-*-*"] } {
        return 0
    }

    set list {}
    foreach reg \
        {r0 r1 r2 r3} {
            lappend list "\tmov $reg, $reg"
        }

    return [gdb_can_simple_compile aarch32 [join $list \n]]
}
...

On an aarch32 target, this will always return false, because it tries to
compile raw assembly instructions in a .c file using a compiler.

AFAICT, this is a regression since commit c221b2f7708 ("Testsuite: Add
gdb_can_simple_compile").

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/31566] [gdb/testsuite] is_aarch32_target return false on aarch32
  2024-03-27 15:28 [Bug testsuite/31566] New: [gdb/testsuite] is_aarch32_target return false on aarch32 vries at gcc dot gnu.org
@ 2024-03-27 15:32 ` vries at gcc dot gnu.org
  2024-03-27 16:11 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-27 15:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31566

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d48ea37c0cc..51479cce9c2 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3661,7 +3661,7 @@ gdb_caching_proc is_aarch32_target {} {
            lappend list "\tmov $reg, $reg"
        }

-    return [gdb_can_simple_compile aarch32 [join $list \n]]
+    return [gdb_can_simple_compile aarch32 [join $list \n] object asm]
 }

 # Return 1 if this target is an aarch64, either lp64 or ilp32.
@@ -5086,6 +5086,10 @@ proc gdb_simple_compile {name code {type object}
{compile_flags {}} {object obj}
            set ext "d"
            break
        }
+       if { "$flag" eq "asm" } {
+           set ext "s"
+           break
+       }
     }
     set src [standard_temp_file $name.$ext]
     set obj [standard_temp_file $name.$postfix]
...

I'll try to run this in an armhf container on an aarch64-linux system.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/31566] [gdb/testsuite] is_aarch32_target return false on aarch32
  2024-03-27 15:28 [Bug testsuite/31566] New: [gdb/testsuite] is_aarch32_target return false on aarch32 vries at gcc dot gnu.org
  2024-03-27 15:32 ` [Bug testsuite/31566] " vries at gcc dot gnu.org
@ 2024-03-27 16:11 ` vries at gcc dot gnu.org
  2024-03-27 16:19 ` [Bug testsuite/31566] [gdb/testsuite] is_aarch32_target contains dead code vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-27 16:11 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31566

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> I'll try to run this in an armhf container on an aarch64-linux system.

Turns out that one identifies as armv8l-unknown-linux-gnueabihf.

Which means that is_aarch32_target returns true because istarget "arm*-*-*"
matches.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/31566] [gdb/testsuite] is_aarch32_target contains dead code
  2024-03-27 15:28 [Bug testsuite/31566] New: [gdb/testsuite] is_aarch32_target return false on aarch32 vries at gcc dot gnu.org
  2024-03-27 15:32 ` [Bug testsuite/31566] " vries at gcc dot gnu.org
  2024-03-27 16:11 ` vries at gcc dot gnu.org
@ 2024-03-27 16:19 ` vries at gcc dot gnu.org
  2024-03-27 19:25 ` vries at gcc dot gnu.org
  2024-03-27 19:29 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-27 16:19 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31566

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[gdb/testsuite]             |[gdb/testsuite]
                   |is_aarch32_target return    |is_aarch32_target contains
                   |false on aarch32            |dead code

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/31566] [gdb/testsuite] is_aarch32_target contains dead code
  2024-03-27 15:28 [Bug testsuite/31566] New: [gdb/testsuite] is_aarch32_target return false on aarch32 vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-27 16:19 ` [Bug testsuite/31566] [gdb/testsuite] is_aarch32_target contains dead code vries at gcc dot gnu.org
@ 2024-03-27 19:25 ` vries at gcc dot gnu.org
  2024-03-27 19:29 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-27 19:25 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31566

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> (In reply to Tom de Vries from comment #1)
> > I'll try to run this in an armhf container on an aarch64-linux system.
> 
> Turns out that one identifies as armv8l-unknown-linux-gnueabihf.
> 
> Which means that is_aarch32_target returns true because istarget "arm*-*-*"
> matches.

So, is_aarch32_target could be simplified to:
...
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d48ea37c0cc..46f8e36ef4d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3647,21 +3647,8 @@ proc is_x86_64_m64_target {} {
 # Return 1 if this target is an arm or aarch32 on aarch64.

 gdb_caching_proc is_aarch32_target {} {
-    if { [istarget "arm*-*-*"] } {
-       return 1
-    }
-
-    if { ![istarget "aarch64*-*-*"] } {
-       return 0
-    }
-
-    set list {}
-    foreach reg \
-       {r0 r1 r2 r3} {
-           lappend list "\tmov $reg, $reg"
-       }
-
-    return [gdb_can_simple_compile aarch32 [join $list \n]]
+    # Aarch32 on aarch64 is classified as armv8l.
+    return [istarget "arm*-*-*"]
 }

 # Return 1 if this target is an aarch64, either lp64 or ilp32.
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/31566] [gdb/testsuite] is_aarch32_target contains dead code
  2024-03-27 15:28 [Bug testsuite/31566] New: [gdb/testsuite] is_aarch32_target return false on aarch32 vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-03-27 19:25 ` vries at gcc dot gnu.org
@ 2024-03-27 19:29 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-27 19:29 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31566

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
I also saw:
...
# Return 1 if this target is an aarch64, either lp64 or ilp32.                 

proc is_aarch64_target {} {
    if { ![istarget "aarch64*-*-*"] } {
        return 0
    }

    return [expr ![is_aarch32_target]]
}
...

I wonder what config.guess prints on an aarch64 ilp32 target.  Debian seems to
have a port ( https://wiki.debian.org/Arm64ilp32Port ).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-27 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 15:28 [Bug testsuite/31566] New: [gdb/testsuite] is_aarch32_target return false on aarch32 vries at gcc dot gnu.org
2024-03-27 15:32 ` [Bug testsuite/31566] " vries at gcc dot gnu.org
2024-03-27 16:11 ` vries at gcc dot gnu.org
2024-03-27 16:19 ` [Bug testsuite/31566] [gdb/testsuite] is_aarch32_target contains dead code vries at gcc dot gnu.org
2024-03-27 19:25 ` vries at gcc dot gnu.org
2024-03-27 19:29 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).