https://sourceware.org/bugzilla/show_bug.cgi?id=19440

--- Comment #2 from awson <kyrab at mail dot ru> ---
Hmm, I've looked into BFD code and have seen several

'in->n_scnum = H_GET_16 (abfd, ext->e_scnum);'
and
'H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);'

constructs here and there (for example in coffswap.h), where 'e_scnum' is also
defined as 'char e_scnum[2]' in external_syment structure.

I suspect at least in 'in->n_scnum' we can leave a garbage in high 2 bytes (if
they are not initialized to zeros).

I wonder how it all ever worked for me then.

The problem is that I don't know BFD internals/architecture.

I guess, while 'internal_syment' is internal representation of a symbol entry,
'external_syment' is it's physical layout in a COFF file.

Thus, I suspect, we have 2 avenues here:

1. To revert my patch (but, perhaps, still replace 'short' with 'unsigned
short' for 'n_scnum' if this indeed is a correct spec for generic COFF) *and*
introduce correct 'internal_syment' for bigobj COFF format (now bigobj uses
it's own version of 'external_syment' with 'char e_scnum[4]', but generic
version of 'internal_syment' with 'short n_scnum' which is an obvious bug). But
I'm not sure I quite understand how to do this respecting BFD code structure
(all those numerous '#define's).

2. To keep my patch but modify somewhat generic (and, perhaps, some other) coff
swapping code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to