public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nancy <nancydreaming@gmail.com>
To: Michael Matz <matz@suse.de>
Cc: gcc@gcc.gnu.org
Subject: Re: Who generate .rela.debug_info?
Date: Tue, 19 Dec 2017 14:01:00 -0000	[thread overview]
Message-ID: <CADdyJm=XOxuCZosQFx+UnFxE+8EgzO77Zu6W2ngW6rLX8pavtg@mail.gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.21.1712181947280.25295@wotan.suse.de>

>> I can't find any code in cc1 or as that generate R_X86_64_DTPOFF32 in
>> .rela.debug_info section. Did I miss something?
>
> To expand on what Nathan said: the debug info needs to refer to the
> location of the variable 'i' somehow, and as it's a TLS variable that
> location is thread specific as well, and so the normal data relocations
> can't be used.  So the dwarf info contains a location expression that uses
> this relocation and a GNU extension to push the tls address into the
> expression stack.  See e.g. the verbose asm output for the above file, the
> DIE for 'i' will contain something like this:
>
>         .uleb128 0x2    # (DIE (0x1d) DW_TAG_variable)
>         .ascii "i\0"    # DW_AT_name
>         .byte   0x1     # DW_AT_decl_file (x.c)
>         .byte   0x1     # DW_AT_decl_line
>         .long   0x31    # DW_AT_type
>                         # DW_AT_external
>         .uleb128 0xa    # DW_AT_location
>         .byte   0xe     # DW_OP_const8u
>         .long   i@dtpoff, 0
>         .byte   0xe0    # DW_OP_GNU_push_tls_address
>
> The 'i@dtpoff' is the field that causes the DTPOFF32 relocation to be
> created by the assembler.

My understand, .debug_info is generated by compiler, and that is quite
format, DIE entry, TAG, Attributes
<c1>   DW_AT_location    : 10 byte block: e 0 0 0 0 0 0 0 0 e0
(DW_OP_const8u: 0 0; DW_OP_GNU_push_tls_address or DW_OP_HP_unknown)

How ".long   i@dtpoff, 0" generated in .debug_info???  I mean that is
not that format. How it stored in DIE format?  Do you mean it not in
DIE entry, but in ASM pass adds ".long   i@dtpoff, 0" to .s, only
store in .s?

-- 
Best Regards,
Yu Rong Tan

      reply	other threads:[~2017-12-19 14:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 13:57 Nancy
2017-12-18 14:12 ` Nathan Sidwell
2017-12-19 13:53   ` Nancy
2017-12-19 13:59     ` Andreas Schwab
2017-12-19 14:03     ` Nathan Sidwell
2017-12-21 11:27       ` Nancy
2017-12-18 18:50 ` Michael Matz
2017-12-19 14:01   ` Nancy [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='CADdyJm=XOxuCZosQFx+UnFxE+8EgzO77Zu6W2ngW6rLX8pavtg@mail.gmail.com' \
    --to=nancydreaming@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=matz@suse.de \
    /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).