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

Avoid leaking LFS flags to reverse dependencies #1730

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

afq984
Copy link
Contributor

@afq984 afq984 commented Jan 5, 2024

Follow up of #1725.

defines propagates to reverse dependencies, while local_defines don't. If we use defines then there's risk of ODR violation:

Suppose a user have a cc_library foo that depends on bar and benchmark:

cc_library(name = "foo", deps = [":bar", "@com_github_google_benchmark//:benchmark"])

And bar has a class that has LFS-dependant ABI:

cc_library(name = "foo")

class Bar {
    off_t member;
};

Bar would be compiled without LFS, but linked to foo when assuming LFS is enabled.

So we limit LFS to within the library only. benchmark does not have LFS dependant public ABIs so it should be fine.

Follow up of google#1725.

`defines` propagates to reverse dependencies, while `local_defines`
don't. If we use `defines` then there's risk of ODR violation:

Suppose a user have a cc_library foo that depends on bar and benchmark:

    cc_library(name = "foo", deps = [":bar", "@com_github_google_benchmark//:benchmark"])

And bar has a class that has LFS-dependant ABI:

    cc_library(name = "foo")

    class Bar {
        off_t member;
    };

Bar would be compiled without LFS, but linked to foo when assuming LFS is enabled.

So we limit LFS to within the library only. benchmark does not have
LFS dependant public ABIs so it should be fine.
@dmah42 dmah42 merged commit 07c98d5 into google:main Jan 5, 2024
80 checks passed
@dmah42
Copy link
Member

dmah42 commented Jan 5, 2024

great spot. thank you.

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.

2 participants