git: 650bcf5b6be2 - main - rtld-elf: Don't include duplicate semicolon in Obj_Entry
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 07 Aug 2025 00:10:25 UTC
The branch main has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=650bcf5b6be222184d6258c303bdce7434d2f041
commit 650bcf5b6be222184d6258c303bdce7434d2f041
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2025-08-07 00:10:18 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2025-08-07 00:10:18 +0000
rtld-elf: Don't include duplicate semicolon in Obj_Entry
MD_OBJ_ENTRY is a list of members, possibly empty, to include in
Obj_Entry. By including the semicolon here, in the case that it's empty,
we end up with a duplicate semicolon. In the case that it's not empty,
whether there's a duplicate depends on each architecture's definition,
but they all in fact put a semicolon after every member, so there is
also a duplicate semicolon there. This is invalid C syntax, although
both GCC and Clang accept it, treating it only as a pedantic warning,
but there is no need for us to rely on that, and downstream it masked a
missing semicolon for an added field, but only on architectures where
MD_OBJ_ENTRY is empty, leading to conditional compilation failure for
something that should have been detected as an unconditional error.
Note that PCPU_MD_FIELDS, which this is based on, follows a different
style. There, every architecture defines at least one member, and there
is a semicolon after PCPU_MD_FIELDS in sys/sys/pcpu.h, but every
architecture makes sure to not put a semicolon after the final member in
its definition of the macro. This is not a pattern we can adhere to here
though given not all architectures add members.
Fixes: 06db20ffeca9 ("rtld: Add MD_OBJ_ENTRY to extend Struct_Obj_Entry")
---
libexec/rtld-elf/rtld.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
index 46473b92a637..d4829b17cebb 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -268,7 +268,7 @@ typedef struct Struct_Obj_Entry {
bool unholdfree : 1; /* unmap upon last unhold */
bool doomed : 1; /* Object cannot be referenced */
- MD_OBJ_ENTRY;
+ MD_OBJ_ENTRY
struct link_map linkmap; /* For GDB and dlinfo() */
Objlist dldags; /* Object belongs to these dlopened DAGs (%) */