From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id A0C523858CD1; Tue, 19 Mar 2024 10:54:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0C523858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A0C523858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710845684; cv=none; b=O8UD8kgSyObUHRa+JI4CATCiUYLaDQlVT3Oib6oujcjilpFf8Af7nnWPhl8HiyES8kpWOTDnT6yCd0r7RFze7G19Yg3jh2jR3CF/VFTlwl9+e9TaKJYWnkcTS8oFd+HjBjXnVMC6ljpaH06umcZxmrAMwjq1PRIVczus9PVL0e4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710845684; c=relaxed/simple; bh=OJNDjwm5+vMb5Webo0z6JkXT5prvbg0MpZkg3GHZ2gY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=WYjlV73voSm5Kb563whKFBYSR9C4ep1oDbGnf4l4bOnsZq4lbSML59g9UIAuqAsrNj4oTMZLSNs49GQd5AVR9ukadnK2p5fHddBDxo17loPPRTKi6FagQI/Ojf8u5XjbOLyYuiCW8uptrZDrFGkITefXJN0j+rH5WxjRTagw2Mw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1deffa23bb9so24591855ad.2; Tue, 19 Mar 2024 03:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710845681; x=1711450481; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=+OVf4zuKYtUVnxU1dKc7O+naGsuUbKeUkuOhhtrFt1A=; b=FYUmyYeaj7EmNAf1ynREnd8Vh6d6CCzLd2BpvqIgvpaJq5sQdnWLnDrzwU5bwH9233 lcEMm7s+A+ONAt9f3tDqf04zNCIMYOgcVeuZ5qXpwAn36TAz4BhUB8UyVewuORrjecru fN3jNRYGqV1KmYkKqXE4FdBnTnnqbh3BJdzQFgkesnzDwxI5gq0oWGtydUMDmTnAN8zL 6zG2dXuBqazyHAQEooRmW72rlIcz/x6VcF5jymM8P/c+KUkeMBkaO1tzgWwFIcrldFea Du7LFrSU/u/zPT7NZzF7mWuGFLsHZrAgj+muSkhwhHZIpmYiHj47XWiv8+Eeix4YOJa8 aKlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710845681; x=1711450481; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+OVf4zuKYtUVnxU1dKc7O+naGsuUbKeUkuOhhtrFt1A=; b=Utbvck36AEFKiX/iofAJuDqzmMvSPX9Cs0xxn43op4QfHgRHMwvHfw9TWUOMB2XVge IUGS8HjrflnFscTUt/HHZ3KouhaZj8B99C1AFcDOy4TpTgAjmMO3PznVRFev+kytVGKa w4zK9XCGut0m3SSJ07jRkey/TnFNt3zDDPQEbVJVoTO5PE++ZBG8epOsCkx2CG2p/Fqw T+MMdnfbs4pZoUdLtVZoRORqnC0KLyfNG6opSsNdYd/+IOeoTL/1auKhGNtE+iospWVA FLbb34Op+ZM9m8eqbE9vKMiMq0RzZyiMPweaPniuMDqfIswpWYzIcK9ZTLZe+KY2xhrn 1C5Q== X-Forwarded-Encrypted: i=1; AJvYcCXPY7hza0YGH1S2j8htzZdZj26/pAdbWhXs+/Z02A7scn9Yv87D1HU5y5wfr03HPdhESdQQ40Zm5UjGkQfw3Oirxj5CwMWNAA== X-Gm-Message-State: AOJu0YxMkRcu+ga/sJ9V/m6wX6swf9DsgBdvCAvTUSseGa/Ds8cRkUdl D2nY54q7cEAPw8VROkxxIDR9ui6yXUhdbxvp5wxsDhhMfPmICG/T09nFbDVG X-Google-Smtp-Source: AGHT+IEkb/si5yiB670DMytPIb+ICzqgn3rEfU8lHlSt46zeW44/duqREPIMdduHaFMhyaWwuK4XkA== X-Received: by 2002:a17:902:64c9:b0:1de:f92a:18dd with SMTP id y9-20020a17090264c900b001def92a18ddmr11876642pli.62.1710845681356; Tue, 19 Mar 2024 03:54:41 -0700 (PDT) Received: from localhost.localdomain ([103.55.98.161]) by smtp.gmail.com with ESMTPSA id p10-20020a170902c70a00b001dd8ce888aasm11086489plp.74.2024.03.19.03.54.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 19 Mar 2024 03:54:41 -0700 (PDT) From: Iain Sandoe X-Google-Original-From: Iain Sandoe To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: fxcoudert@gmail.com, nightstrike@gmail.com Subject: [PATCH] libstdc++, Darwin: Do not use dev/null as the file for executables. Date: Tue, 19 Mar 2024 10:54:20 +0000 Message-Id: <20240319105420.21568-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.39.2 (Apple Git-143) Reply-To: iain@sandoe.co.uk MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Note that Windows-based platforms do something quite similar, but always use the same (x.exe) filename. I wonder, in passing, if that makes a vulnerability in parallel testing (I chose to avoid the possibility for Darwin). Tested on x86_64-darwin21, x86_64-linux-gnu, OK for trunk? back-ports where applicable (I did not yet check)? thanks Iain --- 8< --- Darwin has a separate debug linker, which is invoked when the command line contains source files and debug is enabled. Using /dev/null as the executable name does not, therefore, work when debug is enabled, since the debug linker does not accept /dev/null as a valid executable name. The leads to incorrectly UNSUPPORTED testcases because of the unintended error result from the test compilation. The solution here is to use a temporary file that is deleted at the end of the test (which is the mechanism used elsewhere) libstdc++-v3/ChangeLog: * testsuite/lib/libstdc++.exp (v3_target_compile): Instead of /dev/null, use a temporary file for test executables on Darwin. Signed-off-by: Iain Sandoe --- libstdc++-v3/testsuite/lib/libstdc++.exp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 58804ecab26..4ae4cecb169 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -615,11 +615,15 @@ proc v3_target_compile { source dest type options } { } } + # For Windows and Darwin we might want to create a temporary file. + # note that it needs deleteting. + set file_to_delete "" # Small adjustment for Windows hosts. if { $dest == "/dev/null" && [info exists ::env(OS)] && [string match "Windows*" $::env(OS)] } { if { $type == "executable" } { set dest "x.exe" + set file_to_delete ${dest} } else { # Windows uses special file named "nul" as a substitute for # /dev/null @@ -627,6 +631,15 @@ proc v3_target_compile { source dest type options } { } } + # Using /dev/null as the executable name does not work on Darwin when + # debug is enabled, since the debug linker does not accept /dev/null as + # a valid executable name. + if { $dest == "/dev/null" && [istarget *-*-darwin*] + && $type == "executable" } { + set dest dev-null-[pid].exe + set file_to_delete ${dest} + } + lappend options "compiler=$cxx_final" lappend options "timeout=[timeout_value]" @@ -637,7 +650,12 @@ proc v3_target_compile { source dest type options } { } set comp_output [target_compile $source $dest $type $options] - + if { $type == "executable" && $file_to_delete != "" } { + file delete $file_to_delete + if { [istarget *-*-darwin*] && [file exists $file_to_delete.dSYM] } { + file delete -force $file_to_delete.dSYM + } + } return $comp_output } -- 2.39.2 (Apple Git-143)