Skip to content

Replace abort() with diagnostic message in redo_main()#1554

Open
karesansui-u wants to merge 1 commit intorui314:mainfrom
karesansui-u:fix/redo-main-abort-message
Open

Replace abort() with diagnostic message in redo_main()#1554
karesansui-u wants to merge 1 commit intorui314:mainfrom
karesansui-u:fix/redo-main-abort-message

Conversation

@karesansui-u
Copy link

Summary

  • redo_main() called abort() when no compiled-in target matched the auto-detected architecture
  • Users saw only Aborted (core dumped) with no indication of the cause
  • Now prints: mold: unsupported target: <name>; rebuild mold with the appropriate target support

This aligns the auto-detection path (redo_main() in passes.cc) with the explicit -m path (cmdline.cc:763), which already provides a helpful Fatal(ctx) message.

Details

redo_main() does not have access to Context<E> (it runs before mold_main<E> creates one), so Fatal(ctx) cannot be used. The fix uses std::cerr + exit(1) instead.

Fixes #1553

When mold auto-detects an unsupported target from ELF headers,
redo_main() previously called abort() with no context. This replaces
it with a descriptive error message matching the style used by the
-m flag path in cmdline.cc.

Fixes rui314#1553
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

redo_main() calls abort() with no message for unsupported targets

1 participant