debugging: guard ABSL_HAVE_ELF_MEM_IMAGE on <link.h> availability - #2154
Open
vasko-110 wants to merge 1 commit into
Open
debugging: guard ABSL_HAVE_ELF_MEM_IMAGE on <link.h> availability#2154vasko-110 wants to merge 1 commit into
vasko-110 wants to merge 1 commit into
Conversation
ABSL_HAVE_ELF_MEM_IMAGE is enabled for every __ELF__ target except an explicit deny-list, and elf_mem_image.h then includes <link.h> unconditionally. __ELF__ describes the object format, not the presence of a dynamic loader, and <link.h> is a glibc/dynamic-linker header that bare-metal ELF toolchains do not ship. On arm-none-eabi with newlib the macro is defined, the include is reached, and the build fails with a fatal error. Test for the header the code actually needs instead of enumerating the platforms that lack it. The existing exclusions stay: __sun, __QNX__ and __OpenBSD__ do provide a <link.h>, with different semantics. stacktrace_config.h in the same directory already guards on __has_include(<execinfo.h>), and __has_include has been used unconditionally since 2fb2566.
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.
Fixes #2153.
ABSL_HAVE_ELF_MEM_IMAGEis enabled for every__ELF__target except a deny-list, and the header then includes<link.h>unconditionally.__ELF__describes the object format, not the presence of a dynamic loader, so bare-metal ELF toolchains (arm-none-eabiwith newlib) fail with a fatal error. This tests for the header the code actually needs instead.The existing exclusions are untouched:
__sun,__QNX__and__OpenBSD__do ship a<link.h>with different semantics, so they must stay listed regardless.Verified on
71330b93:elf_mem_image.ccandvdso_support.ccnow compile underarm-none-eabi-g++, and on the hostABSL_HAVE_ELF_MEM_IMAGEis still defined and both files still compile — no supported platform changes behaviour.