- add gcc 4.4 support

- fix pointer aliasing issue
This commit is contained in:
Michael E Brown 2009-03-24 07:12:21 +00:00
parent c3cbc50a3a
commit 3e1164f83f
2 changed files with 56 additions and 2 deletions

View File

@ -0,0 +1,51 @@
From b3b25e94ffaa2136f66938884557eb3103ea90ef Mon Sep 17 00:00:00 2001
From: Michael E Brown <mebrown@michaels-house.net>
Date: Tue, 24 Mar 2009 02:10:34 -0500
Subject: [PATCH] fix pointer aliasing issue in c++ id byte code.
---
src/libsmbios_c++/systeminfo/IdByte.cpp | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/libsmbios_c++/systeminfo/IdByte.cpp b/src/libsmbios_c++/systeminfo/IdByte.cpp
index 28f5cbc..5f42336 100644
--- a/src/libsmbios_c++/systeminfo/IdByte.cpp
+++ b/src/libsmbios_c++/systeminfo/IdByte.cpp
@@ -53,9 +53,6 @@ static u16 getIdByteFromMem ()
memory::IMemory *mem = 0;
struct two_byte_structure tbs;
- struct two_byte_structure *ptbs = &tbs;
- struct one_byte_structure *pobs =
- reinterpret_cast<one_byte_structure*>(&(tbs.bios_version));
mem = memory::MemoryFactory::getFactory()->getSingleton();
@@ -69,13 +66,13 @@ static u16 getIdByteFromMem ()
goto out;
// Step 2: fill the id structs
- mem->fillBuffer( reinterpret_cast<u8 *>(ptbs), TWO_BYTE_STRUCT_LOC, sizeof(two_byte_structure) );
+ mem->fillBuffer( reinterpret_cast<u8 *>(&tbs), TWO_BYTE_STRUCT_LOC, sizeof(two_byte_structure) );
// Step 3: check the checksum of one-byte struct
// update: checksum is not reliable, so don't use it...
// Step 4: Check one byte ID
- tempWord = pobs->system_id;
+ tempWord = tbs.system_id;
// Step 5: if 0xFE, then it is a double byte (word) ID.
// * -- byte at 0xFE845 is 0xFE
@@ -86,7 +83,7 @@ static u16 getIdByteFromMem ()
//* -- extension checksum is 0
// Step 7: get ID.
- tempWord = ptbs->two_byte_id;
+ tempWord = tbs.two_byte_id;
}
idWord = tempWord;
--
1.6.0.6

View File

@ -88,12 +88,13 @@
Name: %{release_name}
Version: %{release_version}
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+ or OSL 2.1
Summary: Libsmbios C/C++ shared libraries
Group: System Environment/Libraries
Source: http://linux.dell.com/libsmbios/download/libsmbios/libsmbios-%{version}/libsmbios-%{version}.tar.bz2
Patch0: 0003-upgrade-known-version-of-gcc-to-4.5.patch
Patch1: 0001-fix-pointer-aliasing-issue-in-c-id-byte-code.patch
URL: http://linux.dell.com/libsmbios/main
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: strace libxml2-devel gcc-c++ gettext doxygen %{valgrind_BR} %{cppunit_BR} %{fdupes_BR} %{pkgconfig_BR} %{python_devel_BR}
@ -182,6 +183,7 @@ programs against libsmbios.
%prep
%setup -q -n libsmbios-%{version}
%patch0 -p1
%patch1 -p1
find . -type d -exec chmod -f 755 {} \;
find doc src -type f -exec chmod -f 644 {} \;
chmod 755 src/cppunit/*.sh
@ -365,8 +367,9 @@ rm -rf %{buildroot}
%endif
%changelog
* Mon Mar 24 2009 Michael E Brown <michael_e_brown at dell.com> - 2.2.16-1
* Mon Mar 24 2009 Michael E Brown <michael_e_brown at dell.com> - 2.2.16-3
- add gcc 4.4 support
- fix pointer aliasing issue
* Mon Mar 24 2009 Michael E Brown <michael_e_brown at dell.com> - 2.2.15-2
- update to lastest upstream.