-
Notifications
You must be signed in to change notification settings - Fork 22
NVMem: fix build issue when FILE_BACKED_NV is set to 0 #7
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
NVMem: fix build issue when FILE_BACKED_NV is set to 0 #7
Conversation
The pthread library is only required for the simulator, but we don't build it, so let's use this workaround to make the `cofigure` happy and avoid checks that the pthread is available. When the TrustedComputingGroup/TPM#7 will be merged we can revert this commit and call `./configure --disable-pthread`. With this patch we can then avoid using our fork in Coconut and switch to using the upstream version directly (in the next commit). Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
The next commit switches to TCG TPM, but there is a problem when the
`FILE_BACKED_NV` macro is set to `NO`. It produces the following compile
error because a variable is not used:
Platform/src/NVMem.c: In function ‘_plat__NVDisable’:
Platform/src/NVMem.c:185:9: error: unused variable ‘delete’ [-Werror=unused-variable]
185 | int delete = ((intptr_t)platParameter != 0)
| ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:2674: Platform/src/libplatform_a-NVMem.o] Error 1
This commit can be reverted when the following PR will be merged:
TrustedComputingGroup/TPM#7
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
TPMCmd/Platform/src/NVMem.c
Outdated
| #if FILE_BACKED_NV | ||
| if(NULL != s_NvFile) | ||
| { | ||
| int delete = ((intptr_t)platParameter != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather leave the interpretation of the parameter (the check and cast to boolean) outside the #if because I don't want the meaning of the parameter to depend upon the #ifdef. Instead just add a reference to the variable in a #else (or immediately after calculating it), to silence the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
I'll add NOT_REFERENCED(delete) immediately after calculating it.
The pthread library is only required for the simulator, but we don't build it, so let's use this workaround to make the `cofigure` happy and avoid checks that the pthread is available. When the TrustedComputingGroup/TPM#7 will be merged we can revert this commit and call `./configure --disable-pthread`. With this patch we can then avoid using our fork in Coconut and switch to using the upstream version directly (in the next commit). Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
The next commit switches to TCG TPM, but there is a problem when the
`FILE_BACKED_NV` macro is set to `NO`. It produces the following compile
error because a variable is not used:
Platform/src/NVMem.c: In function ‘_plat__NVDisable’:
Platform/src/NVMem.c:185:9: error: unused variable ‘delete’ [-Werror=unused-variable]
185 | int delete = ((intptr_t)platParameter != 0)
| ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:2674: Platform/src/libplatform_a-NVMem.o] Error 1
This commit can be reverted when the following PR will be merged:
TrustedComputingGroup/TPM#7
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
If FILE_BACKED_NV is set to NO(0), the `delete` variable is unused,
causing a compiler warning:
Platform/src/NVMem.c: In function ‘_plat__NVDisable’:
Platform/src/NVMem.c:185:9: error: unused variable ‘delete’ [-Werror=unused-variable]
185 | int delete = ((intptr_t)platParameter != 0)
| ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:2674: Platform/src/libplatform_a-NVMem.o] Error 1
Use NOT_REFERENCED() to silence this warning.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
f11e90e to
3f06329
Compare
|
v2:
|
bradlitterell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
The pthread library is only required for the simulator, but we don't build it, so let's use this workaround to make the `configure` happy and avoid checks that the pthread is available. When the TrustedComputingGroup/TPM#7 will be merged we can revert this commit and call `./configure --disable-pthread`. With this patch we can then avoid using our fork in Coconut and switch to using the upstream version directly (in the next commit). Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
The next commit switches to TCG TPM, but there is a problem when the
`FILE_BACKED_NV` macro is set to `NO`. It produces the following compile
error because a variable is not used:
Platform/src/NVMem.c: In function ‘_plat__NVDisable’:
Platform/src/NVMem.c:185:9: error: unused variable ‘delete’ [-Werror=unused-variable]
185 | int delete = ((intptr_t)platParameter != 0)
| ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:2674: Platform/src/libplatform_a-NVMem.o] Error 1
This commit can be reverted when the following PR will be merged:
TrustedComputingGroup/TPM#7
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
The pthread library is only required by the TPM simulator, which we don't build (we need only the library). Since libcrt doesn't support pthreads, and the upstream now supports --disable-pthread (TrustedComputingGroup/TPM#7), we can safely disable pthread support at configure time. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This reverts commit 5b99b1e. TrustedComputingGroup/TPM#7 is now merged, so we can safely drop this workaround, since we disabled pthread check in the previous commit. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
If FILE_BACKED_NV is set to NO(0), the
deletevariable is unused, causing a compiler warning:Use NOT_REFERENCED() to silence this warning.