diff mbox series

acpica: fwts_acpica: fix linker issues on Fedora (LP: #1712572)

Message ID 20170829150426.5935-1-colin.king@canonical.com
State Accepted
Headers show
Series acpica: fwts_acpica: fix linker issues on Fedora (LP: #1712572) | expand

Commit Message

Colin Ian King Aug. 29, 2017, 3:04 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

When building for ppcC64el on Fedora we get linker issues with
undefined symbols. It seems that while this is not an issue on
Debian systems, the linker seems to require these sysbols to be
defined even if we don't actually use them. Make these functions
void no-ops that throw warnings if they are used.  This has been
tested on Fedora 25 and also Ubuntu and is able to build and
pass the regression tests.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/fwts_acpica.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

Comments

Alex Hung Aug. 30, 2017, 5:38 a.m. UTC | #1
On 2017-08-29 08:04 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> When building for ppcC64el on Fedora we get linker issues with
> undefined symbols. It seems that while this is not an issue on
> Debian systems, the linker seems to require these sysbols to be
> defined even if we don't actually use them. Make these functions
> void no-ops that throw warnings if they are used.  This has been
> tested on Fedora 25 and also Ubuntu and is able to build and
> pass the regression tests.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpica/fwts_acpica.c | 36 ++++++++++++++++++++++++++++++++++++
>   1 file changed, 36 insertions(+)
> 
> diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
> index b85e18d6..b0cefe73 100644
> --- a/src/acpica/fwts_acpica.c
> +++ b/src/acpica/fwts_acpica.c
> @@ -1326,4 +1326,40 @@ fwts_list *fwts_acpica_get_object_names(int type)
>   	return list;
>   }
>   
> +#else
> +
> +static void __void_func(const char *funcname)
> +{
> +	fprintf(stderr, "fwts ACPICA library: unexpected call to %s()\n", funcname);
> +	exit(EXIT_FAILURE);
> +}
> +
> +#define VOID_FUNC(name) void name(void) { __void_func(#name); }
> +
> +/*
> + *  With ACPI disabled, these functions should never
> + *  be called. We should defined this otherwise we will
> + *  get linker errors with some autotools/linker combos
> + */
> +VOID_FUNC(AcpiGbl_IgnoreErrors)
> +VOID_FUNC(AcpiGbl_RegionFillValue)
> +
> +VOID_FUNC(AcpiOsCreateSemaphore)
> +VOID_FUNC(AcpiOsDeleteSemaphore)
> +VOID_FUNC(AcpiOsExecute)
> +VOID_FUNC(AcpiOsGetRootPointer)
> +VOID_FUNC(AcpiOsPrintf)
> +VOID_FUNC(AcpiOsReadPciConfiguration)
> +VOID_FUNC(AcpiOsReadPort)
> +VOID_FUNC(AcpiOsSignal)
> +VOID_FUNC(AcpiOsSignalSemaphore)
> +VOID_FUNC(AcpiOsSleep)
> +VOID_FUNC(AcpiOsVprintf)
> +VOID_FUNC(AcpiOsWaitSemaphore)
> +
> +VOID_FUNC(AeTableOverride)
> +
> +VOID_FUNC(MpSaveGpioInfo)
> +VOID_FUNC(MpSaveSerialInfo)
> +
>   #endif
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Aug. 30, 2017, 5:41 a.m. UTC | #2
On 08/29/2017 11:04 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> When building for ppcC64el on Fedora we get linker issues with
> undefined symbols. It seems that while this is not an issue on
> Debian systems, the linker seems to require these sysbols to be
> defined even if we don't actually use them. Make these functions
> void no-ops that throw warnings if they are used.  This has been
> tested on Fedora 25 and also Ubuntu and is able to build and
> pass the regression tests.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpica/fwts_acpica.c | 36 ++++++++++++++++++++++++++++++++++++
>   1 file changed, 36 insertions(+)
> 
> diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
> index b85e18d6..b0cefe73 100644
> --- a/src/acpica/fwts_acpica.c
> +++ b/src/acpica/fwts_acpica.c
> @@ -1326,4 +1326,40 @@ fwts_list *fwts_acpica_get_object_names(int type)
>   	return list;
>   }
>   
> +#else
> +
> +static void __void_func(const char *funcname)
> +{
> +	fprintf(stderr, "fwts ACPICA library: unexpected call to %s()\n", funcname);
> +	exit(EXIT_FAILURE);
> +}
> +
> +#define VOID_FUNC(name) void name(void) { __void_func(#name); }
> +
> +/*
> + *  With ACPI disabled, these functions should never
> + *  be called. We should defined this otherwise we will
> + *  get linker errors with some autotools/linker combos
> + */
> +VOID_FUNC(AcpiGbl_IgnoreErrors)
> +VOID_FUNC(AcpiGbl_RegionFillValue)
> +
> +VOID_FUNC(AcpiOsCreateSemaphore)
> +VOID_FUNC(AcpiOsDeleteSemaphore)
> +VOID_FUNC(AcpiOsExecute)
> +VOID_FUNC(AcpiOsGetRootPointer)
> +VOID_FUNC(AcpiOsPrintf)
> +VOID_FUNC(AcpiOsReadPciConfiguration)
> +VOID_FUNC(AcpiOsReadPort)
> +VOID_FUNC(AcpiOsSignal)
> +VOID_FUNC(AcpiOsSignalSemaphore)
> +VOID_FUNC(AcpiOsSleep)
> +VOID_FUNC(AcpiOsVprintf)
> +VOID_FUNC(AcpiOsWaitSemaphore)
> +
> +VOID_FUNC(AeTableOverride)
> +
> +VOID_FUNC(MpSaveGpioInfo)
> +VOID_FUNC(MpSaveSerialInfo)
> +
>   #endif
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
index b85e18d6..b0cefe73 100644
--- a/src/acpica/fwts_acpica.c
+++ b/src/acpica/fwts_acpica.c
@@ -1326,4 +1326,40 @@  fwts_list *fwts_acpica_get_object_names(int type)
 	return list;
 }
 
+#else
+
+static void __void_func(const char *funcname)
+{
+	fprintf(stderr, "fwts ACPICA library: unexpected call to %s()\n", funcname);
+	exit(EXIT_FAILURE);
+}
+
+#define VOID_FUNC(name) void name(void) { __void_func(#name); }
+
+/*
+ *  With ACPI disabled, these functions should never
+ *  be called. We should defined this otherwise we will
+ *  get linker errors with some autotools/linker combos
+ */
+VOID_FUNC(AcpiGbl_IgnoreErrors)
+VOID_FUNC(AcpiGbl_RegionFillValue)
+
+VOID_FUNC(AcpiOsCreateSemaphore)
+VOID_FUNC(AcpiOsDeleteSemaphore)
+VOID_FUNC(AcpiOsExecute)
+VOID_FUNC(AcpiOsGetRootPointer)
+VOID_FUNC(AcpiOsPrintf)
+VOID_FUNC(AcpiOsReadPciConfiguration)
+VOID_FUNC(AcpiOsReadPort)
+VOID_FUNC(AcpiOsSignal)
+VOID_FUNC(AcpiOsSignalSemaphore)
+VOID_FUNC(AcpiOsSleep)
+VOID_FUNC(AcpiOsVprintf)
+VOID_FUNC(AcpiOsWaitSemaphore)
+
+VOID_FUNC(AeTableOverride)
+
+VOID_FUNC(MpSaveGpioInfo)
+VOID_FUNC(MpSaveSerialInfo)
+
 #endif