Skip to contentSkip to conversation

xen/arm: ffa: fix build with clang

PATCH Superseded Stewart Hildebrand 4 participants 6 messages Jan 8, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: ffa: fix build with clang

Clang 16 reports:

In file included from arch/arm/tee/ffa.c:72:
arch/arm/tee/ffa_private.h:329:17: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]

extern uint32_t __ro_after_init ffa_fw_version;
                ^

Remove the attribute from the header to resolve this. The attribute in ffa.c is the one the matters anyway.

Fixes 2f9f240a5e87 ("xen/arm: ffa: Fine granular call support")

---
It appears the variable ffa_fw_version is only used in ffa.c. Was there any rationale for exporting the symbol in 2f9f240a5e87 ("xen/arm: ffa:
Fine granular call support")? If not, perhaps we ought to make it static again and remove the declaration in the header.

---
 xen/arch/arm/tee/ffa_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/tee/ffa_private.h +1 -1
index d441c0ca5598..05368d5a88d3 100644
@@ -326,7 +326,7 @@ extern void *ffa_rx;
 extern void *ffa_tx;
 extern spinlock_t ffa_rx_buffer_lock;
 extern spinlock_t ffa_tx_buffer_lock;
-extern uint32_t __ro_after_init ffa_fw_version;
+extern uint32_t ffa_fw_version;
 extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
 bool ffa_shm_domain_destroy(struct domain *d);

base-commit: 70f5a875becc9444a959830b10a361982c31a366

Signature · 1 line
2.47.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Stewart,

Thanks a lot for the finding and the fix :-)

Quoted 6 lines · Stewart Hildebrand

Clang 16 reports:

In file included from arch/arm/tee/ffa.c:72:
arch/arm/tee/ffa_private.h:329:17: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]

Quoted 8 lines
extern uint32_t __ro_after_init ffa_fw_version;
               ^

Remove the attribute from the header to resolve this. The attribute in ffa.c is the one the matters anyway.

Fixes 2f9f240a5e87 ("xen/arm: ffa: Fine granular call support")

Cheers
Bertrand

Quoted 27 lines

---
It appears the variable ffa_fw_version is only used in ffa.c. Was there any rationale for exporting the symbol in 2f9f240a5e87 ("xen/arm: ffa:
Fine granular call support")? If not, perhaps we ought to make it static again and remove the declaration in the header.
---
xen/arch/arm/tee/ffa_private.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/tee/ffa_private.h +1 -1
index d441c0ca5598..05368d5a88d3 100644
@@ -326,7 +326,7 @@ extern void *ffa_rx;
 extern void *ffa_tx;
 extern spinlock_t ffa_rx_buffer_lock;
 extern spinlock_t ffa_tx_buffer_lock;
-extern uint32_t __ro_after_init ffa_fw_version;
+extern uint32_t ffa_fw_version;
 extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
 bool ffa_shm_domain_destroy(struct domain *d);

base-commit: 70f5a875becc9444a959830b10a361982c31a366

Signature · 1 line
2.47.1
#2 lore raw
In reply to Stewart Hildebrand

Hi,

Quoted 10 lines · Stewart Hildebrand

Clang 16 reports:

In file included from arch/arm/tee/ffa.c:72:
arch/arm/tee/ffa_private.h:329:17: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]

extern uint32_t __ro_after_init ffa_fw_version;
                ^

Remove the attribute from the header to resolve this. The attribute in ffa.c is the one the matters anyway.

Quoted 7 lines
Fixes 2f9f240a5e87 ("xen/arm: ffa: Fine granular call support")

---
It appears the variable ffa_fw_version is only used in ffa.c. Was there any rationale for exporting the symbol in 2f9f240a5e87 ("xen/arm: ffa:
Fine granular call support")? If not, perhaps we ought to make it static again and remove the declaration in the header.

The only reason I can think of is wanting to have it in the symbol table of the ELF file for some reason (livepatching?). But that's far fetched at best.

Quoted 18 lines
---
 xen/arch/arm/tee/ffa_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/tee/ffa_private.h +1 -1
index d441c0ca5598..05368d5a88d3 100644
@@ -326,7 +326,7 @@ extern void *ffa_rx;
 extern void *ffa_tx;
 extern spinlock_t ffa_rx_buffer_lock;
 extern spinlock_t ffa_tx_buffer_lock;
-extern uint32_t __ro_after_init ffa_fw_version;
+extern uint32_t ffa_fw_version;
 extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
 bool ffa_shm_domain_destroy(struct domain *d);
Quoted 1 line

base-commit: 70f5a875becc9444a959830b10a361982c31a366

IMO, it makes sense to make it static and remove this line altogether as you suggest. If it needs to be exported later on it can be adjusted as needed.

Cheers,
Alejandro

#3 lore raw

Hi,

Quoted 42 lines · Alejandro Vallejo

Hi,

Quoted 10 lines · Stewart Hildebrand

Clang 16 reports:

In file included from arch/arm/tee/ffa.c:72:
arch/arm/tee/ffa_private.h:329:17: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]

extern uint32_t __ro_after_init ffa_fw_version;
               ^

Remove the attribute from the header to resolve this. The attribute in ffa.c is the one the matters anyway.

Quoted 7 lines
Fixes 2f9f240a5e87 ("xen/arm: ffa: Fine granular call support")

---
It appears the variable ffa_fw_version is only used in ffa.c. Was there any rationale for exporting the symbol in 2f9f240a5e87 ("xen/arm: ffa:
Fine granular call support")? If not, perhaps we ought to make it static again and remove the declaration in the header.

The only reason I can think of is wanting to have it in the symbol table of the ELF file for some reason (livepatching?). But that's far fetched at best.

Quoted 16 lines

---
xen/arch/arm/tee/ffa_private.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/tee/ffa_private.h +1 -1
index d441c0ca5598..05368d5a88d3 100644
@@ -326,7 +326,7 @@ extern void *ffa_rx;
 extern void *ffa_tx;
 extern spinlock_t ffa_rx_buffer_lock;
 extern spinlock_t ffa_tx_buffer_lock;
-extern uint32_t __ro_after_init ffa_fw_version;
+extern uint32_t ffa_fw_version;
 extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
Quoted 7 lines
Quoted 3 lines
xen/arch/arm/tee/ffa_private.h +0 -0
 bool ffa_shm_domain_destroy(struct domain *d);

base-commit: 70f5a875becc9444a959830b10a361982c31a366

IMO, it makes sense to make it static and remove this line altogether as you suggest. If it needs to be exported later on it can be adjusted as needed.

Yes in fact it was made global as there was a use case at some point but this is not the case anymore so in fact we can completely remove this from the header and make it static for now.

@stewart: are you happy to push a patch doing this instead ?

Cheers
Bertrand

Quoted 2 lines

Cheers,
Alejandro

#4 lore raw
Quoted 52 lines · Bertrand Marquis

Hi,

Quoted 42 lines · Alejandro Vallejo

Hi,

Quoted 10 lines · Stewart Hildebrand

Clang 16 reports:

In file included from arch/arm/tee/ffa.c:72:
arch/arm/tee/ffa_private.h:329:17: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]

extern uint32_t __ro_after_init ffa_fw_version;
               ^

Remove the attribute from the header to resolve this. The attribute in ffa.c is the one the matters anyway.

Quoted 7 lines
Fixes 2f9f240a5e87 ("xen/arm: ffa: Fine granular call support")

---
It appears the variable ffa_fw_version is only used in ffa.c. Was there any rationale for exporting the symbol in 2f9f240a5e87 ("xen/arm: ffa:
Fine granular call support")? If not, perhaps we ought to make it static again and remove the declaration in the header.

The only reason I can think of is wanting to have it in the symbol table of the ELF file for some reason (livepatching?). But that's far fetched at best.

Quoted 16 lines

---
xen/arch/arm/tee/ffa_private.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/tee/ffa_private.h +1 -1
index d441c0ca5598..05368d5a88d3 100644
@@ -326,7 +326,7 @@ extern void *ffa_rx;
 extern void *ffa_tx;
 extern spinlock_t ffa_rx_buffer_lock;
 extern spinlock_t ffa_tx_buffer_lock;
-extern uint32_t __ro_after_init ffa_fw_version;
+extern uint32_t ffa_fw_version;
 extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
Quoted 7 lines
Quoted 3 lines
xen/arch/arm/tee/ffa_private.h +0 -0
 bool ffa_shm_domain_destroy(struct domain *d);

base-commit: 70f5a875becc9444a959830b10a361982c31a366

IMO, it makes sense to make it static and remove this line altogether as you suggest. If it needs to be exported later on it can be adjusted as needed.

Quoted 5 lines

Yes in fact it was made global as there was a use case at some point but this is not the case anymore so in fact we can completely remove this from the header and make it static for now.

@stewart: are you happy to push a patch doing this instead ?

Yes

#5 lore raw
In reply to Alejandro Vallejo
Quoted 9 lines · Alejandro Vallejo

Hi,

Quoted 4 lines · Stewart Hildebrand

It appears the variable ffa_fw_version is only used in ffa.c. Was there any rationale for exporting the symbol in 2f9f240a5e87 ("xen/arm: ffa:
Fine granular call support")? If not, perhaps we ought to make it static again and remove the declaration in the header.

The only reason I can think of is wanting to have it in the symbol table of the ELF file for some reason (livepatching?)

Livepatching can work with static symbols just fine.

Binary diffing is per TU, looking at all symbols in the object, not just global symbols.

~Andrew