This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 0/2] Fix several mix up between octets and bytes in ELF program headers


On Sun, Feb 23, 2020 at 10:07:50AM +0100, Christian Eggers wrote:
> Conclusion: Conversion of elf_internal_sym::st_value from bytes to octets looks
> possible, but may discover some currently undefined behavior. Simply converting
> everything from bytes to octets in elf_swap_symbol_in/out() could be a shortcut
> as currently all non-zero symbol values are in bytes. But doing so would be
> inconsistent to my proposed change for r_offset and r_addend, so I would try
> the "hard" way.

Symbols are a real problem, not because of some implementation detail,
but because you don't know the units of st_value.  A symbol defined as
a label on a line of assembly holds an address, but for example a
symbol defined by
  sym = 123
could be a size in octets, an address, or just a plain number.

I think that if you decide that symbol values should always be octets,
then you'll eventually come to the conclusion that addresses in the
assembler need to be octets too.  And then it's just easier to
dispense with octets_per_byte.

So if you're going to keep octets per byte of 2, I wouldn't be trying
to convert any symbol values.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]