Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional_linker_inputs option to cc_library rule #18952

Closed
wants to merge 1 commit into from
Closed

Add additional_linker_inputs option to cc_library rule #18952

wants to merge 1 commit into from

Conversation

nicholasjng
Copy link
Contributor

This is achieved by the following related changes:

  1. Moving the additional_linker_inputs attribute up from the cc_binary_base rule to the cc_rule. The rationale here is that any rule that allows linkopts to be set should also support additional_linker_inputs.

  2. Adding the additional_linker_inputs attr to the cc_library rule context. This was copied verbatim from the existing cc_binary attribute list.

  3. Appending the ctx.files.additional_linker_inputs list to the list of linker scripts wherever they are passed as additional_inputs in the cc_library.bzl builtin file corresponding to the cc_library rule.


For context on this PR, see issue #17788 as well as the original Google group discussion, which inspired the feature request.

Resolves #17788.

@nicholasjng nicholasjng changed the title feat: Add additional_linker_inputs option to cc_library rule Add additional_linker_inputs option to cc_library rule Jul 16, 2023
@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Jul 16, 2023
@sgowroji sgowroji added the team-Rules-CPP Issues for C++ rules label Jul 17, 2023
nicholasjng added a commit to nicholasjng/benchmark that referenced this pull request Jul 20, 2023
This change needs bazelbuild/bazel#18952 to be
merged first. Fixes macOS linkage of GBM's nanobind bindings on macOS by
supplying a linker response file instead of `-undefined dynamic_lookup`.

The latter has since been deprecated on macOS.
This is achieved by the following related changes:

1) Moving the `additional_linker_inputs` attribute up from the `cc_binary_base`
rule to the `cc_rule`. The rationale here is that any rule that allows `linkopts`
to be set should also support `additional_linker_inputs`.

2) Adding the `additional_linker_inputs` attr to the `cc_library` rule context.
This was copied verbatim from the existing `cc_binary` attribute list.

3) Appending the `ctx.files.additional_linker_inputs` list to the list of
linker scripts wherever they are passed as `additional_inputs` in the `cc_library.bzl`
builtin file corresponding to the `cc_library` rule.
@buildbreaker2021 buildbreaker2021 self-assigned this Aug 16, 2023
@buildbreaker2021 buildbreaker2021 added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Aug 16, 2023
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Aug 16, 2023
@brentleyjones
Copy link
Contributor

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Aug 16, 2023
@iancha1992
Copy link
Member

iancha1992 commented Aug 16, 2023

@brentleyjones I just want to make sure since google/benchmark#1636 was mentioned.. Do we want this to be part of release-6.4.0 or some other release?

cc: @bazelbuild/triage

@brentleyjones
Copy link
Contributor

I believe this is an additive change and can go into 6.4.0. Do you agree @nicholasjng?

@nicholasjng
Copy link
Contributor Author

I believe this is an additive change and can go into 6.4.0. Do you agree @nicholasjng?

Fully agreed, would appreciate to see this in 6.4.0 if possible

@iancha1992
Copy link
Member

@bazel-io fork 6.4.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Aug 16, 2023
iancha1992 pushed a commit to iancha1992/bazel that referenced this pull request Aug 16, 2023
This is achieved by the following related changes:

1) Moving the `additional_linker_inputs` attribute up from the `cc_binary_base` rule to the `cc_rule`. The rationale here is that any rule that allows `linkopts` to be set should also support `additional_linker_inputs`.

2) Adding the `additional_linker_inputs` attr to the `cc_library` rule context. This was copied verbatim from the existing `cc_binary` attribute list.

3) Appending the `ctx.files.additional_linker_inputs` list to the list of linker scripts wherever they are passed as `additional_inputs` in the `cc_library.bzl` builtin file corresponding to the `cc_library` rule.

----------------------

For context on this PR, see issue bazelbuild#17788 as well as the original [Google group discussion](https://groups.google.com/g/bazel-discuss/c/1VFvNBDqzVU/m/F5UmYO-RAAAJ), which inspired the feature request.

Resolves bazelbuild#17788.

Closes bazelbuild#18952.

PiperOrigin-RevId: 557505297
Change-Id: I4811b60e102c6426697efcb202296fe77a3d5f25
iancha1992 added a commit that referenced this pull request Aug 22, 2023
…19264)

This is achieved by the following related changes:

1) Moving the `additional_linker_inputs` attribute up from the
`cc_binary_base` rule to the `cc_rule`. The rationale here is that any
rule that allows `linkopts` to be set should also support
`additional_linker_inputs`.

2) Adding the `additional_linker_inputs` attr to the `cc_library` rule
context. This was copied verbatim from the existing `cc_binary`
attribute list.

3) Appending the `ctx.files.additional_linker_inputs` list to the list
of linker scripts wherever they are passed as `additional_inputs` in the
`cc_library.bzl` builtin file corresponding to the `cc_library` rule.

----------------------

For context on this PR, see issue #17788 as well as the original [Google
group
discussion](https://groups.google.com/g/bazel-discuss/c/1VFvNBDqzVU/m/F5UmYO-RAAAJ),
which inspired the feature request.

Resolves #17788.

Closes #18952.

Commit
0589995

PiperOrigin-RevId: 557505297
Change-Id: I4811b60e102c6426697efcb202296fe77a3d5f25

Co-authored-by: Nicholas Junge <nicholas.junge@web.de>
nicholasjng added a commit to nicholasjng/benchmark that referenced this pull request Oct 23, 2023
This change needs bazelbuild/bazel#18952 to be
merged first. Fixes macOS linkage of GBM's nanobind bindings on macOS by
supplying a linker response file instead of `-undefined dynamic_lookup`.

The latter has since been deprecated on macOS.
nicholasjng added a commit to nicholasjng/benchmark that referenced this pull request Oct 23, 2023
This change needs bazelbuild/bazel#18952 to be
merged first. Fixes macOS linkage of GBM's nanobind bindings on macOS by
supplying a linker response file instead of `-undefined dynamic_lookup`.

The latter has since been deprecated on macOS.
dmah42 pushed a commit to google/benchmark that referenced this pull request Oct 24, 2023
* Change nanobind linkage to response file approach

This change needs bazelbuild/bazel#18952 to be
merged first. Fixes macOS linkage of GBM's nanobind bindings on macOS by
supplying a linker response file instead of `-undefined dynamic_lookup`.

The latter has since been deprecated on macOS.

* Fix bazel_skylib checksum, bump skylib version in MODULE.bazel

* Bump Bazel to version 6.4.0 for linker response file support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cc_library rule should support additional_linker_inputs option
6 participants