foss-for-synopsys-dwc-arc-processors/toolchain

Linker fails silently

BrunoASMauricio opened this issue · 2 comments

When linking against metaware libraries (-lmw) using hs5x, the GNU linker errors out silently.

After a brief investigation, this seems to happen because the metaware objects have incompatible ARC.attributes.

The Metaware objects have Tag_ARC_CPU_base set to 5 for hs5x and 6 for hs6x while GCC has 0 for both.

This immediately leads to a "bfd assert" since out_attr[i].i is 5

unsigned opcode_map[] = {0, ARC_OPCODE_ARC600, ARC_OPCODE_ARC700, ARC_OPCODE_ARCv2EM, ARC_OPCODE_ARCv2HS};

BFD_ASSERT (in_attr[i].i < (sizeof (opcode_map) / sizeof (unsigned)));
BFD_ASSERT (out_attr[i].i < (sizeof (opcode_map) / sizeof (unsigned)));

Initial fix done in https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/tree/bruno_ARC_attributes doesn't provide backwards compatibility.
In sum, we have been using the same value for hs5x and hs6x. When differentiating we need different flags which cause binary backwards compatibility to break.
@claziss need your two cents on this.