From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE525C6FD1E for ; Wed, 8 Mar 2023 16:18:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 378D985D4E; Wed, 8 Mar 2023 17:18:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="BjlHbOyp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D14E585D4E; Wed, 8 Mar 2023 17:18:38 +0100 (CET) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6D62A85D38 for ; Wed, 8 Mar 2023 17:18:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x831.google.com with SMTP id c19so18557821qtn.13 for ; Wed, 08 Mar 2023 08:18:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1678292314; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eq2UxoobiAOB1FLxD+rnWuBn+vUMAiNVmGw0MlO5yTk=; b=BjlHbOypmdzekbW7DoRDWNPg0+u9TFjfRC7GP9BrctoonYLoWN3GC/zGIcAPFDTrZL C0p7ATqbnAZFzjt95fBtx8in7klh30Pcz2N2f3zqmtNaFsNO/IAuBf4CKYaFZiXuNlfu KJhmC5+hzTSmxudnl8lKxb68RW74UZytYC/Wc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678292314; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eq2UxoobiAOB1FLxD+rnWuBn+vUMAiNVmGw0MlO5yTk=; b=32IuGVz0jAe4KZiEdumKUZehChV+Sf7/IMSJyHcHMGDtpIY38nLR169S95TLhmLWef k7cNDXHiR+1lZS+4o6/w1lahHd5qzvwJiuTpo6NY51pQ+VIINEpawQy752kTHMEMbD2b iysc9vAa727XHZZ3YGgjzz5C5TMYEGkAUbqVFXwiPNuXTNy6J3zz+V1zuCJW0ZuhIALd 0IzKg5yYFH0lj0969tF9zfMNDDZ1JP0Cl1SLqe29fjS1y+5I2RsTetVaqCGUe2Iv3Ewb Bmge2fUGvACmgaZFA0SnoQPBWYOiuVHNuB6+2rY/XA/6ErwzP3L9W5N1uKrT9jlE/yzG aHQg== X-Gm-Message-State: AO0yUKVKKMYYzU4hsbnQ3E3DkfhQsf+dMZv3d6pO/7tDIsxGvBRMM7Vy frf+4TWCIBT79IvE+tX6+xWdJw== X-Google-Smtp-Source: AK7set9nQtl4mlnGfo1ojGmu+MSkic0hChorCjqfbw58CKwupA+7O5ss5cgL+KCAsrAIImecmhpn7A== X-Received: by 2002:ac8:5acf:0:b0:3ba:1c07:e472 with SMTP id d15-20020ac85acf000000b003ba1c07e472mr32062169qtd.51.1678292314108; Wed, 08 Mar 2023 08:18:34 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-0000-0000-0000-036b.res6.spectrum.com. [2603:6081:7b00:6400::36b]) by smtp.gmail.com with ESMTPSA id 203-20020a3708d4000000b0073b8512d2dbsm11649476qki.72.2023.03.08.08.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 08:18:33 -0800 (PST) Date: Wed, 8 Mar 2023 11:18:32 -0500 From: Tom Rini To: Heinrich Schuchardt Cc: Ilias Apalodimas , U-Boot Mailing List Subject: Re: qemu_arm_defconfig with LTO fails due to unaligned access Message-ID: <20230308161832.GF968799@bill-the-cat> References: <783cfab5-feb0-1148-f4be-125195275c98@gmx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Shs6FxS6BNHtKb5P" Content-Disposition: inline In-Reply-To: <783cfab5-feb0-1148-f4be-125195275c98@gmx.de> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean --Shs6FxS6BNHtKb5P Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 08, 2023 at 05:12:26AM +0100, Heinrich Schuchardt wrote: > Hello Ilias, hello Tom, >=20 > Tom tried to run qemu_arm_defconfig with CONFIG_LTO=3Dy in gitlab. This > failed as shown in protocol > https://source.denx.de/u-boot/u-boot/-/jobs/589913/raw >=20 > Executing 'HII database protocols' > test_hii_database_new_package_list: > data abort > pc : [<7ff39b98>] lr : [<7ff87328>] > reloc pc : [<00000b98>] lr : [<0004e328>] > sp : 7edf8cc0 ip : 0000000c fp : 7ffe60ec > r10: 00000000 r9 : 7eef8eb0 r8 : 7ffe0d02 > r7 : 00000000 r6 : 7ef0f8c8 r5 : 7ffe0cf0 r4 : 7ffe0cb4 > r3 : 7ffe0cef r2 : 00000000 r1 : ffffffff r0 : 00000000 > Flags: nzcv IRQs off FIQs off Mode SVC_32 > Code: e2403002 e3a00000 e1500001 012fff1e (e1f320b2) > UEFI image [0x00000000:0xffffffff] '/\selftest' > Resetting CPU .. >=20 > Debugging shows: >=20 > efi_hii_sibt_string_ucs2_block_next() calls u16_strnlen() for an > unaligned u16 string. Here "ldrh r2, [r3, #2]!" is executed for > unaligned r3. This should be allowable for SCTLR.A =3D 0. >=20 > When the crash occurs SCRLR has value 0xc5187f. SCTLR.A is bit 1 with > value 1. >=20 > The implementation of allow_unaligned() in > arch/arm/cpu/armv7 /sctlr.S should have set the flag to 0. > arch/arm/cpu/armv7/sctlr.S is compiled (as demonstrated by adding #error > to the code). >=20 > If I remove the weak implementation of allow_unaligned() in > lib/efi_loader/efi_setup.c, the error does not occur. >=20 > Shouldn't building with LTO ignore the weak implementation? >=20 > If I add a printf() statement to the weak implemenation, the printf() > command is not executed but >=20 > SCTLR 0xc5187d, SCTLR.A=3D0 >=20 > The test passes as unaligned access is allowable. >=20 > I was building inside the Docker image with the GCC downloaded by > buildman (gcc-12.2.0-nolibc/arm-linux-gnueabi). >=20 > To me this looks like a compiler issue. Interesting, yes. It seems like it shouldn't be too hard to come up with a condensed example where the assembly function isn't used but instead the weak C function is. And as a work-around, re-doing the code so that path_to_uefi() just checks for ARM && !ARM64 before calling allow_unaligned() and not doing the weak function trick should also be fine. --=20 Tom --Shs6FxS6BNHtKb5P Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmQItVQACgkQFHw5/5Y0 tyytUgv+K/q4HeVkh2Usk1kt/9hY5oNz1z1RP/A752TmL6a2Me3pkcbs/POE/25z bmMonVwHDjC8+pIuL40dHX70YIz1nlqN9492vBW/ncGFZjuJfgx70EZl3D1FzKF7 5fQGgOJJFbNBCFPh6GnAyT0/8pxDHFsFeKuNOpjHG7k0FytMScQgXQF0LYFFnfiE FPOmk8+FnozjpZ4T5F/MQ7ApyxCMn56exwNDhOOeMYbIqbjav1rRZMjJuamtVAKy t2Dxjt5UDFvJHiOF4bfVNZ4cQyoEwJ0+Vqnlh7eodKKuJ0D1RUzwd+IsCjqI4j7S 1SOQVJ1lHhxl8Kjt0jp8hZaLmPlDIm+KMMZWmRNCzV5+r69QHyEAbyNtvYA5ryqm 1yT2gJCpel37yitwMp1U0EKGemMGhkp1Z/TejU4zFESSNRrl76sit4SM2KxFD8OR 5jBXEMsRNc28pIFvZOmGE2Ugra5yxLEU3a5+wYkQ2wki4IEC6Ltu8/naNOSNnD+k MzIVdknE =WaQZ -----END PGP SIGNATURE----- --Shs6FxS6BNHtKb5P--