diff --git a/include/zephyr/device.h b/include/zephyr/device.h index 24c4f88c16ebc4..6452a9baf247fe 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -62,13 +62,6 @@ extern "C" { */ typedef int16_t device_handle_t; -/* - * The build assert will fail if device_handle_t changes size, which - * means the alignment directives in the linker scripts and in - * `gen_handles.py` must be updated. - */ -BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts"); - /** @brief Flag value used in lists of device handles to separate * distinct groups. * diff --git a/scripts/build/gen_handles.py b/scripts/build/gen_handles.py index 4f675cca1d9f21..511a03fc4eaa8d 100755 --- a/scripts/build/gen_handles.py +++ b/scripts/build/gen_handles.py @@ -105,7 +105,7 @@ def c_handle_array(dev, handles, extra_support_handles=0): 'DEVICE_HANDLE_ENDS', ] return [ - 'const device_handle_t __aligned(2) __attribute__((__section__(".__device_handles_pass2")))', + 'const Z_DECL_ALIGN(device_handle_t) __attribute__((__section__(".__device_handles_pass2")))', '{:s}[] = {{ {:s} }};'.format(dev.ordinals.sym.name, ', '.join(handles)), ]