[Bug 280432] <sys/linker.h> needs <sys/param.h> and <sys/types.h> but does not include them

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 24 Jul 2024 19:38:25 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280432

            Bug ID: 280432
           Summary: <sys/linker.h> needs <sys/param.h> and <sys/types.h>
                    but does not include them
           Product: Base System
           Version: 13.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: mhjacobson@me.com

Including <sys/linker.h> from userland fails unless you've previously included
<sys/types.h> and <sys/param.h>.  (<sys/param.h> brings in <sys/types.h>.)

<sys/linker.h> should include the headers for the types and macros it
references so that it can be independently included.

$ freebsd-version -k
13.3-RELEASE

$ cc -c -x c -
#include <sys/linker.h>
^D
In file included from <stdin>:1:
/usr/include/sys/linker.h:347:22: error: use of undeclared identifier
'MAXPATHLEN'
  347 |     char        name[MAXPATHLEN];
      |                      ^
/usr/include/sys/linker.h:350:5: error: unknown type name 'caddr_t'
  350 |     caddr_t     address;        /* load address */
      |     ^
/usr/include/sys/linker.h:351:5: error: unknown type name 'size_t'
  351 |     size_t      size;           /* size in bytes */
      |     ^
/usr/include/sys/linker.h:352:26: error: use of undeclared identifier
'MAXPATHLEN'
  352 |     char        pathname[MAXPATHLEN];
      |                          ^
/usr/include/sys/linker.h:358:5: error: unknown type name 'u_long'; did you
mean 'long'?
  358 |     u_long      symvalue;
      |     ^
/usr/include/sys/linker.h:359:5: error: unknown type name 'size_t'
  359 |     size_t      symsize;
      |     ^
6 errors generated.

-- 
You are receiving this mail because:
You are the assignee for the bug.