public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lto, watchdog/hpwdt.c: Make assembler label global
@ 2013-08-05 22:16 Andi Kleen
  2013-08-06 20:51 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2013-08-05 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andi Kleen, wim

From: Andi Kleen <ak@linux.intel.com>

We cannot assume that the inline assembler code always ends up
in the same file as the original C file. So make any assembler labels
that are called with "extern" by C global

Cc: wim@iguana.be
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 drivers/watchdog/hpwdt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index de7e4f4..5be5e3d 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -162,7 +162,8 @@ extern asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
 #define HPWDT_ARCH	32
 
 asm(".text                          \n\t"
-    ".align 4                       \n"
+    ".align 4                       \n\t"
+    ".globl asminline_call	    \n"
     "asminline_call:                \n\t"
     "pushl       %ebp               \n\t"
     "movl        %esp, %ebp         \n\t"
@@ -352,7 +353,8 @@ static int detect_cru_service(void)
 #define HPWDT_ARCH	64
 
 asm(".text                      \n\t"
-    ".align 4                   \n"
+    ".align 4                   \n\t"
+    ".globl asminline_call	\n"
     "asminline_call:            \n\t"
     "pushq      %rbp            \n\t"
     "movq       %rsp, %rbp      \n\t"
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lto, watchdog/hpwdt.c: Make assembler label global
  2013-08-05 22:16 [PATCH] lto, watchdog/hpwdt.c: Make assembler label global Andi Kleen
@ 2013-08-06 20:51 ` Andrew Morton
  2013-08-07  4:38   ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2013-08-06 20:51 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, Andi Kleen, wim

On Mon,  5 Aug 2013 15:16:39 -0700 Andi Kleen <andi@firstfloor.org> wrote:

> We cannot assume that the inline assembler code always ends up
> in the same file as the original C file.

um, why not?  You put an asm(".text\n...") into a .c file and you
expect that assembly code to be emitted into the .s file then assembled
into the .o file.

Obviously something somewhere is doing something unexpected.  Much more
detail needed, please.

Also...  what's "lto"?  Link Time Optimization?  It's unclear how this
fits into that.  Please provide that additional background info in these
patches so that others know what's going on and so that others (such as
me) can help people avoid making these mistakes in the future.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lto, watchdog/hpwdt.c: Make assembler label global
  2013-08-06 20:51 ` Andrew Morton
@ 2013-08-07  4:38   ` Andi Kleen
  0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2013-08-07  4:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andi Kleen, linux-kernel, Andi Kleen, wim

On Tue, Aug 06, 2013 at 01:51:18PM -0700, Andrew Morton wrote:
> On Mon,  5 Aug 2013 15:16:39 -0700 Andi Kleen <andi@firstfloor.org> wrote:
> 
> > We cannot assume that the inline assembler code always ends up
> > in the same file as the original C file.
> 
> um, why not?  You put an asm(".text\n...") into a .c file and you
> expect that assembly code to be emitted into the .s file then assembled
> into the .o file.
> 
> Obviously something somewhere is doing something unexpected.  Much more
> detail needed, please.

Sorry this is an extract from my larger LTO patchkit. I didn't fully
adapt the description.

With LTO (yes Link Time Optimization) the compiler repartitions the
individual definitions into new files, so yes the assembler statement
and the rest of the file can end up separated.

> Also...  what's "lto"?  Link Time Optimization?  It's unclear how this
> fits into that.  Please provide that additional background info in these
> patches so that others know what's going on and so that others (such as
> me) can help people avoid making these mistakes in the future.

I catch them by fixing compiler errors in my whole tree (well not
all, only the ones that happen in my setup)

https://github.com/andikleen/linux-misc/commits/lto-3.11

There's much more there, I'm currently just trying extract
some patches and make my pile smaller.

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-07  4:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-05 22:16 [PATCH] lto, watchdog/hpwdt.c: Make assembler label global Andi Kleen
2013-08-06 20:51 ` Andrew Morton
2013-08-07  4:38   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox