binutils Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
binutils/dlltool

Dlltool no longer crashes when excluding symbols

Binutils `dlltool` now correctly handles the `--exclude-symbols` option without crashing, resolving a regression.

This commit fixes a segmentation fault in Binutils dlltool that occurred when using the --exclude-symbols option. The crash was a regression introduced by a previous commit that did not account for how dlltool processed symbol names with leading underscores during option handling. The fix modifies the string_list structure and related functions (add_excludes, underscore_excludes) to properly manage memory for excluded symbols, especially regarding potential leading underscores, restoring stable operation.

In Details

This fix targets a regression in Binutils dlltool affecting the handling of symbol exclusion with --exclude-symbols. The root cause was an oversight in a previous commit, where the leading_underscore field's usage during option processing was not fully considered. The solution involves adjusting the string_list structure to a flexible array member and refactoring the add_excludes and underscore_excludes functions in dlltool.c to correctly manage memory and symbol prefixes, preventing a segmentation fault.

For Context

When building Windows dynamic-link libraries (DLLs), developers often use a tool called dlltool (part of Binutils) to create necessary files. Sometimes, it's useful to prevent certain symbols (like function names or variable names) from being exported from a DLL, and dlltool provides an option for this: --exclude-symbols. This commit fixes a bug where dlltool would crash (a "segmentation fault") when this option was used. The crash happened because a recent change to the tool didn't correctly handle how symbol names, especially those with leading underscores, were stored and processed when being excluded. This fix updates the internal data structures and logic within dlltool to properly manage these symbol names, making the --exclude-symbols option reliable again. This ensures that developers can effectively control which parts of their DLLs are made public without crashing the build process.

Filed Under: bugfixdlltoolwindowsmemory