Browse Source

Merge branch 'freebsd/current/master' into hardened/current/master

* freebsd/current/master:
  Allow bootstrapping elftoolchain on MacOS and Linux
  Fix generation of krb5-config with LC_CTYPE=*.UTF-8
  upgrade the warning printf-s in bus accessors to KASSERT-s, take 2
hardened/current/master
Oliver Pinter + 11 months ago
parent
commit
066bf09927
5 changed files with 28 additions and 17 deletions
  1. +8
    -3
      contrib/elftoolchain/common/_elftc.h
  2. +1
    -1
      contrib/elftoolchain/libelftc/elftc_set_timestamps.c
  3. +5
    -1
      kerberos5/usr.bin/krb5-config/Makefile
  4. +7
    -0
      lib/libelf/Makefile
  5. +7
    -12
      sys/sys/bus.h

+ 8
- 3
contrib/elftoolchain/common/_elftc.h View File

@@ -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__ */


+ 1
- 1
contrib/elftoolchain/libelftc/elftc_set_timestamps.c View File

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

+ 5
- 1
kerberos5/usr.bin/krb5-config/Makefile View File

@@ -5,8 +5,12 @@ MAN= krb5-config.1

CLEANFILES= krb5-config

# In order for this to work on MacOS we need to set LC_ALL=C since the
# krb5-config.in file contains characters that will be rejected by MacOS with
# a UTF-8 locale (see https://stackoverflow.com/a/23584470/894271)
# TODO: Should we just require LC_ALL=C during the build?
krb5-config: krb5-config.in
sed -e "s,@PACKAGE@,FreeBSD heimdal,g" \
env LC_ALL=C sed -e "s,@PACKAGE@,FreeBSD heimdal,g" \
-e "s,@VERSION@,1.1.0,g" \
-e "s,@prefix@,/usr,g" \
-e "s,@exec_prefix@,/usr,g" \

+ 7
- 0
lib/libelf/Makefile View File

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

+ 7
- 12
sys/sys/bus.h View File

@@ -152,6 +152,7 @@ struct devreq {

#include <sys/_eventhandler.h>
#include <sys/kobj.h>
#include <sys/systm.h>

/**
* devctl hooks. Typically one should use the devctl_notify
@@ -813,12 +814,9 @@ static __inline type varp ## _get_ ## var(device_t dev) \
int e; \
e = BUS_READ_IVAR(device_get_parent(dev), dev, \
ivarp ## _IVAR_ ## ivar, &v); \
if (e != 0) { \
device_printf(dev, "failed to read ivar " \
__XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \
"error = %d\n", \
device_get_nameunit(device_get_parent(dev)), e); \
} \
KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \
__func__, device_get_nameunit(dev), \
device_get_nameunit(device_get_parent(dev)), e)); \
return ((type) v); \
} \
\
@@ -828,12 +826,9 @@ static __inline void varp ## _set_ ## var(device_t dev, type t) \
int e; \
e = BUS_WRITE_IVAR(device_get_parent(dev), dev, \
ivarp ## _IVAR_ ## ivar, v); \
if (e != 0) { \
device_printf(dev, "failed to write ivar " \
__XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, " \
"error = %d\n", \
device_get_nameunit(device_get_parent(dev)), e); \
} \
KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \
__func__, device_get_nameunit(dev), \
device_get_nameunit(device_get_parent(dev)), e)); \
}

/**

Loading…
Cancel
Save