From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756810AbbJATPK (ORCPT ); Thu, 1 Oct 2015 15:15:10 -0400 Received: from bes.se.axis.com ([195.60.68.10]:46680 "EHLO bes.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756661AbbJATPG (ORCPT ); Thu, 1 Oct 2015 15:15:06 -0400 Date: Thu, 1 Oct 2015 21:15:03 +0200 From: Jesper Nilsson To: Chen Gang Cc: Mikael Starvik , Jesper Nilsson , Hans-Peter Nilsson , linux-cris-kernel , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3] cris: arch-v10: kgdb: Add '__used' for static variable is_dyn_brkp Message-ID: <20151001191502.GF4919@axis.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 06, 2015 at 12:34:53AM +0200, Chen Gang wrote: > Within one C file, current gcc can optimize the global static variables > according to the C code, but it will skip assembly code -- it will pass > them to gas directly. > > if the static variable is used between C code and assembly code in one C > file (e.g. is_dyn_brkp in kgdb.c), it needs '__used' to let gcc know it > should be still used, or gcc may remove it for optimization. > > The related error in this case: > > LD init/built-in.o > arch/cris/arch-v10/kernel/built-in.o: In function `kgdb_handle_breakpoint': > (.text+0x2aca): undefined reference to `is_dyn_brkp' > arch/cris/arch-v10/kernel/built-in.o: In function `is_static': > kgdb.c:(.text+0x2ada): undefined reference to `is_dyn_brkp' > > Signed-off-by: Chen Gang Added to the cris tree, thanks! /^JN - Jesper Nilsson -- Jesper Nilsson -- jesper.nilsson@axis.com