Skip to content

[Hexagon] Small data constants cause duplicate symbols #138438

Open
@alexrp

Description

@alexrp

When building the Zig test suite for Hexagon, we see lots of errors like this:

error: ld.lld: duplicate symbol: .CONST_0000000000000100
    note: defined at test
    note:            /home/alexrp/Source/ziglang/zig/.zig-cache/o/8c04f039e5f8745b4f33232b0a957843/test.o:(.gnu.linkonce.l8.CONST_0000000000000100+0x0)
    note: defined at compiler_rt
    note:            /home/alexrp/.cache/zig/o/9c7be22a9275891985506bbdb2ae4ceb/libcompiler_rt.a.o:(.gnu.linkonce.l8.CONST_0000000000000100+0x0) in archive /home/alexrp/.cache/zig/o/9c7be22a9275891985506bbdb2ae4ceb/libcompiler_rt.a
error: ld.lld: duplicate symbol: .CONST_3FF0000000000000
    note: defined at test
    note:            /home/alexrp/Source/ziglang/zig/.zig-cache/o/8c04f039e5f8745b4f33232b0a957843/test.o:(.gnu.linkonce.l8.CONST_3FF0000000000000+0x0)
    note: defined at compiler_rt
    note:            /home/alexrp/.cache/zig/o/9c7be22a9275891985506bbdb2ae4ceb/libcompiler_rt.a.o:(.gnu.linkonce.l8.CONST_3FF0000000000000+0x0) in archive /home/alexrp/.cache/zig/o/9c7be22a9275891985506bbdb2ae4ceb/libcompiler_rt.a

I find the MCSA_Global in these places pretty suspicious:

getStreamer().emitSymbolAttribute(Sym, MCSA_Global);

OutStreamer.emitSymbolAttribute(Sym, MCSA_Global);

Shouldn't these be MCSA_Local? (Note that LLD does not have special support for .gnu.linkonce.*.)

We've worked around this in Zig for now by always disabling the small-data feature, but we'd like to get rid of that hack.

cc @androm3da

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions