Fix duplicate symbol errors in stack check implementation#18267
Merged
Donny9 merged 1 commit intoapache:masterfrom Feb 2, 2026
Merged
Fix duplicate symbol errors in stack check implementation#18267Donny9 merged 1 commit intoapache:masterfrom
Donny9 merged 1 commit intoapache:masterfrom
Conversation
…ilation Mark __stack_chk_guard and __stack_chk_fail as weak symbols to prevent linker conflicts when multiple definitions of these stack protection symbols exist across different compilation units. Signed-off-by: hujun5 <hujun5@xiaomi.com>
xiaoxiang781216
approved these changes
Jan 30, 2026
Barto22
approved these changes
Jan 31, 2026
Donny9
approved these changes
Feb 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve linker errors caused by multiple definitions of
__stack_chk_guardand__stack_chk_failsymbols in the stack check library. The implementation inlibs/libc/assert/lib_stackchk.cconflicted with architecture-specific implementationsin various platform files, causing duplicate symbol errors during linking.
This fix marks both symbols as weak, allowing platform-specific implementations to
override the default weak definitions when needed, while still providing functional
defaults when no override exists.
Summary
__stack_chk_guardas weak data symbol to enable platform overrides__stack_chk_failas weak function to enable platform-specific implementationsTEST