Re: swsusp.S: meaningfull assembly labels
From: Richard B. Johnson
Date: Fri Jun 25 2004 - 11:04:06 EST
On Fri, 25 Jun 2004, Daniel Jacobowitz wrote:
> On Fri, Jun 25, 2004 at 08:37:45AM -0400, Richard B. Johnson wrote:
> > NO! You just made those labels public! The LOCAL symbols need to
> > begin with ".L". Now, if you have a 'copy_loop' in another module,
> > linked with this, anywhere in the kernel, they will share the
> > same address -- not what you expected, I'm sure! The assembler
> > has some strange rules you need to understand. Use `nm` and you
> > will find that your new labels are in the object file!
> Er, no. They'll show up in the object file. That doesn't mean they're
> global; static symbols also show up in the object file.
> Daniel Jacobowitz
I got caught on these, thinking that they weren't globals when
I made a assembly files that used, not only named labels but
also definitions like:
BUF = 0x08
LEN = 0x0c
code: movl BUF(%esp), %ebx
movl LEN(%esp), %ecx
This was done in several files. When linked, I got 'duplicate synbol'
errors. These symbols, while not 'globals' in the sense that 'C'
code can link with them are global definitions that are seen by
the linker and cause duplicate symbol errors. I went through
the gas documentation, trying to find how to prevent these
private symbols from being written to the object file and there
is no command-line mechanism. You just have to start every name
with .L to keep them local.
When I used labels like 'code' above, even though not declared
'.global', the labels also showed up as duplicate symbols when
linking the resulting object files.
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/