Adding fixes for Snow Leopard build. Snow Leopard tools default to 64-bit images...
authorajfish <ajfish@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 7 Dec 2009 22:13:11 +0000 (22:13 +0000)
committerajfish <ajfish@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 7 Dec 2009 22:13:11 +0000 (22:13 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1761 7335b38e-4728-0410-8992-fb3ffe349368

Source/C/Common/BasePeCoff.c
Source/C/Makefiles/app.makefile
Source/C/Makefiles/header.makefile
Source/Python/sitecustomize.py [new file with mode: 0644]

index d999eaf..5ffb5d4 100644 (file)
@@ -1432,7 +1432,7 @@ PeCoffLoaderGetEntryPoint (
     } else {\r
       *BaseOfImage = (VOID *)(UINTN)Hdr.Pe32Plus->OptionalHeader.ImageBase;\r
     }\r
-    *EntryPoint += (UINTN)*BaseOfImage;\r
+    *EntryPoint = (VOID *)(UINTN)((UINTN)*EntryPoint + (UINTN)*BaseOfImage);\r
     return RETURN_SUCCESS;\r
   }\r
 \r
index 7555556..2f95003 100644 (file)
@@ -8,6 +8,6 @@ APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
 all: $(MAKEROOT)/bin $(APPLICATION) 
 
 $(APPLICATION): $(OBJECTS) 
-       $(LINKER) -o $(APPLICATION) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
+       $(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
 
 include $(MAKEROOT)/Makefiles/footer.makefile
index a4dc225..5f69e7b 100644 (file)
@@ -26,7 +26,19 @@ endif
 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) 
 CPPFLAGS = $(INCLUDE)
 CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g
+LFLAGS =
 
+#
+# Snow Leopard  is a 32-bit and 64-bit environment. uname -m returns -i386, but gcc defaults 
+#  to x86_64. So make sure tools match uname -m
+#
+uname_s = $(shell uname -s)
+ifeq ($(uname_s),Darwin)
+  CFLAGS   += -arch i386
+  CPPFLAGS += -arch i386
+  LFLAGS   += -arch i386
+endif
+  
 .PHONY: all
 .PHONY: install
 .PHONY: clean
diff --git a/Source/Python/sitecustomize.py b/Source/Python/sitecustomize.py
new file mode 100644 (file)
index 0000000..fa5cd40
--- /dev/null
@@ -0,0 +1,9 @@
+import sys
+import locale
+
+if sys.platform == "darwin":
+  DefaultLocal = locale.getdefaultlocale()[1]
+  if DefaultLocal is None:
+    DefaultLocal = 'UTF8'  
+  sys.setdefaultencoding(DefaultLocal)
+