https://sourceware.org/bugzilla/show_bug.cgi?id=26556
Bug ID: 26556 Summary: relax_segment calculates incorrect target frag when OCTETS_PER_BYTE > 1 Product: binutils Version: 2.34 Status: UNCONFIRMED Severity: minor Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: tuckkern+sourceware at gmail dot com Target Milestone: --- Created attachment 12810 --> https://sourceware.org/bugzilla/attachment.cgi?id=12810&action=edit Possible patch The case statement handling rs_org in write.c around line 2937 does not appear to calculate the correct target fragment address when OCTETS_PER_BYTE > 1 It only applies OCTETS_PER_BYTE scaling to the symbol value, but not the offset. The end result is symbols in .bss with overlapping addresses. e.g. from readelf - array_ has a size of 4, but var_ is located at address 2 Num: Value Size Type Bind Vis Ndx Name 5: 00000000 4 OBJECT LOCAL DEFAULT 4 array_ 6: 00000002 1 OBJECT LOCAL DEFAULT 4 var_ The attached patch is a possible fix, but II am unsure if this is the correct place to address the issue or if there is another root cause. Using the above patch the symbol table now looks like so: Num: Value Size Type Bind Vis Ndx Name 5: 00000000 4 OBJECT LOCAL DEFAULT 4 array_ 6: 00000004 1 OBJECT LOCAL DEFAULT 4 var_ -- You are receiving this mail because: You are on the CC list for the bug.