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

Fix unwinding on Android #4894

Merged
merged 2 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,25 @@ config("exceptions_default") {
configs = [ ":no_exceptions" ]
}

config("unwind_tables_default") {
config("unwind_tables") {
cflags = [ "-funwind-tables" ]
}

config("no_unwind_tables") {
cflags = [
"-fno-unwind-tables",
"-fno-asynchronous-unwind-tables",
]
}

config("unwind_tables_default") {
if (exclude_unwind_tables) {
configs = [ ":no_unwind_tables" ]
} else {
configs = [ ":unwind_tables" ]
}
}

config("size_default") {
cflags = [
"-fno-common",
Expand Down
3 changes: 3 additions & 0 deletions build/config/compiler/compiler.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ declare_args() {

# Enable position independent executables (-pie).
enable_pie = current_os == "linux"

# Remove unwind tables from the binary to save space.
exclude_unwind_tables = current_os != "android"
Copy link
Contributor

@andy31415 andy31415 Feb 17, 2021

Choose a reason for hiding this comment

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

nit: should we use enable_unwind_tables as a flag instead, to not have negations? All other flags seem to be positive like enable_*, optimize_*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My guilty admission is that I copied the arguments from chromium with the aim of keeping some consistency across projects that use GN.

}
5 changes: 5 additions & 0 deletions build/config/defaults.gni
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ declare_args() {
default_configs_exceptions =
[ "${build_root}/config/compiler:exceptions_default" ]

# Default configs for unwind tables.
default_configs_unwind_tables =
[ "${build_root}/config/compiler:unwind_tables_default" ]

# Defaults configs for rtti.
default_configs_rtti = [ "${build_root}/config/compiler:rtti_default" ]

Expand Down Expand Up @@ -91,6 +95,7 @@ default_configs += default_configs_symbols
default_configs += default_configs_size
default_configs += default_configs_specs
default_configs += default_configs_exceptions
default_configs += default_configs_unwind_tables
default_configs += default_configs_pic
default_configs += default_configs_rtti
default_configs += default_configs_warnings
Expand Down