From: Christian Eggers <ceggers@gmx.de>
To: Alan Modra <amodra@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH v3 0/2] Fix several mix up between octets and bytes in ELF program headers
Date: Sun, 23 Feb 2020 18:35:00 -0000 [thread overview]
Message-ID: <15367374.l5TCXVdO3P@zbook-opensuse.wgnetz.xx> (raw)
In-Reply-To: <20200220012952.GW5570@bubble.grove.modra.org>
And now the debug information:
Currently, expressions within the debug sections are resolved either to octets
or to bytes (depending on SEC_ELF_OCTETS of the symbol in the expression).
This happens within GAS, so these expression will not appear as external
symbols nor relocations.
Example 1:
TC_DWARF2_EMIT_OFFSET (section_symbol (info_seg), sizeof_offset);
resolves to octets as info_seg belongs to the .debug_info section which has
SEC_ELF_OCTETS set
Example 2:
/* DW_AT_high_pc */
...
exp.X_add_symbol = all_segs->text_end;
resolves to bytes as the .text section has no SEC_ELF_OCTETS set
The proposed change is that expressions / fixes with symbols of a non
SEC_ELF_OCTETS section...
- resolve to octets if the expression appears in a SEC_ELF_OCTETS section
- resolve to bytes if the expression appears inside another section
So the result of a fix must be multiplied with octets_per_byte if the symbol
value is bytes (e.g. !(S_IS_OCTETS (fixP->fx_addsy))) and the section of the
fix has SEC_ELF_OCTETS set. Possibly this could be done in fixup_segment()
when calling md_apply_fix().
As an alternative approach, the conversion from bytes to octets could be
"manually" triggered by setting a new flag inside expressionS / fixS, which
can be checked in fixup_segment().
- out_debug_line():
+ process_entries(): Needs 3 conversions
+ out_set_addr(): No changes
+ emit_expr()
- out_debug_ranges(): No changes
+ emit_expr()
- out_debug_aranges(): No changes
+ emit_expr()
- out_debug_abbrev(): No changes
- out_debug_str(): No changes (already octets)
- out_debug_info(): No changes
+ emit_expr()
Conclusion: In order to change debug information from bytes to octets, it
should be sufficient to perform a conversion for the generated debug line
info. Additionally, fixes applied within SEC_ELF_OCTETS sections may need
conversion to octets if the symbol value resolved to bytes.
If I could get some feedback for the proposed changes to r_offset, r_added,
st_value and debug_info, I would implement the changes soon. I hope that
together with my previous patches, the octets/bytes topic can be closed then.
Regards
Christian
prev parent reply other threads:[~2020-02-23 18:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-15 19:37 Christian Eggers
2020-02-16 8:22 ` Christian Eggers
2020-02-16 19:37 ` Christian Eggers
2020-02-20 1:30 ` Alan Modra
2020-02-22 16:32 ` Christian Eggers
2020-02-22 21:08 ` Christian Eggers
2020-02-23 9:07 ` Christian Eggers
2020-02-27 8:35 ` Alan Modra
2020-03-07 21:05 ` Christian Eggers
2020-02-23 18:35 ` Christian Eggers [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=15367374.l5TCXVdO3P@zbook-opensuse.wgnetz.xx \
--to=ceggers@gmx.de \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.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).