makefile: update ldflags and add strip for static builds#3054
makefile: update ldflags and add strip for static builds#3054kailun-qin wants to merge 1 commit intoopencontainers:masterfrom
Conversation
|
The flag was added by commit ecd6463, not sure why though. The I think it's better to drop the flag entirely, and instead add @kailun-qin can you do that? While at it, please don't use markdown in commit subject. Interestingly, even the binary build with (in the listing above the first four items are builds with and without -w and -w, and the last for are stripped versions of those). |
|
@kolyshkin GNU |
2f5d6d4 to
a91092c
Compare
-w ldflags configurable for static build|
@kolyshkin @cyphar Thanks for the comments, updated! I intended to propose to add |
script/release.sh
Outdated
| local ldflags | ||
| prefix="$(mktemp -d)" | ||
| ldflags="-w -s" |
There was a problem hiding this comment.
nit:
| local ldflags | |
| prefix="$(mktemp -d)" | |
| ldflags="-w -s" | |
| local ldflags="-w -s" | |
| local prefix | |
| prefix=$(mktemp -d)" |
The prefix assignment is separated from declaration as otherwise it would hide an error from mktemp. There can be no error in assigning a string, so no need to do the same for ldflags assignment.
There was a problem hiding this comment.
Ah, I see, you already did that, but in a separate commit.
To me it makes sense to use both As a fun experiment, I just tried to upx the resulting binary, slashing its size from 9.7M down to 3.5M. Apparently everything still works, the only downsides are:
|
Exactly, upx is usually considered as one of the ultimate approaches (available) for binary size optimization, though may incur some performance trade-offs. |
|
@kolyshkin @cyphar Would you please kindly take another look when you get a chance? Thanks! |
|
@kailun-qin please squash your commits, it's easier to review and in general makes more sense in this case. The only other nit I see is the word "proposes" in the commit description. Once merged, it's no longer a proposal but a factual change, so please change the description accordingly ("This patch does this and that because ...", or, yet better, "Do this and that |
19034a4 to
ffefa6e
Compare
ffefa6e to
7824f28
Compare
Squashed and updated the commit message. PTAL, thanks! |
This patch * drops the default `-w` flag for `make static`, which helps with debugging the static runc binary; * adds `EXTRA_LDFLAGS="-w -s"` to `script/release.sh` to disable DWARF generation and symbol table for the release runc binary; * adds strip in `script/release.sh` for a further size-optimized release runc binary. Signed-off-by: Kailun Qin <kailun.qin@intel.com>
|
Needs a rebase. I am carrying this in #3099 and have rebased it in there, so I guess we can close this one. |
This patch
-wflag formake static, which helps withdebugging the static runc binary;
EXTRA_LDFLAGS="-w -s"toscript/release.shto disable DWARFgeneration and symbol table for the release runc binary;
script/release.shfor a further size-optimized releaserunc binary.
Signed-off-by: Kailun Qin kailun.qin@intel.com