public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Benjamin Burtscher <benjamin.burtscher@gmx.at>
Cc: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: USER_LABEL_PREFIX appear on internal assembler labels
Date: Wed, 15 Jan 2014 01:01:00 -0000	[thread overview]
Message-ID: <CAKOQZ8wrUVFqBYDK0BNPDq91qifxASXqEzQAqsnRDjwMJnmMXw@mail.gmail.com> (raw)
In-Reply-To: <trinity-0fbff6b5-b27a-45d1-9e39-d070028f963c-1389731730516@3capp-gmx-bs33>

On Tue, Jan 14, 2014 at 12:35 PM, Benjamin Burtscher
<benjamin.burtscher@gmx.at> wrote:
>
> I have a problem with internal assembler labels. We use #define USER_LABEL_PREFIX "_" in our i386 config to prefix global symbols.
> This is working, but the problem is that local internal assembler labels like ".L1" also get the prefix ("_.L1"), but not all of them. This produces unresolved symbols at the target.
> The -fleading-underscore switch produces the same problem.
>
> We can’t update to a newer version of GCC at the moment, because we use a third-party target platform.
>
> It would be great If you can tell me the interesting code lines where the problem could be so that I can fix it.
> I have attached 2 backtraces. In the first, the problem appears at a internal label. The second backtrace is the case where it works correctly with a global function.

You've got good backtraces.  You should look at each line in the
backtrace.  It ought to be fairly obvious what you need to change.  To
put it another way, if it's not obvious, you're going to have a lot of
trouble managing a private port of GCC.


> #0  assemble_name_raw (file=0x75182960 <msvcrt!_iob+96>, name=0x28f990 ".L19")
>     at ../../../../src/gcc-4.1.2/gcc/varasm.c:2034
> #1  0x0057148f in output_asm_label (x=<optimized out>) at ../../../../src/gcc-4.1.2/gcc/final.c:3184
> #2  0x00571d58 in output_asm_insn (operands=0x9395a0 <recog_data>,
>     template=0x8042e9 <eliminables.16431+9801> "%+j%C1  %l0") at ../../../../src/gcc-4.1.2/gcc/final.c:3092
> #3  output_asm_insn (template=0x8042e9 <eliminables.16431+9801> "%+j%C1 %l0", operands=0x9395a0 <recog_data>)
>     at ../../../../src/gcc-4.1.2/gcc/final.c:2958
> #4  0x005728c0 in final_scan_insn (insn=0x20e1850, file=0x75182960 <msvcrt!_iob+96>, optimize=0, nopeepholes=0,
>     seen=0x28fc0c) at ../../../../src/gcc-4.1.2/gcc/final.c:2499

For example, for this one you'll see that output_asm_label uses
ASM_GENERATE_INTERNAL_LABEL.  The definition of that is (probably) in
config/elfos.h.  Since ELF normally doesn't use a leading underscore,
there is no label prefix there.  Add a %U to that definition to get
the label prefix.

Ian

      reply	other threads:[~2014-01-15  1:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 20:35 Benjamin Burtscher
2014-01-15  1:01 ` Ian Lance Taylor [this message]

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=CAKOQZ8wrUVFqBYDK0BNPDq91qifxASXqEzQAqsnRDjwMJnmMXw@mail.gmail.com \
    --to=iant@google.com \
    --cc=benjamin.burtscher@gmx.at \
    --cc=gcc-help@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).