Skip to content

Conversation

squeek502
Copy link
Member

@squeek502 squeek502 commented Mar 28, 2020

  • --export-dynamic not getting set via -rdynamic in the ELF linker construction seems to have been a bug? Correct me if I'm wrong, or if -rdynamic should be handled in any of the other linker formats (right now ZigLLVM_MachO sends -export_dynamic and with this PR ZigLLVM_ELF sends --export-dynamic; ZigLLVM_Wasm and ZigLLVM_COFF ignore -rdynamic).
  • As far as I can tell, -rdynamic and -Wl,--export-dynamic are essentially the same thing with regards to Zig. The difference in other compilers is that -rdynamic doesn't set --export-dynamic if it doesn't need to for the target? If so, it seems like Zig would probably want to treat the --export-dynamic linker flag the same as -rdynamic (hence why I made the --export-dynamic linker flag set rdynamic = true in zig cc instead of adding a separate export_dynamic field).

Contributes towards #4784


EDIT:

This is meant to fix warning: unsupported linker arg: --export-dynamic when doing zig cc -Wl,--export-dynamic or zig cc -Wl,-E (or other ways of passing linker args like --for-linker, but those aren't supported by zig cc yet). Full context is here

return EXIT_FAILURE;
}
dynamic_linker = buf_ptr(linker_args.at(i));
} else if (buf_eql_str(arg, "-E") ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why -E? for a C compiler it means "preprocessor only". I'm hesitant to overload that meaning.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-E is an alias for --export-dynamic in ld/lld. Note that this check is only for linker args (i.e. things passed to zig cc via -Wl).

Copy link
Member Author

@squeek502 squeek502 Mar 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be more clear, since I realized I didn't include this in the OP:

This is meant to fix warning: unsupported linker arg: --export-dynamic when doing zig cc -Wl,--export-dynamic or zig cc -Wl,-E (or other ways of passing linker args like --for-linker, but those aren't supported by zig cc yet). Full context is here

@andrewrk andrewrk merged commit 12e1c6e into ziglang:master Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants