git: be01082b86ef - main - elf-hints.h: Allow rtld_paths.h to be included before it

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Sun, 09 Jul 2023 17:51:55 UTC
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=be01082b86ef06382177106dd43c39a048bb231f

commit be01082b86ef06382177106dd43c39a048bb231f
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-07-09 17:45:42 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-07-09 17:45:42 +0000

    elf-hints.h: Allow rtld_paths.h to be included before it
    
    Currently rtld_paths.h will #undef _PATH_ELF_HINTS in order to override
    this to the right value if included afterwards, but the other way round
    does not work as elf-hints.h tries to define an already-defined macro to
    a potentially different value. Thus, guard the definition here so that
    rtld_paths.h's definition continues to take precedence.
    
    Note that, although all in-tree uses of _PATH_ELF_HINTS have included
    rtld_paths.h already, pax-utils wants _PATH_ELF_HINTS from elf-hints.h
    and so we cannot just drop the define. In-tree uses must just continue
    to make sure that they include rtld_paths.h to get the right value for
    libcompat builds as is already required.
    
    Reviewed by:    kib, brooks, jhb, imp
    Differential Revision:  https://reviews.freebsd.org/D40918
---
 include/elf-hints.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/elf-hints.h b/include/elf-hints.h
index e1ded3788a81..fa3bc407b1d1 100644
--- a/include/elf-hints.h
+++ b/include/elf-hints.h
@@ -47,6 +47,8 @@ struct elfhints_hdr {
 
 #define ELFHINTS_MAGIC	0x746e6845
 
+#ifndef _PATH_ELF_HINTS
 #define _PATH_ELF_HINTS	"/var/run/ld-elf.so.hints"
+#endif
 
 #endif /* !_ELF_HINTS_H_ */