Skip to content

Linking with ld/gold/rust-lld: unknown -z value: ,relro,-z,now #52634

Closed

Description

@alecmocatta

Compiling with an gcc/ld-like -C linker other than gcc/clang results in the -z,relro,-z,now argument not being recognised.

It seems gcc and clang accept the argument -Wl,-z,relro,-z,now where other ld-like linkers expect -z relro -z now.

working:

"-C linker=gcc"
"-C linker=clang"

not working:

"-C linker=ld -Z linker-flavor=ld"
ld: warning: -z ,relro,-z,now ignored.

"-C linker=gold -Z linker-flavor=ld"
gold: ,relro,-z,now: unknown -z option

"-C linker=rust-lld -Z linker-flavor=ld.lld"
rust-lld: error: unknown -z value: ,relro,-z,now

Activity

  1. alexcrichton commented on Jul 23, 2018

    @alexcrichton
    Member

    Thanks for the report! I believe the bug is here where we actually need to use multiple invocations of linker_arg for each argument rather than packing them all in one. If you're curious, want to test out a patch doing that locally and see if it works for you?

  2. alecmocatta commented on Jul 23, 2018

    @alecmocatta
    ContributorAuthor

    I suspected the same. Will PR shortly.

  3. added a commit that references this issue on Jul 25, 2018
    b4b7681
  4. added a commit that references this issue on Jul 26, 2018
    9f91195
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions