Author: emaste
Date: Wed May 20 21:41:36 2020
New Revision: 361301
URL: https://svnweb.freebsd.org/changeset/base/361301

Log:
  MFC r349577 (arichardson): Allow bootstrapping elftoolchain on MacOS and Linux
  
  This is required in order to build on non-FreeBSD systems without setting
  all the XAR/XSTRINGS/etc. variables

Modified:
  stable/12/contrib/elftoolchain/common/_elftc.h
  stable/12/contrib/elftoolchain/libelftc/elftc_set_timestamps.c
  stable/12/lib/libelf/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/elftoolchain/common/_elftc.h
==============================================================================
--- stable/12/contrib/elftoolchain/common/_elftc.h      Wed May 20 21:39:19 
2020        (r361300)
+++ stable/12/contrib/elftoolchain/common/_elftc.h      Wed May 20 21:41:36 
2020        (r361301)
@@ -374,11 +374,14 @@ extern const char *__progname;
 
 #include <libkern/OSByteOrder.h>
 #define        htobe32(x)      OSSwapHostToBigInt32(x)
+#define        htole32(x)      OSSwapHostToLittleInt32(x)
+#ifndef roundup2
 #define        roundup2        roundup
+#endif
 
-#define        ELFTC_BYTE_ORDER                        _BYTE_ORDER
-#define        ELFTC_BYTE_ORDER_LITTLE_ENDIAN          _LITTLE_ENDIAN
-#define        ELFTC_BYTE_ORDER_BIG_ENDIAN             _BIG_ENDIAN
+#define        ELFTC_BYTE_ORDER                        __DARWIN_BYTE_ORDER
+#define        ELFTC_BYTE_ORDER_LITTLE_ENDIAN          __DARWIN_LITTLE_ENDIAN
+#define        ELFTC_BYTE_ORDER_BIG_ENDIAN             __DARWIN_BIG_ENDIAN
 
 #define        ELFTC_HAVE_MMAP                         1
 #define        ELFTC_HAVE_STRMODE                      1
@@ -418,7 +421,9 @@ extern const char *__progname;
 /* Whether we need to supply {be,le}32dec. */
 #define ELFTC_NEED_BYTEORDER_EXTENSIONS                1
 
+#ifndef roundup2
 #define        roundup2        roundup
+#endif
 
 #endif /* __GLIBC__ || __linux__ */
 

Modified: stable/12/contrib/elftoolchain/libelftc/elftc_set_timestamps.c
==============================================================================
--- stable/12/contrib/elftoolchain/libelftc/elftc_set_timestamps.c      Wed May 
20 21:39:19 2020        (r361300)
+++ stable/12/contrib/elftoolchain/libelftc/elftc_set_timestamps.c      Wed May 
20 21:41:36 2020        (r361301)
@@ -37,7 +37,7 @@ ELFTC_VCSID("$Id$");
  * stat'.
  */
 
-#if    defined(__FreeBSD__) || defined(__NetBSD__)
+#if    defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
 #define        ATIME   st_atimespec
 #define        MTIME   st_mtimespec
 #define        LIBELFTC_HAVE_UTIMES    1

Modified: stable/12/lib/libelf/Makefile
==============================================================================
--- stable/12/lib/libelf/Makefile       Wed May 20 21:39:19 2020        
(r361300)
+++ stable/12/lib/libelf/Makefile       Wed May 20 21:41:36 2020        
(r361301)
@@ -79,6 +79,13 @@ INCS=                libelf.h gelf.h
 #
 SRCS+= sys/elf32.h sys/elf64.h sys/elf_common.h
 
+# Allow bootstrapping elftoolchain on Linux:
+.if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux"
+native-elf-format.h:
+       ${ELFTCDIR}/common/native-elf-format > ${.TARGET} || rm ${.TARGET}
+SRCS+= native-elf-format.h
+.endif
+
 GENSRCS=       libelf_fsize.c libelf_msize.c libelf_convert.c
 CLEANFILES=    ${GENSRCS}
 CLEANDIRS=     sys
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to