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

build: More sizeopt fixes #23996

Merged
merged 2 commits into from
Nov 15, 2022
Merged

build: More sizeopt fixes #23996

merged 2 commits into from
Nov 15, 2022

Conversation

alyssawilk
Copy link
Contributor

Signed-off-by: Alyssa Wilk alyssar@chromium.org

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Contributor Author

cc @jpsim

@alyssawilk
Copy link
Contributor Author

I assume if we did this we could remove release-common in E-M bazelrc and do custom options in build:release-ios and build:release-android, WDYT?

@jpsim
Copy link
Contributor

jpsim commented Nov 15, 2022

The other way to do this would be

build:sizeopt -c opt --copt -Os
build:gcsections --linkopt=-Wl,--gc-sections

where we'd only pass the gcsections config to platforms where it works (Linux + Android) but not by default (iOS, macOS, Windows).

I don't feel strongly here. Doing it the way you're proposing in this PR would probably require the fewest changes to the places where we use sizeopt today.

.bazelrc Outdated
@@ -160,6 +160,7 @@ build:libc++ --define force_libcpp=enabled

# Optimize build for binary size reduction.
build:sizeopt -c opt --copt -Os --linkopt=-Wl,--gc-sections
build:macossizeopt -c opt --copt -Os
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't macOS-specific, it's non-ELF, which is all apple platforms and Windows.

Suggested change
build:macossizeopt -c opt --copt -Os
build:nonelfsizeopt -c opt --copt -Os

Don't love that name either. Naming wise it's definitely easier to flip the defaults with sizeopt and gcsections,

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Contributor Author

ok, let's priotitize unbreak, then I'll work on replacing where we use sizeopt.
also adding dead strip without the double dash which is supposed to work but now I won't break anything testing.

@alyssawilk alyssawilk merged commit e711d10 into envoyproxy:main Nov 15, 2022
@keith
Copy link
Member

keith commented Nov 15, 2022

#24000

@alyssawilk alyssawilk deleted the elf branch April 5, 2023 16:38
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