[iasl] Fix errors found using gcc -Wall (RHBZ#856856).
Richard W.M. Jones
rjones at fedoraproject.org
Wed Oct 10 15:17:00 UTC 2012
commit dd9ffcc39fcb84cfd6b9db27936f0ee4b5f95dd7
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Wed Oct 10 15:07:08 2012 +0200
Fix errors found using gcc -Wall (RHBZ#856856).
iasl-const-correctness.patch | 42 +++++++++++++++++++++++++++++++++++++++++
iasl-no-strict-aliasing.patch | 15 ++++++++++++++
iasl-nsdump.patch | 19 ++++++++++++++++++
iasl-pointer-casts.patch | 36 +++++++++++++++++++++++++++++++++++
iasl.spec | 16 ++++++++++++++-
5 files changed, 127 insertions(+), 1 deletions(-)
---
diff --git a/iasl-const-correctness.patch b/iasl-const-correctness.patch
new file mode 100644
index 0000000..01ac429
--- /dev/null
+++ b/iasl-const-correctness.patch
@@ -0,0 +1,42 @@
+diff -ur acpica-unix-20100528.old/compiler/aslcompiler.h acpica-unix-20100528/compiler/aslcompiler.h
+--- acpica-unix-20100528.old/compiler/aslcompiler.h 2010-05-28 19:14:22.000000000 +0200
++++ acpica-unix-20100528/compiler/aslcompiler.h 2012-10-10 14:32:31.960794039 +0200
+@@ -298,7 +298,7 @@
+
+ int
+ AslCompilererror(
+- char *s);
++ const char *s);
+
+ void
+ AslCommonError (
+@@ -309,7 +309,7 @@
+ UINT32 LogicalByteOffset,
+ UINT32 Column,
+ char *Filename,
+- char *ExtraMessage);
++ const char *ExtraMessage);
+
+ void
+ AePrintException (
+diff -ur acpica-unix-20100528.old/compiler/aslerror.c acpica-unix-20100528/compiler/aslerror.c
+--- acpica-unix-20100528.old/compiler/aslerror.c 2010-05-28 19:14:22.000000000 +0200
++++ acpica-unix-20100528/compiler/aslerror.c 2012-10-10 14:32:07.160793635 +0200
+@@ -470,7 +470,7 @@
+ UINT32 LogicalByteOffset,
+ UINT32 Column,
+ char *Filename,
+- char *ExtraMessage)
++ const char *ExtraMessage)
+ {
+ UINT32 MessageSize;
+ char *MessageBuffer = NULL;
+@@ -656,7 +656,7 @@
+
+ int
+ AslCompilererror (
+- char *CompilerMessage)
++ const char *CompilerMessage)
+ {
+
+ AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber,
diff --git a/iasl-no-strict-aliasing.patch b/iasl-no-strict-aliasing.patch
new file mode 100644
index 0000000..e143642
--- /dev/null
+++ b/iasl-no-strict-aliasing.patch
@@ -0,0 +1,15 @@
+Add -fno-strict-aliasing flag since the code does a lot of unsafe type
+punning and it's too difficult to fix all that.
+
+diff -ur acpica-unix-20100528.old/compiler/Makefile acpica-unix-20100528/compiler/Makefile
+--- acpica-unix-20100528.old/compiler/Makefile 2012-10-10 14:26:24.910788185 +0200
++++ acpica-unix-20100528/compiler/Makefile 2012-10-10 14:33:10.570794691 +0200
+@@ -125,7 +125,7 @@
+ ../osunixxf.c
+
+ NOMAN= YES
+-CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include -I../compiler
++CFLAGS+= -Wall -fno-strict-aliasing -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include -I../compiler
+
+ #YACC= yacc
+ YACC= bison
diff --git a/iasl-nsdump.patch b/iasl-nsdump.patch
new file mode 100644
index 0000000..d180455
--- /dev/null
+++ b/iasl-nsdump.patch
@@ -0,0 +1,19 @@
+ACPI_CAST_PTR casts via an integral type (ACPI_UINTPTR_T) which can be
+a different size from the ACPI_PHYSICAL_ADDRESS. gcc doesn't like
+this. The number is really just an int, so just print it using "%d".
+
+diff -ur acpica-unix-20100528.old/namespace/nsdump.c acpica-unix-20100528/namespace/nsdump.c
+--- acpica-unix-20100528.old/namespace/nsdump.c 2010-05-28 19:14:40.000000000 +0200
++++ acpica-unix-20100528/namespace/nsdump.c 2012-10-10 14:38:18.760798740 +0200
+@@ -353,9 +353,9 @@
+ {
+ case ACPI_TYPE_PROCESSOR:
+
+- AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
++ AcpiOsPrintf ("ID %X Len %.4X Addr %d\n",
+ ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
+- ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
++ ObjDesc->Processor.Address);
+ break;
+
+
diff --git a/iasl-pointer-casts.patch b/iasl-pointer-casts.patch
new file mode 100644
index 0000000..af78d44
--- /dev/null
+++ b/iasl-pointer-casts.patch
@@ -0,0 +1,36 @@
+On ppc64, these unsafe casts cause the pointers to be truncated,
+causing a seg fault when compiling seabios
+(https://bugzilla.redhat.com/show_bug.cgi?id=856856).
+
+diff -ur acpica-unix-20100528.old/compiler/aslcompiler.y acpica-unix-20100528/compiler/aslcompiler.y
+--- acpica-unix-20100528.old/compiler/aslcompiler.y 2010-05-28 19:14:22.000000000 +0200
++++ acpica-unix-20100528/compiler/aslcompiler.y 2012-10-10 14:29:48.530791373 +0200
+@@ -2349,7 +2349,7 @@
+ ;
+
+ String
+- : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);}
++ : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (UINT64) AslCompilerlval.s);}
+ ;
+
+ ConstTerm
+@@ -2955,14 +2955,14 @@
+
+ NameString
+ : NameSeg {}
+- | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);}
+- | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");}
+- | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");}
+- | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");}
++ | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (UINT64) AslCompilerlval.s);}
++ | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (UINT64) "IO");}
++ | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (UINT64) "DMA");}
++ | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (UINT64) "IRQ");}
+ ;
+
+ NameSeg
+- : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) AslCompilerlval.s);}
++ : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (UINT64) AslCompilerlval.s);}
+ ;
+
+
diff --git a/iasl.spec b/iasl.spec
index b6b31c0..45a931c 100644
--- a/iasl.spec
+++ b/iasl.spec
@@ -1,6 +1,6 @@
Name: iasl
Version: 20100528
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: Intel ASL compiler/decompiler
Group: Development/Languages
@@ -13,6 +13,13 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: bison patchutils flex
+# Patches to fix errors found using gcc -Wall. Patch 4 is most
+# serious since it fixes a segfault in the compiler (RHBZ#856856).
+Patch1: iasl-no-strict-aliasing.patch
+Patch2: iasl-const-correctness.patch
+Patch3: iasl-nsdump.patch
+Patch4: iasl-pointer-casts.patch
+
%description
iasl compiles ASL (ACPI Source Language) into AML (ACPI Machine Language),
@@ -22,6 +29,10 @@ disassemble AML, for debugging purposes.
%prep
%setup -q -n acpica-unix-%{version}
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
cp -p %{SOURCE1} README.Fedora
cp -p %{SOURCE2} iasl.1
@@ -52,6 +63,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Wed Oct 10 2012 Richard W.M. Jones <rjones at redhat.com> - 20100528-6
+- Fix errors found using gcc -Wall (RHBZ#856856).
+
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 20100528-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
More information about the scm-commits
mailing list