From d0b37f8ea2011acfad22c959c74eaadbf2075023 Mon Sep 17 00:00:00 2001 From: "Li, Fei1" Date: Mon, 26 Nov 2018 18:15:00 +0800 Subject: [PATCH] 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 Acked-by: Eddie Dong --- hypervisor/boot/reloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hypervisor/boot/reloc.c b/hypervisor/boot/reloc.c index 44cd59745..3fda34dc9 100644 --- a/hypervisor/boot/reloc.c +++ b/hypervisor/boot/reloc.c @@ -8,21 +8,23 @@ #include #include -struct Elf64_Dyn { - uint64_t d_tag; - uint64_t d_ptr; -}; - +#ifdef CONFIG_RELOC #define DT_NULL 0 /* end of .dynamic section */ #define DT_RELA 7 /* relocation table */ #define DT_RELASZ 8 /* size of reloc table */ #define DT_RELAENT 9 /* size of one entry */ +struct Elf64_Dyn { + uint64_t d_tag; + uint64_t d_ptr; +}; + struct Elf64_Rel { uint64_t r_offset; uint64_t r_info; uint64_t reserved; }; +#endif static inline uint64_t elf64_r_type(uint64_t i) {