Jump to content

Philip Petev

Philip Petev

Member Since 13 Oct 2006
Offline Last Active Today, 03:35 AM
*****

Posts I've Made

In Topic: Build_Clover.command, another Script to build standard Clover (or customized)

Yesterday, 06:46 PM

Maybe you should try to remove your ~/src/edk2 folder and try with a fresh one.

In Topic: Clover Bug/Issue Report and Patch

08 December 2017 - 07:10 PM

And yet, RehabMan's fork is pretty good example how all this maintenance can be done with minimum effort.

 

Not sure why the keyword is "git", git and subversion are practically the same thing, git just has more features....

 

Yes, they basically are, only that those "features" matter in the current case.

In Topic: Clover Bug/Issue Report and Patch

08 December 2017 - 09:56 AM

Agree, we don't need to keep EDK2 updating. But I think UDK2 is also to be patched for our purpose. In this case what is the difference what to use? In both cases we have to patch it.

The point was using a relatively static edk2 base instead rolling one, so its adaptation to be reduced to a minimum (maybe once a six months or something). Patching will be needed in any case, I know that, but as @RehabMan said, they are minimal and git can handle that pretty well. Just look at this diff:

diff -ur -x '.*' edk2/MdePkg/Include/Base.h rm_edk2/MdePkg/Include/Base.h
--- edk2/MdePkg/Include/Base.h	2017-12-06 09:15:38.000000000 +0200
+++ rm_edk2/MdePkg/Include/Base.h	2017-12-06 09:21:09.000000000 +0200
@@ -601,6 +601,27 @@
 **/
 #define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
 
+#define GCC_VERSION (__GNUC__ * 10 + __GNUC_MINOR__)
+
+/*
+ * clang defines __MACH__ if the target is OS X, but not if the target is Windows
+ */
+#if defined(__clang__) && !defined(__MACH__) && defined(__x86_64__)
+#define CLANG_VERSION (__clang_major__ * 0x100 + __clang_minor__)
+#ifdef __apple_build_version__      // Apple clang
+#if CLANG_VERSION >= 0x0703 && CLANG_VERSION < 0x0801
+// Use __builtin_ms_va_list if Apple clang ver >= 7.3.0 and < 8.1.0
+#define USE_CLANG_BUILTIN_MS_VA_LIST
+#endif
+#else   // Generic clang
+// Use __builtin_ms_va_list if Generic clang ver >= 3.7.0 and < 3.9.0
+#if CLANG_VERSION >= 0x0307 && CLANG_VERSION < 0x0309
+#define USE_CLANG_BUILTIN_MS_VA_LIST
+#endif
+#endif  // end Apple/Generic clang
+#undef CLANG_VERSION
+#endif  // end __clang__ && !__MACH__ && __x86_64__
+
 #if defined(__CC_ARM)
 //
 // RVCT ARM variable argument list support.
@@ -633,7 +654,8 @@
 
 #elif defined(__GNUC__)
 
-#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS)
+//#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS)
+#if defined(USE_CLANG_BUILTIN_MS_VA_LIST) || (defined(__x86_64__) && !defined(NO_MSABI_VA_FUNCS) && (GCC_VERSION >= 48))
 //
 // X64 only. Use MS ABI version of GCC built-in macros for variable argument lists.
 //
diff -ur -x '.*' edk2/MdePkg/Include/X64/ProcessorBind.h rm_edk2/MdePkg/Include/X64/ProcessorBind.h
--- edk2/MdePkg/Include/X64/ProcessorBind.h	2017-12-06 09:15:38.000000000 +0200
+++ rm_edk2/MdePkg/Include/X64/ProcessorBind.h	2017-12-06 09:21:09.000000000 +0200
@@ -27,7 +27,8 @@
 #pragma pack()
 #endif
 
-#if defined(__GNUC__) && defined(__pic__) && !defined(USING_LTO)
+//#if defined(__GNUC__) && defined(__pic__) && !defined(USING_LTO)
+#if defined(__GNUC__) && defined(__pic__) && !defined(USING_LTO) && !defined(__clang__)
 //
 // Mark all symbol declarations and references as hidden, meaning they will
 // not be subject to symbol preemption. This allows the compiler to refer to
diff -ur -x '.*' edk2/MdePkg/Library/BaseLib/BaseLib.inf rm_edk2/MdePkg/Library/BaseLib/BaseLib.inf
--- edk2/MdePkg/Library/BaseLib/BaseLib.inf	2017-12-06 09:15:38.000000000 +0200
+++ rm_edk2/MdePkg/Library/BaseLib/BaseLib.inf	2017-12-06 09:21:09.000000000 +0200
@@ -755,7 +755,7 @@
   X86DisablePaging32.c
   X86RdRand.c
   X64/GccInline.c | GCC
-  X64/Thunk16.S | XCODE 
+#  X64/Thunk16.S | XCODE 
   X64/SwitchStack.nasm| GCC
   X64/SwitchStack.S | GCC 
   X64/SetJump.nasm| GCC
diff -ur -x '.*' edk2/MdePkg/Library/BaseLib/SafeString.c rm_edk2/MdePkg/Library/BaseLib/SafeString.c
--- edk2/MdePkg/Library/BaseLib/SafeString.c	2017-12-06 09:15:38.000000000 +0200
+++ rm_edk2/MdePkg/Library/BaseLib/SafeString.c	2017-12-06 09:21:10.000000000 +0200
@@ -14,9 +14,9 @@
 
 #include "BaseLibInternals.h"
 
-#define RSIZE_MAX  (PcdGet32 (PcdMaximumUnicodeStringLength))
-
-#define ASCII_RSIZE_MAX  (PcdGet32 (PcdMaximumAsciiStringLength))
+//REVIEW_REHABMAN: investigate why this is needed (PcdGet32 in this case not working correctly/build issue)
+#define RSIZE_MAX  0 //(PcdGet32 (PcdMaximumUnicodeStringLength))
+#define ASCII_RSIZE_MAX  0 //(PcdGet32 (PcdMaximumAsciiStringLength))
 
 #define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status)  \
   do { \
diff -ur -x '.*' edk2/MdePkg/Library/BaseLib/String.c rm_edk2/MdePkg/Library/BaseLib/String.c
--- edk2/MdePkg/Library/BaseLib/String.c	2017-12-06 09:15:38.000000000 +0200
+++ rm_edk2/MdePkg/Library/BaseLib/String.c	2017-12-06 09:21:10.000000000 +0200
@@ -14,6 +14,12 @@
 
 #include "BaseLibInternals.h"
 
+//REVIEW_REHABMAN: investigate why this is needed (PcdGet32 in this case not working correctly/build issue)
+#undef _PCD_GET_MODE_32_PcdMaximumUnicodeStringLength
+#define _PCD_GET_MODE_32_PcdMaximumUnicodeStringLength 0
+#undef _PCD_GET_MODE_32_PcdMaximumAsciiStringLength
+#define _PCD_GET_MODE_32_PcdMaximumAsciiStringLength 0
+
 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
 
 /**

So, the keyword here is "git".

In Topic: Clover Bug/Issue Report and Patch

08 December 2017 - 06:57 AM

Yes, it is a possible way. Other way is to stay with some UDK, for example UDK2017n

 

@Slice @RehabMan I think the question you devs should ask yourself is do we really need the branch edk2 (the rolling release, constantly updated) or the branch udk2017 (the stable one, receiving only the critical updates from the edk2 branch from time to time) is quite enough in term of set of features it offers. We all know Clover uses only some of the toolkit modules and the rest are being updated more often in that rolling release according to my observations.

In Topic: Clover Bug/Issue Report and Patch

06 December 2017 - 08:32 AM

 

Ok, the problem is actually in svn commit 25815 that adds some code to GenSec.c that doesn't compile with Xcode.  The tool wasn't built, so I didn't have it which is why the build broke.

 

Here's a patch to fix GenSec.c

diff a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -1034,9 +1034,9 @@ Returns:
   CHAR8                     *DummyFileName;
   FILE                      *DummyFile;
   UINTN                     DummyFileSize;
-  UINT8                     *DummyFileBuffer;
+  CHAR8                     *DummyFileBuffer;
   FILE                      *InFile;
-  UINT8                     *InFileBuffer;
+  CHAR8                     *InFileBuffer;
   UINTN                     InFileSize;
 
   InputFileAlign        = NULL;
@@ -1326,13 +1326,13 @@ Returns:
       DummyFile = fopen (LongFilePath (DummyFileName), "rb");
       if (DummyFile == NULL) {
         Error (NULL, 0, 0001, "Error opening file", DummyFileName);
-        return EFI_ABORTED;
+        return STATUS_ERROR;
       }
 
       fseek (DummyFile, 0, SEEK_END);
       DummyFileSize = ftell (DummyFile);
       fseek (DummyFile, 0, SEEK_SET);
-      DummyFileBuffer = (UINT8 *) malloc (DummyFileSize);
+      DummyFileBuffer = (CHAR8 *) malloc (DummyFileSize);
       fread(DummyFileBuffer, 1, DummyFileSize, DummyFile);
       fclose(DummyFile);
       DebugMsg (NULL, 0, 9, "Dummy files", "the dummy file name is %s and the size is %u bytes", DummyFileName, (unsigned) DummyFileSize);
@@ -1340,13 +1340,13 @@ Returns:
       InFile = fopen(LongFilePath(InputFileName[0]), "rb");
       if (InFile == NULL) {
         Error (NULL, 0, 0001, "Error opening file", InputFileName[0]);
-        return EFI_ABORTED;
+        return STATUS_ERROR;
       }
 
       fseek (InFile, 0, SEEK_END);
       InFileSize = ftell (InFile);
       fseek (InFile, 0, SEEK_SET);
-      InFileBuffer = (UINT8 *) malloc (InFileSize);
+      InFileBuffer = (CHAR8 *) malloc (InFileSize);
       fread(InFileBuffer, 1, InFileSize, InFile);
       fclose(InFile);
       DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[0], (unsigned) InFileSize);

No need for this patch anymore, the bug has been fixed upstream. Just tested the latest edk2 code with the patches applied and Clover builds fine.

© 2017 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy