ipc: cc_version: use fixed length for CC_DESC

There is a bug in the Cadence XCC compiler that give us different
linkage section sizes for flex length struct sof_ipc_ext_data in
ELF file compared to GCC version. And there are appending struct
in the same ELF section, this will bring wrong offset for those
struct binary in ELF file.

Example:
When the CC_DESC is " RG-2017.8-linux", we should have struct
length for 0x50 in header size, but the binary length in ELF file
is 0x4c. When the CC_DESC is " RG-2017.8-win", size are both 0x4c

All existing compiler description has length less than
32 bytes. So use a fixed length 32 in this structure.

ABI version changes to 3.15.0

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
This commit is contained in:
Pan Xiuli 2020-03-26 11:27:30 +08:00 committed by Liam Girdwood
parent 75ba94b1e3
commit beea8e56fb
3 changed files with 9 additions and 5 deletions

View File

@ -122,7 +122,7 @@ struct sof_ipc_cc_version {
uint8_t name[16]; /* null terminated compiler name */
uint8_t optim[4]; /* null terminated compiler -O flag value */
uint8_t desc[]; /* null terminated compiler description */
uint8_t desc[32]; /* null terminated compiler description */
} __attribute__((packed));
/* extended data: Probe setup */

View File

@ -29,7 +29,7 @@
/** \brief SOF ABI version major, minor and patch numbers */
#define SOF_ABI_MAJOR 3
#define SOF_ABI_MINOR 14
#define SOF_ABI_MINOR 15
#define SOF_ABI_PATCH 0
/** \brief SOF ABI version number. Format within 32bit word is MMmmmppp */

View File

@ -19,12 +19,16 @@
field = CC_OPTIMIZE_FLAGS, \
field[ARRAY_SIZE(((struct sof_ipc_cc_version *)(0))->optim) - 1] = 0
/* copy CC_DESC to arrays during compilation time */
#define CC_DESC_COPY(field) \
field = CC_DESC, \
field[ARRAY_SIZE(((struct sof_ipc_cc_version *)(0))->desc) - 1] = 0
const struct sof_ipc_cc_version cc_version
__section(".fw_ready_metadata") = {
.ext_hdr = {
.hdr.cmd = SOF_IPC_FW_READY,
.hdr.size = ALIGN_UP(sizeof(struct sof_ipc_cc_version)
+ sizeof(CC_DESC), 4),
.hdr.size = sizeof(struct sof_ipc_cc_version),
.type = SOF_IPC_EXT_CC_INFO,
},
.micro = CC_MICRO,
@ -32,5 +36,5 @@ const struct sof_ipc_cc_version cc_version
.major = CC_MAJOR,
CC_NAME_COPY(.name),
CC_OPTIM_COPY(.optim),
.desc = CC_DESC,
CC_DESC_COPY(.desc),
};