[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41295: Fix access to target_info global in default_target_compile (w

From: Jacob Bachmeyer
Subject: bug#41295: Fix access to target_info global in default_target_compile (with patch)
Date: Fri, 15 May 2020 17:51:15 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20090807 MultiZilla/ SeaMonkey/1.1.17 Mnenhy/

This bug was uncovered while developing tests for default_target_compile.  The procedure 
attempts to determine if a host is set using [info exists target_info(host,name)], but 
does not use the global target_info.  As a result, the configuration for "unix" 
is used unconditionally.  This is clearly a bug.

The only potential impact of this patch is that the cflags_for_target board_info parameter will now 
be correctly retrieved from the host board configuration instead of always from the 
"unix" board configuration.  It is clear that this was the intent of the original code 
and doubtful that any testsuites are depending on the current broken behavior.  (If anyone is 
working around this bug, we should have received complaints about default_target_compile ignoring 
the selected host.  Had such complaints been received, this bug would have been fixed long ago, 
therefore no tests will be broken by this patch.  I suspect that nearly all current use of DejaGnu 
is on "unix" hosts, thus camouflaging this bug very effectively.)

>From 7cb6a9fcd198d11c5f969d867d24a17b47d3cdf4 Mon Sep 17 00:00:00 2001
From: Jacob Bachmeyer <address@hidden>
Date: Fri, 17 May 2019 17:53:54 -0500
Subject: [PATCH 3/9] Fix access to target_info global in default_target_compile

*ChangeLog entry:
        * lib/target.exp (default_target_compile): Use "host_info"
        procedure to probe for a host configuration, instead of checking a
        local empty target_info array due to lacking "global target_info".
 lib/target.exp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/target.exp b/lib/target.exp
index 2620e30..9cc262d 100644
--- a/lib/target.exp
+++ b/lib/target.exp
@@ -326,7 +326,7 @@ proc default_target_compile {source destfile type options} {
        append ldflags " $LDFLAGS_FOR_TARGET"
-    if {[info exists target_info(host,name)]} {
+    if {[host_info exists]} {
        set host [host_info name]
     } else {
        set host "unix"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]