Skip to content

Commit

Permalink
Enable dead code elimination on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Nov 26, 2024
1 parent 2ec55d9 commit ce0b2a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build_common.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$clanglink = $clang;
if (!defined("PHP_WINDOWS_VERSION_MAJOR"))
{
$clanglink .= " -lstdc++ -pthread -lm -ldl";
$clanglink .= " -Wl,--gc-sections,--icf=safe -lstdc++ -pthread -lm -ldl";
if (!getenv("ANDROID_ROOT"))
{
$clanglink .= " -lresolv";
Expand Down
3 changes: 2 additions & 1 deletion soup/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ NAMESPACE_SOUP
#if SOUP_WINDOWS
"-D_CRT_SECURE_NO_WARNINGS",
#endif
"-ffunction-sections", "-fdata-sections", // needed for dead code elimination
"-ffunction-sections", "-fdata-sections", // dead code elimination
"-std="
};
args.back().append(lang);
Expand Down Expand Up @@ -69,6 +69,7 @@ NAMESPACE_SOUP
#else
#if !SOUP_MACOS
args.emplace_back("-fuse-ld=lld");
args.emplace_back("-Wl,--gc-sections,--icf=safe"); // dead code elimination
#endif
args.emplace_back("-lstdc++");
if (!isEmscripten())
Expand Down

0 comments on commit ce0b2a8

Please sign in to comment.