Skip to content

redundant linker flag warning is wrong and breaks linking #47989

Closed
@wthrowe

Description

@wthrowe

If one passes the same -lfoo option twice to rustc it warns redundant linker flag specified for library `foo` and ignores the second argument. Linkers are sensitive to the order of their arguments and passing the same argument twice is common and sometimes necessary to get a program to link correctly.

In fact, rustc itself passes the linker (cleaned up a bit) -ldl -lrt -lpthread -lpthread -lgcc_s -lc -lm -lrt -lpthread -lutil -lutil, which includes four "redundant" linker flags (at least two of which are actually redundant, to be fair).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions