Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107753217
D46719.id143553.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D46719.id143553.diff
View Options
diff --git a/Makefile.inc1 b/Makefile.inc1
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -2506,8 +2506,14 @@
_bt_libelf_depend=${_bt}-lib/libelf
.endif
+.if ${BOOTSTRAPPING} < 1500024
+_libkldelf= lib/libkldelf
+${_bt}-lib/libkldelf: ${_bt_libelf_depend}
+_bt_libkldelf_depend=${_bt}-lib/libkldelf
+.endif
+
_kldxref= usr.sbin/kldxref
-${_bt}-usr.sbin/kldxref: ${_bt_libelf_depend}
+${_bt}-usr.sbin/kldxref: ${_bt_libelf_depend} ${_bt_libkldelf_depend}
# flua is required to regenerate syscall files. It first appeared during the
# 13.0-CURRENT cycle, thus needs to be built on -older releases and stable
@@ -2770,6 +2776,7 @@
${_cat} \
${_kbdcontrol} \
${_elftoolchain_libs} \
+ ${_libkldelf} \
${_kldxref} \
lib/libopenbsd \
usr.bin/mandoc \
@@ -3213,7 +3220,8 @@
lib/libfigpar \
${_lib_libgssapi} \
lib/libjail \
- lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
+ lib/libkiconv lib/libkldelf lib/libkvm \
+ lib/liblzma lib/libmd lib/libnv \
lib/libzstd \
${_lib_casper} \
lib/ncurses/tinfo \
@@ -3249,6 +3257,7 @@
.endif
lib/libgeom__L: lib/libexpat__L lib/libsbuf__L
+lib/libkldelf__L: lib/libelf__L
lib/libkvm__L: lib/libelf__L
.if ${MK_RADIUS_SUPPORT} != "no"
diff --git a/lib/libkldelf/Makefile b/lib/libkldelf/Makefile
new file mode 100644
--- /dev/null
+++ b/lib/libkldelf/Makefile
@@ -0,0 +1,19 @@
+.include <bsd.own.mk>
+
+INTERNALLIB=
+
+LIB= kldelf
+SRCS= ef.c ef_obj.c elf.c \
+ ef_aarch64.c \
+ ef_arm.c \
+ ef_amd64.c \
+ ef_i386.c \
+ ef_mips.c \
+ ef_powerpc.c \
+ ef_riscv.c
+INCS= kldelf.h
+WARNS?= 2
+
+LIBADD= elf
+
+.include <bsd.lib.mk>
diff --git a/usr.sbin/kldxref/ef.c b/lib/libkldelf/ef.c
rename from usr.sbin/kldxref/ef.c
rename to lib/libkldelf/ef.c
--- a/usr.sbin/kldxref/ef.c
+++ b/lib/libkldelf/ef.c
@@ -41,7 +41,7 @@
#include <stdlib.h>
#include <string.h>
-#include "ef.h"
+#include "kldelf.h"
#define MAXSEGS 16
struct ef_file {
diff --git a/usr.sbin/kldxref/ef_aarch64.c b/lib/libkldelf/ef_aarch64.c
rename from usr.sbin/kldxref/ef_aarch64.c
rename to lib/libkldelf/ef_aarch64.c
--- a/usr.sbin/kldxref/ef_aarch64.c
+++ b/lib/libkldelf/ef_aarch64.c
@@ -31,7 +31,7 @@
#include <errno.h>
#include <gelf.h>
-#include "ef.h"
+#include "kldelf.h"
/*
* Apply relocations to the values obtained from the file. `relbase' is the
diff --git a/usr.sbin/kldxref/ef_amd64.c b/lib/libkldelf/ef_amd64.c
rename from usr.sbin/kldxref/ef_amd64.c
rename to lib/libkldelf/ef_amd64.c
--- a/usr.sbin/kldxref/ef_amd64.c
+++ b/lib/libkldelf/ef_amd64.c
@@ -33,7 +33,7 @@
#include <errno.h>
#include <gelf.h>
-#include "ef.h"
+#include "kldelf.h"
/*
* Apply relocations to the values obtained from the file. `relbase' is the
diff --git a/usr.sbin/kldxref/ef_arm.c b/lib/libkldelf/ef_arm.c
rename from usr.sbin/kldxref/ef_arm.c
rename to lib/libkldelf/ef_arm.c
--- a/usr.sbin/kldxref/ef_arm.c
+++ b/lib/libkldelf/ef_arm.c
@@ -34,7 +34,7 @@
#include <errno.h>
#include <gelf.h>
-#include "ef.h"
+#include "kldelf.h"
/*
* Apply relocations to the values obtained from the file. `relbase' is the
diff --git a/usr.sbin/kldxref/ef_i386.c b/lib/libkldelf/ef_i386.c
rename from usr.sbin/kldxref/ef_i386.c
rename to lib/libkldelf/ef_i386.c
--- a/usr.sbin/kldxref/ef_i386.c
+++ b/lib/libkldelf/ef_i386.c
@@ -33,7 +33,7 @@
#include <errno.h>
#include <gelf.h>
-#include "ef.h"
+#include "kldelf.h"
/*
* Apply relocations to the values obtained from the file. `relbase' is the
diff --git a/usr.sbin/kldxref/ef_mips.c b/lib/libkldelf/ef_mips.c
rename from usr.sbin/kldxref/ef_mips.c
rename to lib/libkldelf/ef_mips.c
--- a/usr.sbin/kldxref/ef_mips.c
+++ b/lib/libkldelf/ef_mips.c
@@ -36,7 +36,7 @@
#include <errno.h>
#include <gelf.h>
-#include "ef.h"
+#include "kldelf.h"
/*
* Apply relocations to the values obtained from the file. `relbase' is the
diff --git a/usr.sbin/kldxref/ef_obj.c b/lib/libkldelf/ef_obj.c
rename from usr.sbin/kldxref/ef_obj.c
rename to lib/libkldelf/ef_obj.c
--- a/usr.sbin/kldxref/ef_obj.c
+++ b/lib/libkldelf/ef_obj.c
@@ -43,7 +43,7 @@
#include <stdlib.h>
#include <string.h>
-#include "ef.h"
+#include "kldelf.h"
typedef struct {
GElf_Addr addr;
diff --git a/usr.sbin/kldxref/ef_powerpc.c b/lib/libkldelf/ef_powerpc.c
rename from usr.sbin/kldxref/ef_powerpc.c
rename to lib/libkldelf/ef_powerpc.c
--- a/usr.sbin/kldxref/ef_powerpc.c
+++ b/lib/libkldelf/ef_powerpc.c
@@ -33,7 +33,7 @@
#include <errno.h>
#include <gelf.h>
-#include "ef.h"
+#include "kldelf.h"
/*
* Apply relocations to the values obtained from the file. `relbase' is the
diff --git a/usr.sbin/kldxref/ef_riscv.c b/lib/libkldelf/ef_riscv.c
rename from usr.sbin/kldxref/ef_riscv.c
rename to lib/libkldelf/ef_riscv.c
--- a/usr.sbin/kldxref/ef_riscv.c
+++ b/lib/libkldelf/ef_riscv.c
@@ -36,7 +36,7 @@
#include <errno.h>
#include <gelf.h>
-#include "ef.h"
+#include "kldelf.h"
/*
* Apply relocations to the values obtained from the file. `relbase' is the
diff --git a/usr.sbin/kldxref/elf.c b/lib/libkldelf/elf.c
rename from usr.sbin/kldxref/elf.c
rename to lib/libkldelf/elf.c
--- a/usr.sbin/kldxref/elf.c
+++ b/lib/libkldelf/elf.c
@@ -44,7 +44,7 @@
#include <string.h>
#include <unistd.h>
-#include "ef.h"
+#include "kldelf.h"
SET_DECLARE(elf_reloc, struct elf_reloc_data);
diff --git a/usr.sbin/kldxref/ef.h b/lib/libkldelf/kldelf.h
rename from usr.sbin/kldxref/ef.h
rename to lib/libkldelf/kldelf.h
--- a/usr.sbin/kldxref/ef.h
+++ b/lib/libkldelf/kldelf.h
@@ -32,8 +32,8 @@
* SUCH DAMAGE.
*/
-#ifndef _EF_H_
-#define _EF_H_
+#ifndef _KLDELF_H_
+#define _KLDELF_H_
#include <sys/linker_set.h>
#include <stdbool.h>
@@ -312,4 +312,4 @@
__END_DECLS
-#endif /* _EF_H_*/
+#endif /* _KLDELF_H_*/
diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk
--- a/share/mk/src.libnames.mk
+++ b/share/mk/src.libnames.mk
@@ -50,6 +50,7 @@
ifconfig \
ipf \
iscsiutil \
+ kldelf \
lpr \
lua \
lutok \
@@ -313,6 +314,7 @@
_DP_geom= bsdxml sbuf
_DP_cam= sbuf
_DP_kvm= elf
+_DP_kldelf= elf
_DP_casper= nv
_DP_cap_dns= nv
_DP_cap_fileargs= nv
@@ -556,6 +558,9 @@
LIBFDTDIR= ${_LIB_OBJTOP}/lib/libfdt
LIBFDT?= ${LIBFDTDIR}/libfdt${PIE_SUFFIX}.a
+LIBKLDELFDIR= ${_LIB_OBJTOP}/lib/libkldelf
+LIBKLDELF?= ${LIBKLDELFDIR}/libkldelf${PIE_SUFFIX}.a
+
LIBLUADIR= ${_LIB_OBJTOP}/lib/liblua
LIBLUA?= ${LIBLUADIR}/liblua${PIE_SUFFIX}.a
diff --git a/sys/sys/param.h b/sys/sys/param.h
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -73,7 +73,7 @@
* cannot include sys/param.h and should only be updated here.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1500023
+#define __FreeBSD_version 1500024
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
diff --git a/usr.sbin/kldxref/Makefile b/usr.sbin/kldxref/Makefile
--- a/usr.sbin/kldxref/Makefile
+++ b/usr.sbin/kldxref/Makefile
@@ -1,17 +1,12 @@
PACKAGE= runtime
PROG= kldxref
MAN= kldxref.8
-SRCS= kldxref.c ef.c ef_obj.c elf.c
-SRCS+= ef_aarch64.c \
- ef_arm.c \
- ef_amd64.c \
- ef_i386.c \
- ef_mips.c \
- ef_powerpc.c \
- ef_riscv.c
+SRCS= kldxref.c
+
+CFLAGS+=-I${SRCTOP}/lib/libkldelf
WARNS?= 2
-LIBADD= elf
+LIBADD= elf kldelf
.include <bsd.prog.mk>
diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c
--- a/usr.sbin/kldxref/kldxref.c
+++ b/usr.sbin/kldxref/kldxref.c
@@ -51,7 +51,7 @@
#include <string.h>
#include <unistd.h>
-#include "ef.h"
+#include <kldelf.h>
#define MAXRECSIZE (64 << 10) /* 64k */
#define check(val) if ((error = (val)) != 0) break
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 18, 11:35 PM (21 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15904948
Default Alt Text
D46719.id143553.diff (7 KB)
Attached To
Mode
D46719: libkldelf: add a private library for kernel/kld-related ELF parsing
Attached
Detach File
Event Timeline
Log In to Comment