From: Daniel Jacobowitz <dan@debian.org>
To: "Richard B. Johnson" <root@chaos.analogic.com>
Cc: Pavel Machek <pavel@ucw.cz>, Andrew Morton <akpm@zip.com.au>,
kernel list <linux-kernel@vger.kernel.org>,
Patrick Mochel <mochel@digitalimplant.org>
Subject: Re: swsusp.S: meaningfull assembly labels
Date: Fri, 25 Jun 2004 14:48:18 -0400 [thread overview]
Message-ID: <20040625184817.GA3939@nevyn.them.org> (raw)
In-Reply-To: <Pine.LNX.4.53.0406251152580.28750@chaos>
On Fri, Jun 25, 2004 at 12:02:47PM -0400, Richard B. Johnson wrote:
> 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
Those are what gas calls absolute symbols.
> 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.
Does this only happen in your world? Or were you using a broken
non-GNU linker?
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.
--
Daniel Jacobowitz
next prev parent reply other threads:[~2004-06-25 18:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-25 11:59 swsusp.S: meaningfull assembly labels Pavel Machek
2004-06-25 12:37 ` Richard B. Johnson
2004-06-25 15:18 ` Daniel Jacobowitz
2004-06-25 16:02 ` Richard B. Johnson
2004-06-25 18:48 ` Daniel Jacobowitz [this message]
2004-06-25 19:29 ` Richard B. Johnson
2004-06-25 19:39 ` Patrick Mochel
2004-06-25 16:10 ` Pavel Machek
2004-06-25 17:24 ` Richard B. Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040625184817.GA3939@nevyn.them.org \
--to=dan@debian.org \
--cc=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@digitalimplant.org \
--cc=pavel@ucw.cz \
--cc=root@chaos.analogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox