From patchwork Tue Aug 29 22:02:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 718237 Delivered-To: patch@linaro.org Received: by 2002:adf:d20a:0:b0:31d:da82:a3b4 with SMTP id j10csp237148wrh; Tue, 29 Aug 2023 16:07:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEO4O3fFIc/7U6r8b19U0g1UklMPpXlvOPZ3jfa5R0+3fbwOnrfLVYl6KjuH7R3taQ+RbrY X-Received: by 2002:a05:622a:313:b0:403:b6d2:8dc4 with SMTP id q19-20020a05622a031300b00403b6d28dc4mr647835qtw.34.1693350443436; Tue, 29 Aug 2023 16:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693350443; cv=none; d=google.com; s=arc-20160816; b=BrA6eQAxNUj36EGIH2pQ6C8LNHEbn+xkSQf+YW48JhV3MgcRbNhAwd+2pcQOLDx6n4 mvX2mq3Kqp14+8558qWDpJLSOlmt41EeLPqEa/Y8Kbsll8xVnClGyQ9LYUZPS4Phrgjb 6+79nx3pYLrZVR/i9x0bgoYgZci/7NcUzS0qwQEaW/UMI04i/nKFA3aqTZyoSivcasQo PNeOH9f6Wmf5dNtl67uoJupa+FD2nIfrCLGoVlJE2UsSt5i6Eqm6aEA7w8/0HAKXuo1A sXAfC5DocrPc7bWntr29FqzTXfc6UX3fy638C9xMrXfoB6MHSicZxCLakAACAY96ExGU kVog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=80yiBDrasGbCP19yEMmSaaDi0ipiYiAfvI51hXAWE6g=; fh=yAk+WjNOVgQtt4XdbfUGN19AdnXYnHgxXE90MyVs5ko=; b=YPIO3t5rFGjaKewqwd3I28z4GCVRcaX12kiRN0QUjwfs/HNNdgocpMW7YmlP7UplL0 aDhJhBMQzNPsVqJTCpjmkcFP/72g3efmCZEYokTt6I/rJbzdXh3gxjRJpfc3/S7Jrzdh 4ODziyKwhgp+Shg/CMIEZyd/d4/pL4I5OK/R2VqycUGzNobLvqsCfvEGVkfjuDybZdd4 fqeqJX3zo9XOYDTgv0ZMyK++ABya17ruRmgt/v3ipr5Vs9cLRhRjYh0hmO/3WY+9X7An TlcjVnSG2ck20gf/nMyBD1SxU7fwzIL5M1LHTer8D125g1B137xpvMSHA9sCX/UGRodg ZRtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dgJs6X4n; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z9-20020a05622a060900b0040ff099d956si6717726qta.670.2023.08.29.16.07.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Aug 2023 16:07:23 -0700 (PDT) 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=dgJs6X4n; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qb7ml-0000c8-Kn; Tue, 29 Aug 2023 19:06:11 -0400 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 1qb6nN-0002PK-JH for qemu-devel@nongnu.org; Tue, 29 Aug 2023 18:02:48 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qb6nK-00049Z-Je for qemu-devel@nongnu.org; Tue, 29 Aug 2023 18:02:44 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-68bec3a9bdbso3174541b3a.3 for ; Tue, 29 Aug 2023 15:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693346561; x=1693951361; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=80yiBDrasGbCP19yEMmSaaDi0ipiYiAfvI51hXAWE6g=; b=dgJs6X4nB1fJ6mdNPymBrmOQXNgHyf5e5yomo65NlYcdHUzOIcmgFlhnj81MuPCaay 5zNQ/067rPBKGclMhC/nXkXaMbQZ7Dq/Fg9eSbBbuBp9P4nQVp6K+uoNDEvWAgb5bpYR 6CRiMKxESMMreg5vJFSegn21HXkdRsd9cTkcAGXqiREtX1LTgmt3JC6li/BHLZ2l671W Ew5Y4CghLbbGFbp9xAClIEjOp32VL5F4tsPIGAeUTnIh2LIscovwbYzCxlaboF2hY5BM pHM46GkcADtJJHCRAWYaHMuPR0bAjCc3g5nTdVZpQOPu/nK6nNRjEldrR6DKQsmYPZEA ypUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693346561; x=1693951361; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=80yiBDrasGbCP19yEMmSaaDi0ipiYiAfvI51hXAWE6g=; b=d/TdtwsE068REjxigskaZnwBeLIm9cO8gjBEHhWFm3M1zad83V5U7hzRU2CTudCUMO MEaVfl8XN5uuRM/FMeYXPDrjxTWCEwquxhIL+9x06XAk9G/ExGnLErN7T3EXEracTPJy Ho3Fmm46JCtybygwSMN/9VCuzkZLb5pY4g476/49QUUpoyI61967bztFObuLepJx2TWX queBtzKWwXGOADo+lOMBZ2SOTBeKx4WrZltwVrsVE9RO8pKACetgwCIqEW4tcKZfW5TY 9C8raKY5YVC5bYgUjFE7bc20XOAD10XXv0qBDuIPd7V5kOogT+CGlRtop+WgOGxdXsz4 dXxw== X-Gm-Message-State: AOJu0YzN3CPbzw9GTdy/tK/fW4U99RGY8B7PqqjugVzlnoBLRfLDz3yW UJsPTeOiu+pyUlbNSbX6UGCmlvL86Ok30wMV3ec= X-Received: by 2002:a05:6a00:3982:b0:675:ef91:7922 with SMTP id fi2-20020a056a00398200b00675ef917922mr568966pfb.4.1693346559671; Tue, 29 Aug 2023 15:02:39 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id b28-20020a63715c000000b0056606274e54sm9538196pgn.31.2023.08.29.15.02.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 15:02:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, laurent@vivier.eu Subject: [PATCH v5 10/20] linux-user: Add build-vdso.sh tool Date: Tue, 29 Aug 2023 15:02:18 -0700 Message-Id: <20230829220228.928506-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230829220228.928506-1-richard.henderson@linaro.org> References: <20230829220228.928506-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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 A shell script to build the vdso using the cross-compiler makefile fragment. If none detected, fall back to copying the pre-build vdso from the source directory. Signed-off-by: Richard Henderson --- linux-user/build-vdso.sh | 31 +++++++++++++++++++++++++++++++ linux-user/meson.build | 1 + 2 files changed, 32 insertions(+) create mode 100755 linux-user/build-vdso.sh diff --git a/linux-user/build-vdso.sh b/linux-user/build-vdso.sh new file mode 100755 index 0000000000..489088737f --- /dev/null +++ b/linux-user/build-vdso.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Build vdso using cross tools + +build_dir=error +source_dir=error +target_dir=error +output=error + +while test $# -gt 0; do + opt="$1" + shift + case "$opt" in + -B) build_dir=$1; shift;; + -C) source_dir=$1; shift;; + -T) target_dir=$1; shift;; + -o) output=$1; shift;; + --) break;; + esac +done + +frag="${build_dir}/tests/tcg/${target_dir}/config-target.mak" +if ! test -f "$frag"; then + # No cross-compiler available + # Copy pre-build image into build tree + cp "${source_dir}/$(basename ${output})" "${output}" + exit $? +fi + +# Extract cross-compiler from the makefile fragment, and build. +CC=$(grep CC= "$frag" | sed s/CC=//) +exec $CC -o "$output" $@ diff --git a/linux-user/meson.build b/linux-user/meson.build index e4cb70ed2d..099e5c4fe0 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -30,6 +30,7 @@ linux_user_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING', if_true: files('sem syscall_nr_generators = {} +build_vdso_cmd = find_program('build-vdso.sh') gen_vdso_exe = executable('gen-vdso', 'gen-vdso.c', native: true, build_by_default: false) gen_vdso = generator(gen_vdso_exe, output: '@BASENAME@.c.inc',