Re: swsusp.S: meaningfull assembly labels

From: Patrick Mochel
Date: Fri Jun 25 2004 - 14:40:05 EST



> > drow@nevyn:~% cat a.s
> > BUF = 0x1
> > code:
> > mov %eax, 0
> > drow@nevyn:~% as -o a.o a.s
> > drow@nevyn:~% as -o b.o a.s
> > drow@nevyn:~% ld -o a a.o b.o
> > ld: warning: cannot find entry symbol _start; defaulting to 0000000008048074
> > drow@nevyn:~% nm a.o
> > 00000001 a BUF
> > 00000000 t code
> > drow@nevyn:~% nm a
> > 00000001 a BUF
> > 00000001 a BUF
> > 08049084 A __bss_start
> > 08049084 A _edata
> > 08049084 A _end
> > 08048074 t code
> > 0804807c t code
> >
> > LD won't even warn about duplicate absolute symbols unless they have
> > different values.
> >
>
> But they ARE different values. They will probably always be different
> values, and they end up with the same name, that `ld` sees and complains.

No, it doesn't complain, that's the point. According to nm(1):

For each symbol, nm shows:

The symbol value, in the radix selected by options
(see below), or hexadecimal by default.

The symbol type. At least the following types are
used; others are, as well, depending on the object
file format. If lowercase, the symbol is local; if
uppercase, the symbol is global (external).

Symbols in a source file that are static are tagged with a 't' as well.
Read System.map for more proof of this.

The patch is fine, especially since I think it's based on something I've
posted in the past. :) The one thing I'd always done differently, though,
was to prefix the labels with '.', since I thought that was what kept it
local. But, after I RTFM'd, I find that's not even necessary.


Pat
-
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/