acpica-tools/gcc9.patch
Al Stone 65077e748a Add a fix for an arm7hl problem found by GCC9
Signed-off-by: Al Stone <ahs3@redhat.com>
2019-05-13 10:38:07 -06:00

80 lines
3.0 KiB
Diff

diff -Naur acpica-unix2-20190108/source/common/dmrestag.c acpica-unix2-20190108-patch/source/common/dmrestag.c
--- acpica-unix2-20190108/source/common/dmrestag.c 2019-01-08 14:10:31.000000000 -0700
+++ acpica-unix2-20190108-patch/source/common/dmrestag.c 2019-05-10 13:57:10.768398838 -0600
@@ -710,10 +710,25 @@
* end up in the final compiled AML, it's just an appearance issue for the
* disassembled code.
*/
- Pathname[strlen (Pathname) - ACPI_NAME_SIZE] = 0;
- strncat (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
- strcat (Pathname, ".");
- strncat (Pathname, Tag, ACPI_NAME_SIZE);
+ {
+ /*
+ * GCC9 forces some contortions when non-null-terminated char
+ * strings are being used; using strncat() might be simpler,
+ * but the assumption that the string is null-terminated gets
+ * checked and AML does not always guarantee that is true.
+ */
+ char *tmp;
+ unsigned char dot = '.';
+
+ Pathname[strlen (Pathname) - ACPI_NAME_SIZE] = 0;
+ tmp = Pathname + strlen(Pathname);
+ memcpy (tmp, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
+ tmp += ACPI_NAME_SIZE;
+ memcpy (tmp, &dot, 1);
+ tmp++;
+ memcpy (tmp, Tag, ACPI_NAME_SIZE);
+ tmp += ACPI_NAME_SIZE;
+ }
/* Internalize the namepath to AML format */
diff -Naur acpica-unix2-20190108/source/compiler/aslcodegen.c acpica-unix2-20190108-patch/source/compiler/aslcodegen.c
--- acpica-unix2-20190108/source/compiler/aslcodegen.c 2019-05-10 13:40:12.827411487 -0600
+++ acpica-unix2-20190108-patch/source/compiler/aslcodegen.c 2019-05-10 13:25:34.667850614 -0600
@@ -450,11 +450,11 @@
*/
if (AcpiGbl_CaptureComments)
{
- strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, ACPI_NAME_SIZE);
+ memcpy(AcpiGbl_TableSig, Child->Asl.Value.String, ACPI_NAME_SIZE);
Child->Asl.Value.String = ACPI_SIG_XXXX;
}
- strncpy (AslGbl_TableHeader.Signature, Child->Asl.Value.String, ACPI_NAME_SIZE);
+ memcpy (AslGbl_TableHeader.Signature, Child->Asl.Value.String, ACPI_NAME_SIZE);
/* Revision */
@@ -471,12 +471,12 @@
/* OEMID */
Child = Child->Asl.Next;
- strncpy (AslGbl_TableHeader.OemId, Child->Asl.Value.String, ACPI_OEM_ID_SIZE);
+ memcpy (AslGbl_TableHeader.OemId, Child->Asl.Value.String, ACPI_OEM_ID_SIZE);
/* OEM TableID */
Child = Child->Asl.Next;
- strncpy (AslGbl_TableHeader.OemTableId, Child->Asl.Value.String, ACPI_OEM_TABLE_ID_SIZE);
+ memcpy (AslGbl_TableHeader.OemTableId, Child->Asl.Value.String, ACPI_OEM_TABLE_ID_SIZE);
/* OEM Revision */
diff -Naur acpica-unix2-20190509.orig/source/include/platform/aclinux.h acpica-unix2-20190509/source/include/platform/aclinux.h
--- acpica-unix2-20190509.orig/source/include/platform/aclinux.h 2019-05-13 10:15:12.878784098 -0600
+++ acpica-unix2-20190509/source/include/platform/aclinux.h 2019-05-13 10:33:52.505004418 -0600
@@ -231,6 +231,10 @@
#define __cdecl
#endif
+#ifdef __ARM_ARCH_7__
+#undef ACPI_MISALIGNMENT_NOT_SUPPORTED
+#endif
+
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define ACPI_BIG_ENDIAN
#endif