From patchwork Tue Apr 2 11:22:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 87924 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5E0AD385842E for ; Tue, 2 Apr 2024 11:23:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id C2707385B532 for ; Tue, 2 Apr 2024 11:22:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C2707385B532 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 C2707385B532 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712056959; cv=none; b=LrdMdGT4UAYuEgdNuNCUHgXYqYuzsrETgEn7b7LQrryZY21kIft+uu/b8bPuRP3IOy/zipfBK6qqoqfMW/w0hZzbZzQYE+/6GC3+wHVa0BVTY6VZInl/LyY+ZUhcF/Sa8tIKPeHPrSWGnMPeLp/wMoYSp5vlkJ2amxrZPcGs2tY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712056959; c=relaxed/simple; bh=3pSb71/ZN+62nldoJLX/WTzpc0PgvLWglngkTVn8PZQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=UHBOt8GXUk74XbwgMURrYDQYQDhpfuq0RiWh2GLnEdHyxnPCyQIaCKKo9pKZb+JzugTZT0uP5Es0v034QOdqtrKLTGx9AzvpXviTcAELO+YILp3vpFtls5e1R47KX7SH1bpkvmZEjT5LgOybzJQCtnEi5IwC55II/Lpnm0dRQ9Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4155819f710so22817515e9.2 for ; Tue, 02 Apr 2024 04:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712056956; x=1712661756; 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=AMHhoaF3Vh144xsQWCKsFSbtOVfVuM1yLQ3O12ZGlv4=; b=LBJcXDwwDBGw04GylW1MSgLnjKhG1CzBPY+R+KHkyKH8hp8yVWDOK8H/ARewhd85Ij 5RrdntFyYocK2YGOPgdVeFYDxmyFo/1VGOSW/bzY4+B4QMY8/FLib9kzI10mfIonvr6Z ymFgIqXfdsAOV0pkCORltH0gdT6vngWSJqEOH/fFjUbI9YPWoHizuaQvAFaPbQxBi/Qg 4YIkzdB8pJG3UH1+DgKRmroFPqp//ufYfBq1slm/KivM9z+eHFIZV+z1H8ctBsGNJGuL +TLt4F9csuk/4MK3r1VW3o2zH9oAbsraVxkyEC0Y5//o/FbG03mQAb9IJOYjiT//ANgG rOlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712056956; x=1712661756; 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=AMHhoaF3Vh144xsQWCKsFSbtOVfVuM1yLQ3O12ZGlv4=; b=YbmEsyI8zJ+IpGkqjmnbVtCV+hyJn5EJFb6PzVXk0ceJ75zz6ztIwAtWnTQkUMx0h8 M1S2xwvulRnVJST1WbSO3DBk8K6NC9q/+6g7gT3QcsvoEfp63ZNx/7Lv5Uz4QXvNUNY3 A7lHysTVr1WitQ3dKgI1J535d6yiR0AuzOUWsg8U1Aiwn8fASY0kcxa6UoEC4dfckyJ/ dbRSisa3et0tOTJzmh1ymgSFhYd/WtLmciPrXPiid3a73GYJmLaZsvFYmVL1axo8lA9b TJZw5ijaXkWjj2OPPP5nlFvXtx63pDMJmCpzRUGdGdZoWzOmMzMND9i6+vUgmbiLVD6m o30g== X-Gm-Message-State: AOJu0YxjQUJF8k5oKNzNiqILJ3shwTP/8sCgDKjuAgQqOCewO8M8qbIP 5EuChxkOtWSMph8dzyXcE8Swe1pkQ9yWeW+K1h4QhP+nbROPGkNEC0/520Zd X-Google-Smtp-Source: AGHT+IH9VaD04LXQIHLRufjPi65EGG3aaTFHmKGhQuNQfQq56itB/bu5n7L91BKoN9NBlm/M9ZCEug== X-Received: by 2002:adf:ef48:0:b0:343:795e:791e with SMTP id c8-20020adfef48000000b00343795e791emr395836wrp.15.1712056956260; Tue, 02 Apr 2024 04:22:36 -0700 (PDT) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id g17-20020a05600c001100b004155a32841bsm10562655wmc.39.2024.04.02.04.22.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 02 Apr 2024 04:22:36 -0700 (PDT) From: Iain Sandoe X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Cc: fxcoudert@gmail.com Subject: [pushed] Darwin: Do not emit .macinfo when dsymutil cannot consume it. Date: Tue, 2 Apr 2024 12:22:35 +0100 Message-Id: <20240402112235.86535-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 X-Spam-Status: No, score=-8.5 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: iain@sandoe.co.uk Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org This causes quite a number of testsuite fails on systems using Xcode 15. More significantly, it is a serious debug regression (since the entire debug is ignored when macinfo is seen). tested on x86_64-darwin17,21,23 with / without Xcode-15, pushed to trunk, thanks Iain --- 8< --- Some verions of dsymutil do not ignore .macinfo sections, but instead ignore the entire debug in the file. To avoid this total loss of debug, when we detect that the debug level is g3 and the dsymutil version cannot support it, we reduce the level to g2 and issue a note. This behaviour can be overidden by -gstrict-dwarf (although the objects will contain macinfo; dsymutil will not produce a .dSYM with it). gcc/ChangeLog: * config/darwin.cc (darwin_override_options): Reduce the debug level to 2 if dsymutil cannot handle .macinfo sections. Signed-off-by: Iain Sandoe --- gcc/config/darwin.cc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc index 9e5d64e6f32..c37a1a4756f 100644 --- a/gcc/config/darwin.cc +++ b/gcc/config/darwin.cc @@ -3415,11 +3415,6 @@ darwin_override_options (void) global_options.x_flag_objc_abi); } - /* Limit DWARF to the chosen version, the linker and debug linker might not - be able to consume newer structures. */ - if (!OPTION_SET_P (dwarf_strict)) - dwarf_strict = 1; - if (!OPTION_SET_P (dwarf_version)) { /* External toolchains based on LLVM or clang 7+ have support for @@ -3442,6 +3437,24 @@ darwin_override_options (void) OPTION_SET_P (dwarf_split_debug_info) = 0; } + /* Cases where dsymutil will exclude files with .macinfo sections; we are + better off forcing the debug level to 2 than completely excluding the + files. If strict dwarf is set, then emit the macinfo anyway. */ + if (debug_info_level == DINFO_LEVEL_VERBOSE + && (!OPTION_SET_P (dwarf_strict) || dwarf_strict == 0) + && ((dsymutil_version.kind == CLANG && dsymutil_version.major >= 1500) + || (dsymutil_version.kind == LLVM && dsymutil_version.major >= 15))) + { + inform (input_location, + "%<-g3%> is not supported by the debug linker in use (set to 2)"); + debug_info_level = DINFO_LEVEL_NORMAL; + } + + /* Limit DWARF to the chosen version, the linker and debug linker might not + be able to consume newer structures. */ + if (!OPTION_SET_P (dwarf_strict)) + dwarf_strict = 1; + /* Do not allow unwind tables to be generated by default for m32. fnon-call-exceptions will override this, regardless of what we do. */ if (generating_for_darwin_version < 10