Skip to content

Commit

Permalink
swtpm: Fix build error on 32bit systems due to inconsistent _FILE_OFF…
Browse files Browse the repository at this point in the history
…SET_BITS

Fix the following build error due to missing include of config.h where
_FILE_OFFSET_BITS is defined and leads to different sizes of off_t depending
on whether it is defined and/or included:

tpmlib.h:76:7: error: type of 'tpmlib_handle_tcg_tpm2_cmd_header' does not match original declaration [-Werror=lto-type-mismatch]
   76 | off_t tpmlib_handle_tcg_tpm2_cmd_header(const unsigned char *command,
      |       ^
tpmlib.c:576:7: note: return value type mismatch
  576 | off_t tpmlib_handle_tcg_tpm2_cmd_header(const unsigned char *command,
      |       ^
tpmlib.c:576:7: note: 'tpmlib_handle_tcg_tpm2_cmd_header' was previously declared here
tpmlib.c:576:7: note: code may be misoptimized unless '-fno-strict-aliasing' is used
lto1: all warnings being treated as errors
lto-wrapper: fatal error: gcc returned 1 exit status

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2334600
Fixes: 599e243 ("configure.ac: enable 64-bit file API on 32-bit systems")
Signed-off-by: Stefan Berger <[email protected]>
  • Loading branch information
stefanberger committed Dec 27, 2024
1 parent 3a8e779 commit 3d6a8b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/swtpm/mainloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
It reads a TPM request, processes the ordinal, and writes the response
*/

#include <config.h>

#include <errno.h>
#include <stdio.h>
#include <stdint.h>
Expand Down
2 changes: 2 additions & 0 deletions src/swtpm/tpmlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#ifndef _SWTPM_TPMLIB_H_
#define _SWTPM_TPMLIB_H_

#include <config.h> /* ensure consistent definition of _FILE_OFFSET_BITS */

#include <stdint.h>
#include <stdbool.h>

Expand Down

0 comments on commit 3d6a8b7

Please sign in to comment.