Skip to contentSkip to conversation

Various acpica cleanups

PATCH In review trenn at suse.de 2 participants 19 messages Sep 19, 2012 – Sep 20, 2012 ACPI component architecture (acpica)

lore
Share & tools
lore

trenn at suse.de

#0 lore raw

cover Various acpica cleanups

Hi,

these are the patches on latest acpica needed for SUSE packaging.

Please ignore the acpidump patch.

Not sure about the "avoid void cast warning in 32-bit case" and the "Do not compile in date/time" patch. If one or both can go in that's fine, if not, it's not a big deal.

The others are cleanups/fixes which I'd appreciate if they can get applied to latest acpica code base so that we do not have to maintain them forever in our package.

Thanks,

Thomas

#1 lore raw

PATCH 1/6 acpcia: Make it possible to pass additional CFLAGS when invoking make

-D_FORTIFY_SOURCE=2 without -O2 can cause:
--
/usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
--
Such compiler flags must be able to get passed when invoking make. OpenSUSE packages require to build binaries with CLFAGS="$RPM_OPT_FLAGS", to make sure debuginfo can be obtained, security/optimization flags of the compiler for the distribution built against are passed, etc.

This patch differs between:
1) Optional CFLAGS (OPT_CFLAGS) which have a sane default:
-D_FORTIFY_SOURCE=2 -O2 and warning flags These will get replaced if OPT_CFLAGS= are passed via make OPT_CFLAGS=".." invokation
2) Elementary CFLAGS (-I includes, -Dxy, ...) which are mandatory for a successful compile run

Signed-off-by Thomas Renninger <trenn(a)suse.de>
CC arjan(a)linux.intel.com
---
 generate/unix/Makefile.config |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
generate/unix/Makefile.config +6 -2
Index: acpica-unix2-20120913/generate/unix/Makefile.config
===================================================================
@@ -38,7 +38,7 @@ CC =    gcc
 OBJDIR =     obj$(BITS)
 BINDIR =     bin$(BITS)
 BITSFLAG =   -m$(BITS)
-COMPILEOBJ = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $<
+COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $<
 LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
 INSTALLDIR = /usr/bin
 INSTALLPROG = install -D ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG)
@@ -103,11 +103,15 @@ ACPICA_HEADERS = \
 # Common compiler flags. The warning flags in addition to -Wall are not
 # automatically included in -Wall.
 #
+OPT_CFLAGS ?= \
+    -D_FORTIFY_SOURCE=2 -O2 \
+    $(CWARNINGFLAGS)
+
 CFLAGS += \
+    $(OPT_CFLAGS) \
     $(BITSFLAG) \
     -D$(HOST) \
     -D_GNU_SOURCE \
-    -D_FORTIFY_SOURCE=2 \
     -I$(ACPICA_INCLUDE)
 
 LDFLAGS += $(BITSFLAG)
#2 lore raw

PATCH 2/6 Make it possible to extend CFLAGS when invoking make

In reply to trenn at suse.de

From: Thomas Renninger <trenn(a)suse.de>

---
 acpidump/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
acpidump/Makefile +1 -1
Index: acpica-unix-20110413/acpidump/Makefile
===================================================================
@@ -1,7 +1,7 @@
 PROG= acpidump
 SRCS=	acpidump.c
 KERNEL_INCLUDE := ../include
-CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Os -s -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE) 
+override CFLAGS += -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Os -s -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
 
 all: acpidump
 $(PROG) : $(SRCS)
#3 lore raw

Re: [Devel] [patch 2/6] Make it possible to extend CFLAGS when invoking make

Quoted 4 lines · trenn(a)suse.de

From: Thomas Renninger <trenn(a)suse.de>

---
 acpidump/Makefile |    2 +-

This is from acpidump/pmtools, not from acpica, please ignore.

Thomas

#4 lore raw

PATCH 3/6 From: <[email protected]>

In reply to trenn at suse.de

acpica: Do not compile in date or time into binaries

Otherwise the data/time compiled in may cause constant re-compilation in build service environments

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 source/compiler/aslcompile.c |    9 ++-------
 source/compiler/aslutils.c   |    4 ++--
 source/include/acapps.h      |    8 ++++----
 3 files changed, 8 insertions(+), 13 deletions(-)
source/compiler/aslcompile.c +2 -7
Index: acpica-unix2-20120913/source/compiler/aslcompile.c
===================================================================
@@ -161,8 +161,6 @@ void
 AslCompilerFileHeader (
     UINT32                  FileId)
 {
-    struct tm               *NewTime;
-    time_t                  Aclock;
     char                    *Prefix = "";
 
 
@@ -202,12 +200,9 @@ AslCompilerFileHeader (
 
     /* Compilation header with timestamp */
 
-    (void) time (&Aclock);
-    NewTime = localtime (&Aclock);
-
     FlPrintFile (FileId,
-        "%sCompilation of \"%s\" - %s%s\n",
-        Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
+        "%sCompilation of \"%s\"\n",
+        Prefix, Gbl_Files[ASL_FILE_INPUT].Filename,
         Prefix);
 
     switch (FileId)
source/compiler/aslutils.c +2 -2
Index: acpica-unix2-20120913/source/compiler/aslutils.c
===================================================================
@@ -456,8 +456,8 @@ UtDisplaySummary (
     {
         /* Compiler name and version number */
 
-        FlPrintFile (FileId, "%s version %X%s [%s]\n\n",
-            ASL_COMPILER_NAME, (UINT32) ACPI_CA_VERSION, ACPI_WIDTH, __DATE__);
+        FlPrintFile (FileId, "%s version %X%s\n\n",
+            ASL_COMPILER_NAME, (UINT32) ACPI_CA_VERSION, ACPI_WIDTH);
     }
 
     /* Summary of main input and output files */
source/include/acapps.h +4 -4
Index: acpica-unix2-20120913/source/include/acapps.h
===================================================================
@@ -69,15 +69,15 @@
 /* Macros for signons and file headers */
 
 #define ACPI_COMMON_SIGNON(UtilityName) \
-    "\n%s\n%s version %8.8X%s [%s]\n%s\n\n", \
+    "\n%s\n%s version %8.8X%s\n%s\n\n", \
     ACPICA_NAME, \
-    UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \
+    UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
     ACPICA_COPYRIGHT
 
 #define ACPI_COMMON_HEADER(UtilityName, Prefix) \
-    "%s%s\n%s%s version %8.8X%s [%s]\n%s%s\n%s\n", \
+    "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
     Prefix, ACPICA_NAME, \
-    Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \
+    Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
     Prefix, ACPICA_COPYRIGHT, \
     Prefix
 
#5 lore raw

Re: [Devel] [patch 3/6] From: <[email protected]>

Quoted 2 lines · trenn(a)suse.de

acpica: Do not compile in date or time into binaries

Argh, quilt does not know the From: header...

If it's not a big deal that the date/time of compilation shows up in the binary, it would be nice to see this one getting applied, otherwise, just ignore.

Thomas

#6 lore raw

Re: [Devel] [patch 3/6] From: <[email protected]>

In reply to trenn at suse.de

Thomas,

This code is not used to insert the date/time into AML "binaries". It is used for the various listing files.

Can you explain further?

Bob

Quoted 96 lines

-----Original Message-----
From: devel-bounces(a)acpica.org [mailto:devel-bounces(a)acpica.org] On Behalf Of trenn(a)suse.de
Sent: Wednesday, September 19, 2012 4:15 AM
To: devel(a)acpica.org
Subject: [Devel] [patch 3/6] From: <idoenmez(a)suse.de>

acpica: Do not compile in date or time into binaries

Otherwise the data/time compiled in may cause constant re-compilation in build service environments

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 source/compiler/aslcompile.c |    9 ++-------
 source/compiler/aslutils.c   |    4 ++--
 source/include/acapps.h      |    8 ++++----
 3 files changed, 8 insertions(+), 13 deletions(-)

Index: acpica-unix2-20120913/source/compiler/aslcompile.c
==========================================================
=========

source/compiler/aslcompile.c +2 -7
@@ -161,8 +161,6 @@ void
 AslCompilerFileHeader (
     UINT32                  FileId)
 {
-    struct tm               *NewTime;
-    time_t                  Aclock;
     char                    *Prefix = "";
 
 
@@ -202,12 +200,9 @@ AslCompilerFileHeader (
 
     /* Compilation header with timestamp */
 
-    (void) time (&Aclock);
-    NewTime = localtime (&Aclock);
-
     FlPrintFile (FileId,
-        "%sCompilation of \"%s\" - %s%s\n",
-        Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
+        "%sCompilation of \"%s\"\n",
+        Prefix, Gbl_Files[ASL_FILE_INPUT].Filename,
         Prefix);
 
     switch (FileId)

Index: acpica-unix2-20120913/source/compiler/aslutils.c
==========================================================
=========

source/compiler/aslutils.c +2 -2
@@ -456,8 +456,8 @@ UtDisplaySummary (
     {
         /* Compiler name and version number */
 
-        FlPrintFile (FileId, "%s version %X%s [%s]\n\n",
-            ASL_COMPILER_NAME, (UINT32) ACPI_CA_VERSION, ACPI_WIDTH,
 __DATE__);
+        FlPrintFile (FileId, "%s version %X%s\n\n",
+            ASL_COMPILER_NAME, (UINT32) ACPI_CA_VERSION, ACPI_WIDTH);
     }
 
     /* Summary of main input and output files */

Index: acpica-unix2-20120913/source/include/acapps.h
==========================================================
=========

source/include/acapps.h +4 -4
@@ -69,15 +69,15 @@
 /* Macros for signons and file headers */
 
 #define ACPI_COMMON_SIGNON(UtilityName) \
-    "\n%s\n%s version %8.8X%s [%s]\n%s\n\n", \
+    "\n%s\n%s version %8.8X%s\n%s\n\n", \
     ACPICA_NAME, \
-    UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \
+    UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
     ACPICA_COPYRIGHT
 
 #define ACPI_COMMON_HEADER(UtilityName, Prefix) \
-    "%s%s\n%s%s version %8.8X%s [%s]\n%s%s\n%s\n", \
+    "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
     Prefix, ACPICA_NAME, \
-    Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH,
 __DATE__, \
+    Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
     Prefix, ACPICA_COPYRIGHT, \
     Prefix

_______________________________________________
Devel mailing list
Devel(a)acpica.org
http://lists.acpica.org/listinfo/devel

#7 lore raw

PATCH 4/6 --- source/include/platform/aclinux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

In reply to trenn at suse.de
source/include/platform/aclinux.h +1 -1
Index: acpica-unix2-20120518/source/include/platform/aclinux.h
===================================================================
@@ -98,7 +98,7 @@
 #define COMPILER_DEPENDENT_INT64    long long
 #define COMPILER_DEPENDENT_UINT64   unsigned long long
 #define ACPI_USE_NATIVE_DIVIDE
-#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (UINT32) (void *) (pthread))
+#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (UINT32) (pthread))
 #endif
 
 #ifndef __cdecl
#8 lore raw

Re: [Devel] [patch 4/6] --- source/include/platform/aclinux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

source/include/platform/aclinux.h line 101

Quoted 10 lines · trenn(a)suse.de

Index: acpica-unix2-20120518/source/include/platform/aclinux.h
===================================================================

source/include/platform/aclinux.h +1 -1
@@ -98,7 +98,7 @@
 #define COMPILER_DEPENDENT_INT64    long long
 #define COMPILER_DEPENDENT_UINT64   unsigned long long
 #define ACPI_USE_NATIVE_DIVIDE
-#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (UINT32) (void *) (pthread))
+#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (UINT32) (pthread))

Robert already stated that it's difficult to make everyone happy and that the (void *) has explicitly added to make another user (compiler?) happy.

Please ignore.

The others:
1/6, 5/6, 6/6
would be nice if they can get applied.

Thanks,

Thomas

#9 lore raw

PATCH 5/6 acpica: Fix unused result warning

In reply to trenn at suse.de

As this is the only place where this warning
happens:
'write', declared with attribute warn_unused_result [-Werror=unused-result] it might be worth fixing instead of ignoring.

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 source/tools/acpisrc/asfile.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
source/tools/acpisrc/asfile.c +5 -1
Index: acpica-unix2-20120913/source/tools/acpisrc/asfile.c
===================================================================
@@ -805,7 +805,11 @@ AsPutFile (
     /* Write the buffer to the file */
 
     FileSize = strlen (FileBuffer);
-    write (DestHandle, FileBuffer, FileSize);
+    if (write (DestHandle, FileBuffer, FileSize) < 0) {
+        perror ("Could not write to destination file");
+        close (DestHandle);
+        return -1;
+    }
 
     close (DestHandle);
 
#10 lore raw

Re: [Devel] [patch 5/6] acpica: Fix unused result warning

Thomas,

Someone also reported something similar against the acpibin utility.

However, I don't see these issue on my system running gcc 4.7.1 -- do you have any idea why I don't?

Thanks,
Bob

Quoted 40 lines

-----Original Message-----
From: devel-bounces(a)acpica.org [mailto:devel-bounces(a)acpica.org] On Behalf Of trenn(a)suse.de
Sent: Wednesday, September 19, 2012 4:15 AM
To: devel(a)acpica.org
Subject: [Devel] [patch 5/6] acpica: Fix unused result warning

As this is the only place where this warning
happens:
'write', declared with attribute warn_unused_result [-Werror=unused- result] it might be worth fixing instead of ignoring.

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 source/tools/acpisrc/asfile.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: acpica-unix2-20120913/source/tools/acpisrc/asfile.c
==========================================================
=========

source/tools/acpisrc/asfile.c +5 -1
@@ -805,7 +805,11 @@ AsPutFile (
     /* Write the buffer to the file */
 
     FileSize = strlen (FileBuffer);
-    write (DestHandle, FileBuffer, FileSize);
+    if (write (DestHandle, FileBuffer, FileSize) < 0) {
+        perror ("Could not write to destination file");
+        close (DestHandle);
+        return -1;
+    }
 
     close (DestHandle);
 

_______________________________________________
Devel mailing list
Devel(a)acpica.org
http://lists.acpica.org/listinfo/devel

#11 lore raw

PATCH 6/6 acpcia: Fixes some minor Tab vs whitespace issues in Makefiles.

In reply to trenn at suse.de
Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 generate/unix/acpibin/Makefile |    2 +-
 generate/unix/iasl/Makefile    |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
generate/unix/acpibin/Makefile +1 -1
Index: acpica-unix2-20120913/generate/unix/acpibin/Makefile
===================================================================
@@ -27,7 +27,7 @@ HEADERS = \
     $(wildcard $(ACPIBIN)/*.h)
 
 OBJECTS = \
-   	$(OBJDIR)/abcompare.o \
+	$(OBJDIR)/abcompare.o \
 	$(OBJDIR)/abmain.o \
 	$(OBJDIR)/utalloc.o \
 	$(OBJDIR)/utcache.o \
generate/unix/iasl/Makefile +3 -3
Index: acpica-unix2-20120913/generate/unix/iasl/Makefile
===================================================================
@@ -192,13 +192,13 @@ INTERMEDIATES = \
 	$(OBJDIR)/prparserparse.c
 
 MISC = \
-   	$(OBJDIR)/aslcompilerparse.h \
+	$(OBJDIR)/aslcompilerparse.h \
 	$(OBJDIR)/aslcompiler.y.h \
 	$(OBJDIR)/aslcompilerparse.output \
-   	$(OBJDIR)/dtparserparse.h \
+	$(OBJDIR)/dtparserparse.h \
 	$(OBJDIR)/dtparser.y.h \
 	$(OBJDIR)/dtparserparse.output \
-   	$(OBJDIR)/prparserparse.h \
+	$(OBJDIR)/prparserparse.h \
 	$(OBJDIR)/prparser.y.h \
 	$(OBJDIR)/prparserparse.output
 
#12 lore raw

Re: [Devel] [patch 6/6] acpcia: Fixes some minor Tab vs whitespace issues in Makefiles.

OK, thanks.
Bob

Quoted 55 lines

-----Original Message-----
From: devel-bounces(a)acpica.org [mailto:devel-bounces(a)acpica.org] On Behalf Of trenn(a)suse.de
Sent: Wednesday, September 19, 2012 4:15 AM
To: devel(a)acpica.org
Subject: [Devel] [patch 6/6] acpcia: Fixes some minor Tab vs whitespace issues in Makefiles.

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 generate/unix/acpibin/Makefile |    2 +-
 generate/unix/iasl/Makefile    |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Index: acpica-unix2-20120913/generate/unix/acpibin/Makefile
==========================================================
=========

generate/unix/acpibin/Makefile +1 -1
@@ -27,7 +27,7 @@ HEADERS = \
     $(wildcard $(ACPIBIN)/*.h)
 
 OBJECTS = \
-   	$(OBJDIR)/abcompare.o \
+	$(OBJDIR)/abcompare.o \
 	$(OBJDIR)/abmain.o \
 	$(OBJDIR)/utalloc.o \
 	$(OBJDIR)/utcache.o \

Index: acpica-unix2-20120913/generate/unix/iasl/Makefile
==========================================================
=========

generate/unix/iasl/Makefile +3 -3
@@ -192,13 +192,13 @@ INTERMEDIATES = \
 	$(OBJDIR)/prparserparse.c
 
 MISC = \
-   	$(OBJDIR)/aslcompilerparse.h \
+	$(OBJDIR)/aslcompilerparse.h \
 	$(OBJDIR)/aslcompiler.y.h \
 	$(OBJDIR)/aslcompilerparse.output \
-   	$(OBJDIR)/dtparserparse.h \
+	$(OBJDIR)/dtparserparse.h \
 	$(OBJDIR)/dtparser.y.h \
 	$(OBJDIR)/dtparserparse.output \
-   	$(OBJDIR)/prparserparse.h \
+	$(OBJDIR)/prparserparse.h \
 	$(OBJDIR)/prparser.y.h \
 	$(OBJDIR)/prparserparse.output
 

_______________________________________________
Devel mailing list
Devel(a)acpica.org
http://lists.acpica.org/listinfo/devel

#13 lore raw

[Devel] [patch 7/6] Fix Itanium build

In reply to trenn at suse.de

acpica: IA64 does not know about -m64

Otherwise you get on Itanium:
gcc: error: unrecognized command line option '-m64'

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 generate/unix/Makefile.config |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
generate/unix/Makefile.config +3 -1
Index: acpica-unix-20120913/generate/unix/Makefile.config
===================================================================
@@ -37,7 +37,9 @@ CC =    gcc
 #
 OBJDIR =     obj$(BITS)
 BINDIR =     bin$(BITS)
-BITSFLAG =   -m$(BITS)
+ifneq($(HARDWARE_NAME),ia64)
+	BITSFLAG =   -m$(BITS)
+fi
 COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $<
 LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
 INSTALLDIR = /usr/bin
#14 lore raw

Re: [Devel] [patch 7/6] Fix Itanium build - v2

acpica: IA64 does not know about -m64

Otherwise you get on Itanium:
gcc: error: unrecognized command line option '-m64'

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 generate/unix/Makefile.config |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
generate/unix/Makefile.config +3 -1
Index: acpica-unix-20120913/generate/unix/Makefile.config
===================================================================
@@ -37,7 +37,9 @@ CC =    gcc
 #
 OBJDIR =     obj$(BITS)
 BINDIR =     bin$(BITS)
-BITSFLAG =   -m$(BITS)
+ifneq ($(shell uname -m),ia64)
+	BITSFLAG =   -m$(BITS)
+endif
 COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $<
 LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
 INSTALLDIR = /usr/bin
#15 lore raw

Re: [Devel] [patch 7/6] Fix Itanium build - v2

Makefile.common already contains this line, you may be able to use $(HARDWARE_NAME)

HARDWARE_NAME := $(shell uname -m)

Quoted 38 lines

-----Original Message-----
From: devel-bounces(a)acpica.org [mailto:devel-bounces(a)acpica.org] On Behalf Of Thomas Renninger
Sent: Wednesday, September 19, 2012 8:28 AM
To: devel(a)acpica.org
Subject: Re: [Devel] [patch 7/6] Fix Itanium build - v2

acpica: IA64 does not know about -m64

Otherwise you get on Itanium:
gcc: error: unrecognized command line option '-m64'

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 generate/unix/Makefile.config |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: acpica-unix-20120913/generate/unix/Makefile.config
==========================================================
=========

generate/unix/Makefile.config +3 -1
@@ -37,7 +37,9 @@ CC =    gcc
 #
 OBJDIR =     obj$(BITS)
 BINDIR =     bin$(BITS)
-BITSFLAG =   -m$(BITS)
+ifneq ($(shell uname -m),ia64)
+	BITSFLAG =   -m$(BITS)
+endif
 COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $<
 LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
 INSTALLDIR = /usr/bin

_______________________________________________
Devel mailing list
Devel(a)acpica.org
http://lists.acpica.org/listinfo/devel

#16 lore raw

Re: [Devel] [patch 7/6] Fix Itanium build - v2

Quoted 3 lines · Robert

Makefile.common already contains this line, you may be able to use $(HARDWARE_NAME)

HARDWARE_NAME := $(shell uname -m)

I tried that, but it did not work out.
It's because the order of the including in the main makefile:

include Makefile.config
include Makefile.common

Below patch works:

acpica: IA64 does not know about -m64

Otherwise you get on Itanium:
gcc: error: unrecognized command line option '-m64'

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 generate/unix/Makefile.common |    1 -
 generate/unix/Makefile.config |    6 +++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
generate/unix/Makefile.config +5 -1
Index: acpica-unix-20120913/generate/unix/Makefile.config
===================================================================
@@ -35,9 +35,13 @@ CC =    gcc
 #
 # Common defines
 #
+HARDWARE_NAME := $(shell uname -m)
+
 OBJDIR =     obj$(BITS)
 BINDIR =     bin$(BITS)
-BITSFLAG =   -m$(BITS)
+ifneq (${HARDWARE_NAME},ia64)
+	BITSFLAG =   -m$(BITS)
+endif
 COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $<
 LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
 INSTALLDIR = /usr/bin
generate/unix/Makefile.common +0 -1
Index: acpica-unix-20120913/generate/unix/Makefile.common
===================================================================
@@ -6,7 +6,6 @@
 # Get the OS machine architecture. Anything with a "64" in the returned
 # string will be treated as a 64-bit OS. Otherwise, the default is 32-bit.
 #
-HARDWARE_NAME := $(shell uname -m)
 BITS=0
 
 #
#17 lore raw

Re: [Devel] [patch 7/6] Fix Itanium build - v2

Can you just add the new case to the rules in Makefile.common?

#
# Main rule will only generate versions that are appropriate for the running # OS, either 64-bit or 32-bit.
#
all: ${PROGS}
${PROGS}: FORCE

	@cd $(BUILD_DIRECTORY_PATH)/$@; \
	if [ $(BITS) -eq 32 ]; then \
		echo "Forced 32-bit generation of $@"; \
		mkdir -p obj32; \
		make BITS=32; \
		echo "32-bit version of $@:"; \
		ls -al ../bin32/$@; \
	elif [ $(findstring 64,$(HARDWARE_NAME)) ]; then \
		mkdir -p obj64; \
		make BITS=64; \
		echo "64-bit version of $@:"; \
		ls -al ../bin64/$@; \
	else \
		mkdir -p obj32; \
		make BITS=32; \
		echo "32-bit version of $@:"; \
		ls -al ../bin32/$@; \
	fi;
Quoted 65 lines

-----Original Message-----
From: Thomas Renninger [mailto:trenn(a)suse.de]
Sent: Wednesday, September 19, 2012 8:58 AM
To: Moore, Robert
Cc: devel(a)acpica.org
Subject: Re: [Devel] [patch 7/6] Fix Itanium build - v2

Quoted 4 lines · Robert

Makefile.common already contains this line, you may be able to use $(HARDWARE_NAME)

HARDWARE_NAME := $(shell uname -m)

I tried that, but it did not work out.
It's because the order of the including in the main makefile:

include Makefile.config
include Makefile.common

Below patch works:

acpica: IA64 does not know about -m64

Otherwise you get on Itanium:
gcc: error: unrecognized command line option '-m64'

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 generate/unix/Makefile.common |    1 -
 generate/unix/Makefile.config |    6 +++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

Index: acpica-unix-20120913/generate/unix/Makefile.config
==========================================================
=========

generate/unix/Makefile.config +5 -1
@@ -35,9 +35,13 @@ CC =    gcc
 #
 # Common defines
 #
+HARDWARE_NAME := $(shell uname -m)
+
 OBJDIR =     obj$(BITS)
 BINDIR =     bin$(BITS)
-BITSFLAG =   -m$(BITS)
+ifneq (${HARDWARE_NAME},ia64)
+	BITSFLAG =   -m$(BITS)
+endif
 COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $<
 LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
 INSTALLDIR = /usr/bin

Index: acpica-unix-20120913/generate/unix/Makefile.common
==========================================================
=========

generate/unix/Makefile.common +0 -0
@@ -6,7 +6,6 @@
 # Get the OS machine architecture. Anything with a "64" in the returned  #

string will be treated as a 64-bit OS. Otherwise, the default is 32-bit.
#
-HARDWARE_NAME := $(shell uname -m)
BITS=0

#

#18 lore raw

Re: [Devel] [patch 7/6] Fix Itanium build - v2

Quoted 1 line · Robert

Can you just add the new case to the rules in Makefile.common?

No, at least I can't see a nice way to do so.

Quoted 6 lines

#
# Main rule will only generate versions that are appropriate for the running # OS, either 64-bit or 32-bit.
#
all: ${PROGS}
${PROGS}: FORCE

Quoted 8 lines
	@cd $(BUILD_DIRECTORY_PATH)/$@; \
	if [ $(BITS) -eq 32 ]; then \
		echo "Forced 32-bit generation of $@"; \
		mkdir -p obj32; \
		make BITS=32; \
		echo "32-bit version of $@:"; \
		ls -al ../bin32/$@; \
	elif [ $(findstring 64,$(HARDWARE_NAME)) ]; then \

The ia64 case should match this condition already. But the variable:
BITSFLAG = -m$(BITS)
is not touched here.
Whatever you do here one would always get a:
-mX
option added to the compiler flags by:
BITSFLAG = -m$(BITS)
in the other Makefile (.config)

-m32 and -m64 does exist for PPC/Sparc/x86 gcc versions, but it does not exist for Itanium or ARM or other architectures.

I can't see a much cleaner way than my previous patch (see at the end of the mail).

I wonder why the extra complexity to be able to compile 32- and 64- bit together was made. The code could be shorter/nicer if this is not needed.
It should be possible to provide something like:
make OPT_CFLAGS=-m32 OPT_LDFLAGS=-m32
if it's really necessary (what for?) to be able to compile a 32 bit version on a 64 bit system.

I guess I do not want to try this out without knowing the background.

Thomas

Quoted 80 lines
		mkdir -p obj64; \
		make BITS=64; \
		echo "64-bit version of $@:"; \
		ls -al ../bin64/$@; \
	else \
		mkdir -p obj32; \
		make BITS=32; \
		echo "32-bit version of $@:"; \
		ls -al ../bin32/$@; \
	fi;
Quoted 65 lines

-----Original Message-----
From: Thomas Renninger [mailto:trenn(a)suse.de]
Sent: Wednesday, September 19, 2012 8:58 AM
To: Moore, Robert
Cc: devel(a)acpica.org
Subject: Re: [Devel] [patch 7/6] Fix Itanium build - v2

Quoted 4 lines · Robert

Makefile.common already contains this line, you may be able to use $(HARDWARE_NAME)

HARDWARE_NAME := $(shell uname -m)

I tried that, but it did not work out.
It's because the order of the including in the main makefile:

include Makefile.config
include Makefile.common

Below patch works:

acpica: IA64 does not know about -m64

Otherwise you get on Itanium:
gcc: error: unrecognized command line option '-m64'

Signed-off-by Thomas Renninger <trenn(a)suse.de>
---
 generate/unix/Makefile.common |    1 -
 generate/unix/Makefile.config |    6 +++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

Index: acpica-unix-20120913/generate/unix/Makefile.config
==========================================================
=========

generate/unix/Makefile.config +5 -1
@@ -35,9 +35,13 @@ CC =    gcc
 #
 # Common defines
 #
+HARDWARE_NAME := $(shell uname -m)
+
 OBJDIR =     obj$(BITS)
 BINDIR =     bin$(BITS)
-BITSFLAG =   -m$(BITS)
+ifneq (${HARDWARE_NAME},ia64)
+	BITSFLAG =   -m$(BITS)
+endif
 COMPILEOBJ = $(CC) -c $(CFLAGS) -o$@ $<
 LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
 INSTALLDIR = /usr/bin

Index: acpica-unix-20120913/generate/unix/Makefile.common
==========================================================
=========

generate/unix/Makefile.common +0 -0
@@ -6,7 +6,6 @@
 # Get the OS machine architecture. Anything with a "64" in the returned  #

string will be treated as a 64-bit OS. Otherwise, the default is 32-bit.
#
-HARDWARE_NAME := $(shell uname -m)
BITS=0

#