-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[chore] Ability to provide custom ld and gc flags #11996
base: main
Are you sure you want to change the base?
Conversation
9889e99
to
a6d8bb0
Compare
c3b79eb
to
ee35153
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11996 +/- ##
========================================
Coverage 91.62% 91.62%
========================================
Files 447 455 +8
Lines 23739 24057 +318
========================================
+ Hits 21751 22043 +292
- Misses 1613 1639 +26
Partials 375 375 ☔ View full report in Codecov by Sentry. |
@@ -71,7 +74,7 @@ type Distribution struct { | |||
OutputPath string `mapstructure:"output_path"` | |||
Version string `mapstructure:"version"` | |||
BuildTags string `mapstructure:"build_tags"` | |||
DebugCompilation bool `mapstructure:"debug_compilation"` | |||
DebugCompilation bool `mapstructure:"debug_compilation"` // TODO depercate? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of TODOs in code, please file an issue :)
DebugCompilation bool `mapstructure:"debug_compilation"` // TODO depercate? | |
DebugCompilation bool `mapstructure:"debug_compilation"` |
To keep the debug symbols in the resulting OpenTelemetry Collector binary, set the configuration property `debug_compilation` to true. | ||
### Debug symbols | ||
|
||
By default, the LDflags are set to -s -w, which strips debugging symbols to produce a smaller OpenTelemetry Collector binary. To retain debugging symbols and DWARF debugging data in the binary, override the LDflags as shown: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, the LDflags are set to -s -w, which strips debugging symbols to produce a smaller OpenTelemetry Collector binary. To retain debugging symbols and DWARF debugging data in the binary, override the LDflags as shown: | |
By default, the LDflags are set to `-s -w`, which strips debugging symbols to produce a smaller OpenTelemetry Collector binary. To retain debugging symbols and DWARF debugging data in the binary, override the LDflags as shown: |
Description
The primary purpose of this PR is to provide greater flexibility in how OTEL binaries are built, enabling the inclusion of debugging symbols when needed, without always stripping them by default.
Currently, debugging symbols are only retained when debug_compilation=true. However, this approach also disables all compiler inlining and optimizations (gcflags=all=-N -l) to ensure an exact match between written and executed code, resulting in a significant increase in CPU consumption. There are scenarios where we want binaries with debugging symbols and DWARF information while still allowing the compiler to optimize and inline. This PR addresses that need by introducing configurable GCFlags.
ocb --ldflags="" --gcflags="" --config=builder-config.yaml
Link to tracking issue
Fixes #58
Testing
Manual
Override LDflags:
Override both
Documentation
README file updated.
--
Backward compatibility concerns:
-s -w
.Questions: