From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by sourceware.org (Postfix) with ESMTPS id 82B053858C52 for ; Mon, 2 May 2022 18:55:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 82B053858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f54.google.com with SMTP id r1-20020a1c2b01000000b00394398c5d51so97178wmr.2 for ; Mon, 02 May 2022 11:55:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=ZpOfH1eGC267oGeeaWqcqBAW9b4Z4nBpvXGKdP6KKOA=; b=MHjGfF5hleBeyzCblS9pWr8/CXhTqZqKFsX6JdliHfxLyeT+JFw5LE/UXZaHc7maUK yeCPxYcLFMT74raRLDUr6T5XNWDPq1hk1ydMBXyLXGWTbY0wzuA8XgxKg6jlpd97hG6W JcsS3I+E68ubYYmBilZQHz3HRZVHkOdVz8DVLt9ffMklHAXpD+PpmgpYNaKAgJIoXcuq h4GLptYOW8amjrquxvBIgwhAb5poI/H+Zt21QqhiyuU3zES/JvCTqwgt5L3IWhNXXpda wNQHvbsm/HXTC9XeJRRh+60WaVHiT1QZ7uuQerSarsgRrka20k2QofOGLA3tufXzGKDm Cplg== X-Gm-Message-State: AOAM533MLw5+grCNo+NujD6k2cDGtCJVW1E7oVqbbJaXPeqSZgOkBlcE 82Yqkx9grIi1iljfvfHrmpM= X-Google-Smtp-Source: ABdhPJwc2CTdyC0HlD0AI5EUNFgq1L+of4t9QRtmjLUORDSaKpONhCdhhMUx3u2gvnMjle//pntp1g== X-Received: by 2002:a05:600c:3492:b0:392:97ba:9581 with SMTP id a18-20020a05600c349200b0039297ba9581mr372496wmq.163.1651517715423; Mon, 02 May 2022 11:55:15 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id l9-20020adfb109000000b0020c5253d8d7sm7534704wra.35.2022.05.02.11.55.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 11:55:14 -0700 (PDT) Message-ID: <12ded5b8-54c4-b336-2fbf-1a0417ce4361@palves.net> Date: Mon, 2 May 2022 19:55:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 1/1] get page size using sysconf (_SC_PAGESIZE) instead of PAGE_SIZE Content-Language: en-US To: Zied Guermazi , Andreas Schwab , Tom Tromey Cc: gdb-patches@sourceware.org References: <20220430121623.42196-1-zied.guermazi@trande.de> <20220430121623.42196-2-zied.guermazi@trande.de> <87ee1e92kp.fsf@igel.home> <47159933-7e6a-ab66-b0b8-1b184a469e6c@trande.de> <877d7691jf.fsf@igel.home> <87y1zm7mfl.fsf@igel.home> <44259e87-d19f-189b-123e-39ea9f06c763@trande.de> <87tuaa7l1v.fsf@igel.home> <2ab7945d-5355-586c-1af5-7b465586d01c@trande.de> From: Pedro Alves In-Reply-To: <2ab7945d-5355-586c-1af5-7b465586d01c@trande.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, BODY_8BITS, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 May 2022 18:55:18 -0000 On 2022-05-02 19:01, Zied Guermazi wrote: > hi Pedro, > > I think I can clarify the situation here by giving more insight on the context. A short explanation is needed. > > In current build system linux-btrace.c is only included when the host is a Linux running of an i386 cpu. (see gdb/configure.nat).  so the point of Andreas is pertinent with no further explanations of additional planned changes. > > This patch is a preparation for another patch set for adding btrace on arm processors using ARM Coresight ETM traces. (see the patch set https://pi.simark.ca/gdb-patches/20210531213307.275079-1-zied.guermazi@trande.de/#r ). Markus Metzger in his review recommended submitting this change in a separated patch. > > In the patch set for adding btrace on arm,  there is a need to build linux-btrace.c for hosts linux/aarch64 and linux/arm. gdb/configure.nat at line 233 looks now as following: > > " > >  /   linux)// > //    case ${gdb_host_cpu} in// > //        aarch64)// > //        #  Host: AArch64 based machine running GNU/Linux// > //        NATDEPFILES="${NATDEPFILES} aarch64-nat.o aarch64-linux-nat.o \// > //        aarch32-linux-nat.o nat/aarch64-hw-point.o \// > //        nat/aarch64-linux-hw-point.o \// > //        nat/aarch64-linux.o \// > //        *nat/linux-btrace.o* \// > //        nat/aarch64-sve-linux-ptrace.o \// > //        nat/aarch64-mte-linux-ptrace.o"// > //        ;;// > //        arc)// > //        # Host: ARC based machine running GNU/Linux// > //        NATDEPFILES="${NATDEPFILES} arc-linux-nat.o"// > //        ;;// > //        arm)// > //        # Host: ARM based machine running GNU/Linux// > //        NATDEPFILES="${NATDEPFILES} arm-linux-nat.o \// > //        aarch32-linux-nat.o *nat/linux-btrace.o*"// > //        ;;/ > > " > > which means that the file is now included in the build for linux/aarch64 and linux/arm > > > I have observed this issue when the build machine was an intel x86,  host and target were both aarch64-linux (and also arm-linux) OK, thanks, that clarifies things. I wasn't aware of that patch series. The build and target machines (in autoconf terms) are really irrelevant here. The only machine that matters here is the host one. > > using following configuration > > "../binutils-gdb/configure --host aarch64-linux-gnu --target=aarch64-linux-gnu --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprofng --with-arm-cs " > > and when building natively on Debian on aarch64 and Debian on arm. Did you really run configure on one machine, and then typed "make" on a different machine? Anyhow, doesn't matter. > > I was getting following build error message > > " > /../../binutils-gdb/gdb/nat/linux-btrace.c:799:30: error: ‘PAGE_SIZE’ was not declared in this scope; did you mean ‘PTRACE_SEIZE’?// > //  799 |   scoped_mmap data (nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,// > //      |                              ^~~~~~~~~// > //      |                              PTRACE_SEIZE/ > > " > > The issue was fixed with this patch. Right. So in the commit log, instead of: "PAGE_SIZE is not defined in all build configurations, e.g cross compiling for aarch64 GNU/Linux machine. This patch gets the value at runtime using posix call sysconf (_SC_PAGESIZE)" don't mention cross compiling at all, as that just confuses things. I'd suggest instead: "Currently, linux-btrace.c is only built when the host is x86 or x86_64 GNU/Linux. Later patches will add btrace support on ARM processors using ARM Coresight ETM traces. That ran into the fact that PAGE_SIZE is not defined on Aarch64. This patch fixes that by getting the page size value at runtime using POSIX sysconf(_SC_PAGESIZE) instead." Pedro Alves