Skip to content

Remove problematic quotes in the --undefined-glob linker argument#130

Open
06393993 wants to merge 1 commit into
bazelbuild:mainfrom
06393993:remove_quote
Open

Remove problematic quotes in the --undefined-glob linker argument#130
06393993 wants to merge 1 commit into
bazelbuild:mainfrom
06393993:remove_quote

Conversation

@06393993
Copy link
Copy Markdown
Contributor

The argument with quotes work because bazel use a response file1 to pass the parameters to the linker. When the linker parse the response file, unncessary quotes are removed. But if the parameters are short, and bazel directly calls the linker with the arguments, the extra quotes unexpectedly become part of the pattern that the --undefined-glob argument tries to match. As a result, the linker may strip symbols starting with JNI_ or Java_ unexpectedly.

In addition, it breaks the meson rule from rules_foreign_cc, because meson always passes the arguments to the linker as process arguments directly. And meson's native files/cross files don't support single quote in cpp_link_args anyway2.

The argument with quotes work because bazel use a response file[1] to pass
the parameters to the linker. When the linker parse the response file,
unncessary quotes are removed. But if the parameters are short, and
bazel directly calls the linker with the arguments, the extra quotes
unexpectedly become part of the pattern that the --undefined-glob
argument tries to match. As a result, the linker may strip symbols
starting with JNI_ or Java_ unexpectedly.

In addition, it breaks the `meson` rule from `rules_foreign_cc`, because
`meson` always passes the arguments to the linker as process arguments
directly. And `meson`'s native files/cross files don't support single
quote in `cpp_link_args` anyway[2].

[1]: https://gcc.gnu.org/wiki/Response_Files
[2]: mesonbuild/meson#15573
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.

1 participant