-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incremental build with config changes can produce an invalid binary when userspace is enabled #42184
Comments
tagging @stephanosio |
@carlocaione Something is definitely wrong there. That issue is observed only when you do an incremental (non-clean) build after enabling the newlib, meaning this is a build system issue (cc @tejlmand @SebastianBoe). If you do a clean build after enabling the newlib, you get the following error message, which is expected because the newlib with userspace requires the kernel dynamic allocation feature (see #40686 (comment)).
Also note that the newlib + userspace combo is currently tested by the
|
Fixes: zephyrproject-rtos#42184 This commit fixes dependency issues related to kobject hash generation. Absolute path is ensured in cases where OUTPUT was provided with absolute path, as `${CMAKE_CURRENT_BINARY_DIR}`. DEPENDS referring to same file has been updated to also use `${CMAKE_CURRENT_BINARY_DIR}` to ensure they reference identical locations. The custom command renaming sections in kobject_hash.o and creating kobject_hash_renamed.o has been updated to depends on the target objects of kobj_hash_output_lib in addition to the library itself. This is needed because kobj_hash_output_lib is not a real library, and thus no library is updated when this target rebuilds. Instead the dependency must be on the object files created by kobj_hash_outplut_lib. This ensures that when object files gets rebuilt then the section renaming will also take place. The reason why both the object library itself, and its object files are required as dependencies has to do with build generators. The library is needed to ensure Makefiles can correctly have a target to invoke when the output of the custom command is missing. The object files dependency is required to ensure that custom commands are correctly brought up-to-date when the objects changes. Similar, the custom command executing gen_kobject_placeholders.py depending of kobj_prebuilt_hash_output_lib has been updated to also depend on the object files created by kobj_prebuilt_hash_output_lib. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #42184 This commit fixes dependency issues related to kobject hash generation. Absolute path is ensured in cases where OUTPUT was provided with absolute path, as `${CMAKE_CURRENT_BINARY_DIR}`. DEPENDS referring to same file has been updated to also use `${CMAKE_CURRENT_BINARY_DIR}` to ensure they reference identical locations. The custom command renaming sections in kobject_hash.o and creating kobject_hash_renamed.o has been updated to depends on the target objects of kobj_hash_output_lib in addition to the library itself. This is needed because kobj_hash_output_lib is not a real library, and thus no library is updated when this target rebuilds. Instead the dependency must be on the object files created by kobj_hash_outplut_lib. This ensures that when object files gets rebuilt then the section renaming will also take place. The reason why both the object library itself, and its object files are required as dependencies has to do with build generators. The library is needed to ensure Makefiles can correctly have a target to invoke when the output of the custom command is missing. The object files dependency is required to ensure that custom commands are correctly brought up-to-date when the objects changes. Similar, the custom command executing gen_kobject_placeholders.py depending of kobj_prebuilt_hash_output_lib has been updated to also depend on the object files created by kobj_prebuilt_hash_output_lib. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This is reproducible on
qemu_x86_64
andqemu_cortex_a53
. Derived from #42106.Compile
samples/userspace/hello_world_user
+CONFIG_NEWLIB_LIBC
.On
qemu_x86_64
:On
qemu_cortex_a53
:In both cases
z_stack_is_user_capable(stack)
is returningNULL
.In particular what's returning
NULL
isz_object_lookup()
:The
(str == s)
comparison is failing because while thestr
is correctly carrying the address of thestack
, the value ofs
retrieved from thewordlist
table is wrong.In particular in
s
we found the address of the stack as it would have been without NEWLIBC enabled.My theory is that the
wordlist
is created at the wrong time during linking (maybe too soon?) so address used in there is not definitive and wrong with respect to the addresses in the final image.The text was updated successfully, but these errors were encountered: