Skip to content

debugging: guard ABSL_HAVE_ELF_MEM_IMAGE on <link.h> availability - #2154

Open
vasko-110 wants to merge 1 commit into
abseil:masterfrom
vasko-110:elf-mem-image-has-link-h
Open

debugging: guard ABSL_HAVE_ELF_MEM_IMAGE on <link.h> availability#2154
vasko-110 wants to merge 1 commit into
abseil:masterfrom
vasko-110:elf-mem-image-has-link-h

Conversation

@vasko-110

@vasko-110 vasko-110 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #2153.

ABSL_HAVE_ELF_MEM_IMAGE is 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-eabi with 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.cc and vdso_support.cc now compile under arm-none-eabi-g++, and on the host ABSL_HAVE_ELF_MEM_IMAGE is still defined and both files still compile — no supported platform changes behaviour.

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.
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.

[Bug]: ABSL_HAVE_ELF_MEM_IMAGE assumes every ELF target ships <link.h>

1 participant