From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Laight Subject: Re: [PATCH 02/11] x86: tboot: avoid Wstringop-overread-warning Date: Wed, 24 Mar 2021 10:39:57 +0000 Message-ID: <7e05de6cbb554b09ac532c073fab7386@AcuMS.aculab.com> References: <20210322160253.4032422-1-arnd@kernel.org> <20210322160253.4032422-3-arnd@kernel.org> <20210322202958.GA1955909@gmail.com> <0aa198a1dd904231bcc29454bf19a812@AcuMS.aculab.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <0aa198a1dd904231bcc29454bf19a812@AcuMS.aculab.com> Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: David Laight , 'Martin Sebor' , Ingo Molnar , Arnd Bergmann Cc: "dri-devel@lists.freedesktop.org" , "H. Peter Anvin" , Will Deacon , "linux-scsi@vger.kernel.org" , "x86@kernel.org" , James Smart , "tboot-devel@lists.sourceforge.net" , Ingo Molnar , Kalle Valo , "ath11k@lists.infradead.org" , Serge Hallyn , Arnd Bergmann , "James E.J. Bottomley" , Ning Sun , Anders Larsen , Borislav Petkov , "cgroups@vger.kernel.org" , Thomas Gleixner , "linux-arm-kernel@lists.infradead.org" , Martin Sebor , netde From: David Laight > Sent: 24 March 2021 09:12 > > From: Martin Sebor > > Sent: 22 March 2021 22:08 > ... > > In GCC 11, all access warnings expect objects to be either declared > > or allocated. Pointers with constant values are taken to point to > > nothing valid (as Arnd mentioned above, this is to detect invalid > > accesses to members of structs at address zero). > > > > One possible solution to the known address problem is to extend GCC > > attributes address and io that pin an object to a hardwired address > > to all targets (at the moment they're supported on just one or two > > targets). I'm not sure this can still happen before GCC 11 releases > > sometime in April or May. > > A different solution is to define a normal C external data item > and then assign a fixed address with an asm statement or in > the linker script. Or stop gcc tracking the value by using: struct foo *foo = (void *)xxxxx; asm ("", "+r" (foo)); If the address is used more than once forcing it into a register is also likely to generate better code. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)