Repository navigation
Description
Add support for the QNX io-pkt Driver Development Kit (DDK)
Background
QNX SDP implements network device drivers and network protocol modules on top of FreeBSD's kernel TCP/IP stack (io-pkt). Building such modules requires a FreeBSD "kernel" compilation personality and the usr/include/devs header search paths. The toolchain currently exposes neither, so these modules cannot be built with Bazel.
Scope
New opt-in feature io_pkt_ddk (QNX only)
- Added
features/custom/qnx/io_pkt_ddk/feature.bzlwithmake_io_pkt_ddk_feature(target_dir, cpu), mirroringusr/include/devs/devs.mk,mods.mkandopt_global.mk. - Kernel personality flags:
-D__FreeBSD__ -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -D__EXT -fno-builtin-log -fno-strict-aliasing. - Global option flags:
-DSMP -DEARLY_AP_STARTUP -DVIMAGE -DALTQ -DDEV_NETMAP -D_STRINGS_H_INCLUDED -D_UNISTD_H_INCLUDED. - Include paths:
devs,devs/contrib/ck/include,devs/include_<cpu>,devs/qnx,devs/qnx-gen,devs/sys-nto. - Debug-only flags (
-DINVARIANTS -DINVARIANT_SUPPORT -DKTR) are added only when thedbgfeature is on (thediagvariant in the QNX makefiles). - Disabled by default. Targets opt in with
features = ["io_pkt_ddk"]. It is registered per toolchain instance infeatures/custom/qnx/make_cc_features.bzl. rules/gcc.bzlgenerates the feature per QNX toolchain instance. It passes the package'starget_dirfilegroup label andtc_cpu.
C standard selection fix and new c_std_c99 feature
-
Added the
c_std_c99marker (-std=iso9899:1999) and registered it, together withgnu11, as an opt-in known feature for QNX. It is also registered for Linux. -
requires_any_ofis an OR, so the old constraints (not_gnu11/not_c99) could make-std=c11and-std=gnu11apply together. Each-stdflag now has a single constraint:Enabled feature Flag none (default) -std=c11gnu11-std=gnu11c_std_c99-std=iso9899:1999(wins ifgnu11is also set)
Tests
- Added
tests/qnx_ddkwith a build-onlyio_pkt_ddk_testtarget. It checks that the DDK headers compile with the feature, and fails if the include path falls back to the non-DDK QNXsys/param.h.
Misc
- Added
teststo the copyright checker in the rootBUILD. - Ignored
.vscode/in.gitignore.
Notes
- The
io_pkt_ddkinclude paths must not containdevs/sys. It would shadow the QNXlimits.h,errno.handstddef.hwith the FreeBSD versions, which breaks builds (for example missingCHAR_BIT,errnoandsize_t). - The test is not part of any
test_suite. - The test's license header is duplicated and should be cleaned up.
How to verify
cd tests
bazel build --config x86_64-qnx //qnx_ddk:io_pkt_ddk_testThe compile line should include -std=iso9899:1999, the -D__FreeBSD__ -D_KERNEL ... flags and the devs include paths, and should not include -std=c11 or -std=gnu11.
Acceptance criteria
-
io_pkt_ddkis off by default and does not change the flags of targets that don't request it. -
//qnx_ddk:io_pkt_ddk_testbuilds forx86_64-qnx. Note: I haven't run it foraarch64-qnx. - Only one
-std=flag is emitted for each of: default,gnu11,c_std_c99. - Linux toolchains are unaffected, apart from the new opt-in
c_std_c99feature.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
- StatusShow more project fieldsDone
Activity