From patchwork Thu Mar 6 16:16:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 870883 Delivered-To: patch@linaro.org Received: by 2002:ab3:6e57:0:b0:290:25b2:841c with SMTP id w23csp541795ltm; Thu, 6 Mar 2025 08:17:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWU5sQNDbAONxf1/U+dnvFWNDyP/w3j/lzW+jB+6eMwQgv9djSJsEt2ve9ei9oUGbI0GS5aag==@linaro.org X-Google-Smtp-Source: AGHT+IG79huZWB/bBzg9mvwFap9tMR3J/TDwz99Rc4LHRKLYW4JeSaa21VPHr26zYVaWUokzvBHY X-Received: by 2002:ac8:5f47:0:b0:474:fee1:7903 with SMTP id d75a77b69052e-4750b4481e1mr135094891cf.13.1741277855547; Thu, 06 Mar 2025 08:17:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741277855; cv=none; d=google.com; s=arc-20240605; b=WP8nPTmIpyFTDDxLmW6f9ZB5LEoAYPKv/BPzZgxDNCs1eqWb6pqDF/9RL9dau3fhJe WR9r4HCllHeiqmcJ6ThP6RnM5EkMRe29En3lL6OZJ7uG6IN3VDeuP0Tt7Ae2JpOer0uW OZFtCh/zk2GQKC325PG6iSVb9H0T/ba/2og/8GDVoaLjFmOl25/zc4IEi2XxOVeo5raV 2C4BaTYgU0ksuTDTQRirbk9SnWN8gOxmAHhuwgBRjTymyyZ4RNx/gYVds4zMAC548dcb HO4Yfw9Uj8YqeV00IsgX5KUvAORYAwdOq9NQ7tKnRuUaWXBI16DKxuTg4EglADdwrYTe kk1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=xjVTMoKE2YFpSamLuLdkjBohjXiM/7zwA6+1VeWKxpo=; fh=QbeIcmuC3F2QBxnEjQqooES3eh3gBrKrJzUD+KJkz3s=; b=jX0yR8XX/XduKf1z2IAa4i/iuXO0JN6lmxuN02lNJLadWyGAM4yJ4+TAX5VfffuPvX CQq+JcfIx85vUbnjJJEPkMHOo6huoGYjP8R3thsRznGkNAd07YPd6aBxBXVUPlnPMKvS aPumN3OFzqUHRjDxFLzwmdubZk9xXsTX/+iNwy5R+CemghvKI13YA0xPiiWJMXy+LnfA 0PTEbICpfw+Io+W5zS4qudd7DMTSepot9EQehiaQJn3AWTt9ck15aDiSuVR91wBbebvR h1bqamRIr3uwuqjXcaGbyxntsTlqpuXlc9JJe36JJm97u8T8P6VMHoWXF/wdpwysg66Z M+JQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oVBRreKY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4751db453a9si15137401cf.592.2025.03.06.08.17.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Mar 2025 08:17:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oVBRreKY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqDuA-0000EI-3O; Thu, 06 Mar 2025 11:17:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqDto-000077-Vg for qemu-devel@nongnu.org; Thu, 06 Mar 2025 11:16:41 -0500 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tqDtm-0001pF-DT for qemu-devel@nongnu.org; Thu, 06 Mar 2025 11:16:40 -0500 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5e56b229d60so3824075a12.0 for ; Thu, 06 Mar 2025 08:16:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741277796; x=1741882596; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xjVTMoKE2YFpSamLuLdkjBohjXiM/7zwA6+1VeWKxpo=; b=oVBRreKYAWr5kwLywwVR1m77HyRW2FoVX+k7Mc8J71JqOYVrNypq8Ahsf/CNKtg/Fz nMl7Kcf91+t8txyfWpCM8g1bw0H0yPeQbJ0Isr31Ps+lfrA3ch1cElIveTD0O10NkFNJ DNb+4fymhKp+kfHutwua8uawmY9jqgGOlGoDepH7TXsDjeBnVZKYMPqJBzCY3u08yj6G ShQIijjOK57SRxjF82jFRc7GmePLjDowxHQXP6xL1iROlucvXV4NGo7GD3lEnVouW1cC hX95Ckk7d0JPhM03T92KZ1UF4UWzmoyN7mG6maAQ9ZBVhi/EagZXoQDFcrISSSCjzMHT H+2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741277796; x=1741882596; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xjVTMoKE2YFpSamLuLdkjBohjXiM/7zwA6+1VeWKxpo=; b=nrbzZzQEpVuHvwLUjVBNbrhfcgGwMPuuEbGBtaUq2S8h8u/WMWOixTqp/us+dFD+To cZBxLTE05qMicA2Vj6tIuLJB2BMPJnvCyAmkjUO2wXW8DIFGtjcYKggrYPQ7nTjZgqZM J8mHh3pdHZcGHW/+SXHhP+u2qRDHBzCA3r8ZcjrXPirbm2j/Lalgs1YCFGWKlG2CuC/B Afu7O9GZpHVrbGMfxtX0UHhupp0Ky0Sb5hcWA021fmoNeJ0H8sWmNX4O/Cm5VJKMOPOo WCYN+KpMPxEz5/iVd9KyR2kejqNjglC9zIw0yK2NI99cbdczfA832w9vPV2L+cxAhA1N Gomw== X-Gm-Message-State: AOJu0Yxldn/RL3fSqTG0eOW1q+ACZSSv2Z+ZdmpnNYJHAWZxzXDe+TOU /P32VeLJ12XJ835itYOqTRR1Asc0CBHCLPlsC+l+FT9/xKiNFfdd3XDhU0mxBJw= X-Gm-Gg: ASbGncvcBHGAEGZepIdFaUfAFoCK7E/xoKkoXKAMSLKrPgGD1AX4vjsKvJWRsIl9Olt YQ6z2ndXxCViuYQFiVwGgmI5gHcOI4g84iWeaWcH+dApoxZ93wY7XrvvdzRVHhO/FxvDGx8Cm08 kBF0AKxUq73fwJ3ezFLU1iSgLE3EsC9dzwOEsGe+o1vm5AK4IPMwLALH166xMiu+e9GKkofRwUq epZCu2KyoCv3bqeSEcEi9B06dTiSAKlFcV+ckwvP3FGDdyEVnIdUdfuPQhsKSJx3dlYytnwGM9G XUUdf6gp3WJ8e2yzv9g/5ui7icaLuAiCV/XlxddJGiQJ0GA= X-Received: by 2002:a17:907:3e13:b0:abf:6e9:3732 with SMTP id a640c23a62f3a-ac22ca6c386mr368387766b.3.1741277796388; Thu, 06 Mar 2025 08:16:36 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac2399d7de3sm117527066b.184.2025.03.06.08.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Mar 2025 08:16:35 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CB8265F9CF; Thu, 6 Mar 2025 16:16:34 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_?= =?utf-8?q?P_=2E_Berrang=C3=A9?= , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3] meson.build: default to -gsplit-dwarf for debug info Date: Thu, 6 Mar 2025 16:16:31 +0000 Message-Id: <20250306161631.2477685-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x529.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This option is supported by both gcc (since 4.7) and clang (since 7.0). Not only does this make the linkers job easier by reducing the amount of ELF it needs to parse it also reduces the total build size quite considerably. In my case a default build went from 5.8G to 3.9G (vs 1.9G for --disable-debug-info). The --disable-split-debug option allows distros to keep all the info together for ease of packaging. Signed-off-by: Alex Bennée Reviewed-by: Daniel P. Berrangé --- v1 - add --disable/enable-split-debug - move to option_cflags v2 - removed unneeded []'s - fix stray whitespace v3 - set qemu_cflags instead of option_cflags - move up to the rest of the qemu_cflag setting code - update build size numbers with --disable-debug-info --- meson.build | 6 +++++- meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 8d0abe7f12..bba17c73f1 100644 --- a/meson.build +++ b/meson.build @@ -601,6 +601,10 @@ if get_option('tsan') qemu_ldflags = ['-fsanitize=thread'] + qemu_ldflags endif +if get_option('debug') + qemu_cflags += get_option('split_debug') ? ['-gsplit-dwarf'] : ['-g'] +endif + # Detect support for PT_GNU_RELRO + DT_BIND_NOW. # The combination is known as "full relro", because .got.plt is read-only too. qemu_ldflags += cc.get_supported_link_arguments('-Wl,-z,relro', '-Wl,-z,now') @@ -4589,7 +4593,7 @@ if have_rust summary_info += {'bindgen': bindgen.full_path()} summary_info += {'bindgen version': bindgen.version()} endif -option_cflags = (get_option('debug') ? ['-g'] : []) +option_cflags = [] if get_option('optimization') != 'plain' option_cflags += ['-O' + get_option('optimization')] endif diff --git a/meson_options.txt b/meson_options.txt index 59d973bca0..3432123fee 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -362,6 +362,8 @@ option('debug_mutex', type: 'boolean', value: false, description: 'mutex debugging support') option('debug_stack_usage', type: 'boolean', value: false, description: 'measure coroutine stack usage') +option('split_debug', type: 'boolean', value: true, + description: 'split debug info from object files') option('qom_cast_debug', type: 'boolean', value: true, description: 'cast debugging support') option('slirp_smbd', type : 'feature', value : 'auto', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 3e8e00852b..aca6e68830 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -504,6 +504,8 @@ _meson_option_parse() { --disable-strict-rust-lints) printf "%s" -Dstrict_rust_lints=false ;; --enable-strip) printf "%s" -Dstrip=true ;; --disable-strip) printf "%s" -Dstrip=false ;; + --enable-split-debug) printf "%s" -Dsplit_debug=true ;; + --disable-split-debug) printf "%s" -Dsplit_debug=false ;; --sysconfdir=*) quote_sh "-Dsysconfdir=$2" ;; --enable-tcg) printf "%s" -Dtcg=enabled ;; --disable-tcg) printf "%s" -Dtcg=disabled ;;