Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Aug 2021 13:03:52 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6b364a92fd79 - stable/13 - Add ElfW() macro for compatibility with Linux
Message-ID:  <202108141303.17ED3qUK045373@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dim:

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

commit 6b364a92fd790717fe7ea589df62dc1a653137dc
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-08-05 18:57:22 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-08-14 12:57:58 +0000

    Add ElfW() macro for compatibility with Linux
    
    Some Linux software using ELF headers assumes the existence of an
    ElfW(type) macro, which concatenates 'Elf', the default ELF word size,
    and the given type. This is identical to our __ElfN(x) macro in
    <sys/elf_generic.h>. Add the macro for compatibility, with a comment
    that we prefer the __ElfN() macro for FreeBSD.
    
    Reviewed by:    emaste, kib
    Differential Revision: https://reviews.freebsd.org/D31427
    MFC after:      1 week
    
    (cherry picked from commit 34e7e4b6a059eee5e4e3e34de5b9d5f0d6e589f9)
---
 sys/sys/elf_generic.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/sys/elf_generic.h b/sys/sys/elf_generic.h
index 301ee52cf7a1..dcd44fe93b14 100644
--- a/sys/sys/elf_generic.h
+++ b/sys/sys/elf_generic.h
@@ -57,6 +57,9 @@
 #define	__ELFN(x)	__CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x)
 #define	__ElfType(x)	typedef __ElfN(x) __CONCAT(Elf_,x)
 
+/* Define ElfW for compatibility with Linux, prefer __ElfN() in FreeBSD code */
+#define	ElfW(x)		__ElfN(x)
+
 __ElfType(Addr);
 __ElfType(Half);
 __ElfType(Off);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108141303.17ED3qUK045373>