[v2,0/9] ELF support for targets with octets_per_byte>1

Message ID 20191121211732.16653-1-ceggers@gmx.de
Headers show
Series
  • ELF support for targets with octets_per_byte>1
Related show

Message

Christian Eggers Nov. 21, 2019, 9:17 p.m.
Changes in v2:
- Add new argument to bfd_octets_per_byte() instead of creating a the
  new function bfd_section_octets_per_byte().
- Convert all calls to bfd_octets_per_byte().
- Fix several style issues.
- Check if OBJ_ELF and OBJ_MAYBE_ELF are defined (GAS).
- Move conditional definition of SEC_OCTETS from dwarf2dbg.c to as.h.

Original patch description follows:
------------------------------------
This patch series replaces my patches from March 2019.

On targets with more than one octet per byte, DWARF-2 information cannot be
stored because DWARF is organized in octets (8 bit) instead of target bytes
(8, 16 or 32 bit). The size of a DWARF section (e.g. .debug_line) may not be
a multiple of a target byte. Additionally relocation offsets can be at a
location which is not aligned to a byte, the same is for relocation symbols.

My patches from March tried to address these issues by aligning relocation
offsets and section sizes to target bytes by inserting fill instructions (for
.debug_line) when GAS generates debug information. Unfortunately this does not
work for DWARF unit tests where debug information is built "by hand" and not
generated by GAS. Additionally the concept of aligning relocations to target
bytes was limited to targets with 2 octets per byte and would not work for
target with more than 2 octets per byte.

This series reverts (most) of the old patches and introduces the concept of
"octet sections". Within these sections, everything is addressed in octets
instead of bytes. In this way also hand crafted DWARF sections in unit tests
will work (already tested for SDMA (WIP, nearly finished)) and this concept
should also do the job for targets with more than 2 octets per byte. "Normal"
targets with one octet per byte should not be affected, only the output of
objdump will show the new "OCTET" section flag.

regards
Christian

P.S. All patches have been automatically encoded "quoted printable" by
"git send-email" and I don't know how to change this. "git am" should be able
to process these patches.

Comments

Alan Modra Nov. 25, 2019, 4:39 a.m. | #1
On Thu, Nov 21, 2019 at 10:17:23PM +0100, Christian Eggers wrote:
> This series reverts (most) of the old patches and introduces the concept of

> "octet sections".


I've committed these as two patches.  We shouldn't commit changes like
that for bfd_octets_per_byte piecemeal since that would leave the
source tree broken between patches.  Speaking of which, I added some
necessary changes to include/coff/ti.h.  I've also fixed a few
remaining formatting nits, and will make a followup patch to fix a few
more issues.

-- 
Alan Modra
Australia Development Lab, IBM
Christian Eggers Nov. 25, 2019, 8:07 a.m. | #2
Dear Alen,

Am Montag, 25. November 2019, 05:39:55 CET schrieb Alan Modra:

> I've committed these as two patches.

thank you very much for spending so much time in repairing my patches.

> We shouldn't commit changes like

> that for bfd_octets_per_byte piecemeal since that would leave the

> source tree broken between patches.

I wasn't sure how to format the inline changelog if the patch spreads over
multiple directories. Now this seems clear for for me.

> Speaking of which, I added some

> necessary changes to include/coff/ti.h.

Unfortunately I didn't realize this although my IDE (Eclipse) showed me this
macros in the call hierarchy. Probably it showed me the wrong location as
several versions of GET_SCNHDR_SIZE() exist at multiple locations.

> I've also fixed a few

> remaining formatting nits, and will make a followup patch to fix a few

> more issues.

Looks like your followup patch was at least the same effort as my patch...

I'll try no to repeat the same mistakes for my next patches.
Btw: Do you think a sending-patches.txt would be useful for binutils?

regards
Christian