git: 26b117bc6ad8 - stable/13 - fbt: Remove some handling for multiple CTF containers

Mark Johnston markj at FreeBSD.org
Fri Apr 16 01:27:35 UTC 2021


The branch stable/13 has been updated by markj:

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

commit 26b117bc6ad8acaeec8002494f9d4c53a822f0a2
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-04-02 21:42:26 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-04-16 01:27:24 +0000

    fbt: Remove some handling for multiple CTF containers
    
    This was ported from illumos but not completely done.  Currently we do
    not perform type deduplication between KLDs and the kernel, i.e., kernel
    modules have a complete type graph.  So, remove it for now since it's
    not functional and complicates the task of modifying various CTF type
    definitions, and we are hitting some limits in the current format which
    necessitate an update.
    
    No functional change intended.
    
    (cherry picked from commit 4d221f59b851a9c844c84701bab7f4edb7026bd4)
---
 sys/cddl/dev/fbt/fbt.c | 44 +++++++++-----------------------------------
 1 file changed, 9 insertions(+), 35 deletions(-)

diff --git a/sys/cddl/dev/fbt/fbt.c b/sys/cddl/dev/fbt/fbt.c
index a378ae0eb317..3bad4243c040 100644
--- a/sys/cddl/dev/fbt/fbt.c
+++ b/sys/cddl/dev/fbt/fbt.c
@@ -474,17 +474,18 @@ fbt_typoff_init(linker_ctf_t *lc)
 	int ctf_typemax = 0;
 	uint32_t *xp;
 	ulong_t pop[CTF_K_MAX + 1] = { 0 };
+	uint8_t version;
 
 
 	/* Sanity check. */
 	if (hp->cth_magic != CTF_MAGIC)
 		return (EINVAL);
 
+	version = hp->cth_version;
+
 	tbuf = (const ctf_type_t *) (ctfdata + hp->cth_typeoff);
 	tend = (const ctf_type_t *) (ctfdata + hp->cth_stroff);
 
-	int child = hp->cth_parname != 0;
-
 	/*
 	 * We make two passes through the entire type section.  In this first
 	 * pass, we count the number of each type and the total number of types.
@@ -495,9 +496,8 @@ fbt_typoff_init(linker_ctf_t *lc)
 		ssize_t size, increment;
 
 		size_t vbytes;
-		uint_t n;
 
-		(void) fbt_get_ctt_size(hp->cth_version, tp, &size, &increment);
+		(void) fbt_get_ctt_size(version, tp, &size, &increment);
 
 		switch (kind) {
 		case CTF_K_INTEGER:
@@ -512,22 +512,10 @@ fbt_typoff_init(linker_ctf_t *lc)
 			break;
 		case CTF_K_STRUCT:
 		case CTF_K_UNION:
-			if (size < CTF_LSTRUCT_THRESH) {
-				ctf_member_t *mp = (ctf_member_t *)
-				    ((uintptr_t)tp + increment);
-
+			if (size < CTF_LSTRUCT_THRESH)
 				vbytes = sizeof (ctf_member_t) * vlen;
-				for (n = vlen; n != 0; n--, mp++)
-					child |= CTF_TYPE_ISCHILD(mp->ctm_type);
-			} else {
-				ctf_lmember_t *lmp = (ctf_lmember_t *)
-				    ((uintptr_t)tp + increment);
-
+			else
 				vbytes = sizeof (ctf_lmember_t) * vlen;
-				for (n = vlen; n != 0; n--, lmp++)
-					child |=
-					    CTF_TYPE_ISCHILD(lmp->ctlm_type);
-			}
 			break;
 		case CTF_K_ENUM:
 			vbytes = sizeof (ctf_enum_t) * vlen;
@@ -552,7 +540,6 @@ fbt_typoff_init(linker_ctf_t *lc)
 		case CTF_K_VOLATILE:
 		case CTF_K_CONST:
 		case CTF_K_RESTRICT:
-			child |= CTF_TYPE_ISCHILD(tp->ctt_type);
 			vbytes = 0;
 			break;
 		default:
@@ -584,9 +571,8 @@ fbt_typoff_init(linker_ctf_t *lc)
 		ssize_t size, increment;
 
 		size_t vbytes;
-		uint_t n;
 
-		(void) fbt_get_ctt_size(hp->cth_version, tp, &size, &increment);
+		(void) fbt_get_ctt_size(version, tp, &size, &increment);
 
 		switch (kind) {
 		case CTF_K_INTEGER:
@@ -601,22 +587,10 @@ fbt_typoff_init(linker_ctf_t *lc)
 			break;
 		case CTF_K_STRUCT:
 		case CTF_K_UNION:
-			if (size < CTF_LSTRUCT_THRESH) {
-				ctf_member_t *mp = (ctf_member_t *)
-				    ((uintptr_t)tp + increment);
-
+			if (size < CTF_LSTRUCT_THRESH)
 				vbytes = sizeof (ctf_member_t) * vlen;
-				for (n = vlen; n != 0; n--, mp++)
-					child |= CTF_TYPE_ISCHILD(mp->ctm_type);
-			} else {
-				ctf_lmember_t *lmp = (ctf_lmember_t *)
-				    ((uintptr_t)tp + increment);
-
+			else
 				vbytes = sizeof (ctf_lmember_t) * vlen;
-				for (n = vlen; n != 0; n--, lmp++)
-					child |=
-					    CTF_TYPE_ISCHILD(lmp->ctlm_type);
-			}
 			break;
 		case CTF_K_ENUM:
 			vbytes = sizeof (ctf_enum_t) * vlen;


More information about the dev-commits-src-all mailing list