This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

RFC: coffread.c relocation fixes


When a shared object can't be loaded at its preferred image base, it
gets relocated. There's a convoluted switch statement in
coff_symtab_read that handles relocation of the symbols, and I believe
it handles a couple of cases incorrectly:

o Static symbols (with c_sclass of C_STAT) never get relocated. I
think this is wrong, probably an oversight where the C_STAT cases fall
through to the C_EXT case and then don't get handled.

o Absolute symbols (with c_secnum of N_ABS) *do* get relocated, so
things like __minor_os_version__ get adjusted by the relocation
offset. Curiously, there is a fixme comment in the code not to do
this.

The attached exmple shows the problem in action and the attached diffs
fix both problems. Do these changes seem sensible to others?

Regards,
Raoul Gough.

Attachment: ChangeLog_entry.txt
Description: Text document

Attachment: coffread.c.diff.txt
Description: Text document

Attachment: example3.txt
Description: Text document


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