diff mbox

[for-next,8/9] xsm: add bodge when compiling with llvm coverage support

Message ID 20171026091938.59247-9-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné Oct. 26, 2017, 9:19 a.m. UTC
llvm coverage support seems to disable some of the optimizations
needed in order to compile xsm, and the end result is that references
to __xsm_action_mismatch_detected are left in the object files.

Since coverage support cannot be used in production, introduce
__xsm_action_mismatch_detected for llvm coverage builds.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
---
 xen/include/xsm/dummy.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Daniel De Graaf Oct. 26, 2017, 3:12 p.m. UTC | #1
On 10/26/2017 05:19 AM, Roger Pau Monne wrote:
> llvm coverage support seems to disable some of the optimizations
> needed in order to compile xsm, and the end result is that references
> to __xsm_action_mismatch_detected are left in the object files.
> 
> Since coverage support cannot be used in production, introduce
> __xsm_action_mismatch_detected for llvm coverage builds.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Jan Beulich Nov. 7, 2017, 5:18 p.m. UTC | #2
>>> On 26.10.17 at 11:19, <roger.pau@citrix.com> wrote:
> --- a/xen/include/xsm/dummy.h
> +++ b/xen/include/xsm/dummy.h
> @@ -24,8 +24,22 @@
>   * if references remain at link time.
>   */
>  #define LINKER_BUG_ON(x) do { if (x) __xsm_action_mismatch_detected(); } while (0)
> +
> +#ifdef CONFIG_LLVM_COVERAGE
> +/*
> + * LLVM coverage support seems to disable some of the optimizations needed in
> + * order for XSM to compile. Since coverage should not be used in production
> + * provide an implementation of __xsm_action_mismatch_detected to satisfy the
> + * linker.
> + */
> +static void __xsm_action_mismatch_detected(void)
> +{
> +    ASSERT_UNREACHABLE();
> +}

I'm pretty sure this wants to be "inline".

Jan
diff mbox

Patch

diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index b2cd56cdc5..674dc8ea1b 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -24,8 +24,22 @@ 
  * if references remain at link time.
  */
 #define LINKER_BUG_ON(x) do { if (x) __xsm_action_mismatch_detected(); } while (0)
+
+#ifdef CONFIG_LLVM_COVERAGE
+/*
+ * LLVM coverage support seems to disable some of the optimizations needed in
+ * order for XSM to compile. Since coverage should not be used in production
+ * provide an implementation of __xsm_action_mismatch_detected to satisfy the
+ * linker.
+ */
+static void __xsm_action_mismatch_detected(void)
+{
+    ASSERT_UNREACHABLE();
+}
+#else
 /* DO NOT implement this function; it is supposed to trigger link errors */
 void __xsm_action_mismatch_detected(void);
+#endif
 
 #ifdef CONFIG_XSM