Skip to content

Commit d0b37f8

Browse files
lifeixlijinxia
authored andcommitted
hv: reloc: define data structure and MACRO when necessary
Some data structure are only used under some condition. This patch move data structure definition under its corresponding contion. Otherwise, it would violate MISRA-C 413 S "User type declared but not used in code analysed". For MACRO, it would violate MISRA-C 628 S "Macro not used in translation unit". Tracked-On: #861 Signed-off-by: Li, Fei1 <fei1.li@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent d043171 commit d0b37f8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

hypervisor/boot/reloc.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@
88
#include <reloc.h>
99
#include <vm0_boot.h>
1010

11-
struct Elf64_Dyn {
12-
uint64_t d_tag;
13-
uint64_t d_ptr;
14-
};
15-
11+
#ifdef CONFIG_RELOC
1612
#define DT_NULL 0 /* end of .dynamic section */
1713
#define DT_RELA 7 /* relocation table */
1814
#define DT_RELASZ 8 /* size of reloc table */
1915
#define DT_RELAENT 9 /* size of one entry */
2016

17+
struct Elf64_Dyn {
18+
uint64_t d_tag;
19+
uint64_t d_ptr;
20+
};
21+
2122
struct Elf64_Rel {
2223
uint64_t r_offset;
2324
uint64_t r_info;
2425
uint64_t reserved;
2526
};
27+
#endif
2628

2729
static inline uint64_t elf64_r_type(uint64_t i)
2830
{

0 commit comments

Comments
 (0)