1
1
mirror of https://github.com/rui314/mold.git synced 2024-08-16 00:10:55 +03:00

Add --no-detach to write to a separate debug file in the foreground

--detach is the default.
This commit is contained in:
Rui Ueyama 2024-07-09 12:05:37 +09:00
parent 97a1e218c5
commit 18da5b654e
3 changed files with 12 additions and 1 deletions

View File

@ -85,6 +85,8 @@ Options:
--defsym=SYMBOL=VALUE Define a symbol alias
--demangle Demangle C++ symbols in log messages (default)
--no-demangle
--detach Create separate debug info file in the background (default)
--no-detach
--enable-new-dtags Emit DT_RUNPATH for --rpath (default)
--disable-new-dtags Emit DT_RPATH for --rpath
--execute-only Make executable segments unreadable
@ -759,6 +761,10 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx) {
ctx.arg.demangle = true;
} else if (read_flag("no-demangle")) {
ctx.arg.demangle = false;
} else if (read_flag("detach")) {
ctx.arg.detach = true;
} else if (read_flag("no-detach")) {
ctx.arg.detach = false;
} else if (read_flag("default-symver")) {
ctx.arg.default_symver = true;
} else if (read_flag("noinhibit-exec")) {
@ -1413,6 +1419,10 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx) {
if (ctx.arg.shared && warn_shared_textrel)
ctx.arg.warn_textrel = true;
// We don't want the background process to write to stdout
if (ctx.arg.stats || ctx.arg.perf)
ctx.arg.detach = false;
ctx.arg.undefined.push_back(ctx.arg.entry);
for (i64 i = 0; i < ctx.arg.defsyms.size(); i++) {

View File

@ -1740,6 +1740,7 @@ struct Context {
bool color_diagnostics = false;
bool default_symver = false;
bool demangle = true;
bool detach = true;
bool discard_all = false;
bool discard_locals = false;
bool eh_frame_hdr = true;

View File

@ -3058,7 +3058,7 @@ void write_separate_debug_file(Context<E> &ctx) {
// We want to write to the debug info file in background so that the
// user doesn't have to wait for it to complete.
if (!ctx.arg.stats && !ctx.arg.perf)
if (ctx.arg.detach)
notify_parent();
// A debug info file contains all sections as the original file, though