From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.20645.1684758484648463501 for ; Mon, 22 May 2023 05:28:05 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d1MdVj0t; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684758483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MFTTWxpWLjRTLqVnV5X8rgUbBN8Z4+CHFs8/FxCn1c8=; b=d1MdVj0tzyKFoX41dsdCKj/A7XX9X/n0fsJj+ejTon6+WjVYAysfMFZlLhTDKvcKZ4bg1V s4/nyYS82uHf1s9JRB4dkW9el8HQMU9gFvpssIkwgq4vxeIWbU3L+/NdA+oXj6kpywXeYL aMwgKZl7fcL2+afGoTGKedf1pwibKT4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-426-iPP2TVrkNSSOVo_Rmei09w-1; Mon, 22 May 2023 08:27:59 -0400 X-MC-Unique: iPP2TVrkNSSOVo_Rmei09w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8F121C05AB6; Mon, 22 May 2023 12:27:58 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.139]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87E95407DEC3; Mon, 22 May 2023 12:27:57 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 254A81800606; Mon, 22 May 2023 14:27:56 +0200 (CEST) Date: Mon, 22 May 2023 14:27:56 +0200 From: "Gerd Hoffmann" To: devel@edk2.groups.io, ardb@kernel.org Cc: Marvin =?utf-8?Q?H=C3=A4user?= , Pawel Polawski , Dongyan Qian , Sunil V L , Baoqi Zhang , Chao Li , Rebecca Cran , Ard Biesheuvel , Zhiguang Liu , Liming Gao , Yuwei Chen , Leif Lindholm , Michael D Kinney , Daniel Schaefer , Bob Feng , Oliver Steffen Subject: Re: [edk2-devel] [PATCH v4 01/10] BaseTools: add BASETOOLS define Message-ID: References: <20230414080250.1357004-2-kraxel@redhat.com> <18EC1A6E-8B81-4564-83A5-DA8EC2BA54ED@posteo.de> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, So, after a way to long time gap, I finally found the time to look at this again. This time tried both gcc and clang. Just dropping the visibility hidden #pragma works fine for gcc. It also works with clang for DEBUG and RELEASE builds, but not for NOOPT builds. > > Automatically detecting freestanding vs. hosted would be even better, > > anyone knows whenever there is a define which can be used for this? At > > least the gcc man page doesn't mention any ... > > > > ard@gambale:~/linux-build-x86$ gcc -dM -E -o - -xc - <<< ""|grep HOSTED > #define __STDC_HOSTED__ 1 > ard@gambale:~/linux-build-x86$ gcc -ffreestanding -dM -E -o - -xc - > <<< ""|grep HOSTED > #define __STDC_HOSTED__ 0 Problem with this is we don't build with -ffreestanding. Simply adding it breaks (not surprisingly) the hosted builds, specifically various test cases such as MdePkg/Test/MdePkgHostTest.dsc. Looking through BaseTools/Conf/tools_def.template I can't see some way to apply options only to hosted or freestanding builds. Apparently that information is not anywhere in the *.inf files, or did I miss something? So back to the approach of adding a #define? take care, Gerd