Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 1 minute ago, Slice said: Did you forget something? d:\projects\cloverbootloader\refit_uefi\platform\posix\stddef.h(5): error C2371: size_t: It compiles fine on GCC53 and XCODE8. Let me have a look to VS. Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 size_t must be UINTN Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 Hum, do we need sizes more than 4GB in an EFI loader ? But fine, no problem. Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 size_t = sizeof(void*); Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 That's common, but not specified, if I remember well. Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 d:\projects\cloverbootloader\rEFIt_UEFI\Platform\Posix\strlen.cpp(27): error C2220: warning treated as error - no 'object' file generated d:\projects\cloverbootloader\rEFIt_UEFI\Platform\Posix\strlen.cpp(27): warning C4311: 'type cast': pointer truncation from 'const char *' to 'unsigned long' d:\projects\cloverbootloader\rEFIt_UEFI\Platform\Posix\strlen.cpp(27): warning C4302: 'type cast': truncation from 'const char *' to 'unsigned long' Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 done. Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 Now I am at home with GCC. /Users/sergey/src/CloverHackyColor/rEFIt_UEFI/Platform/Posix/strlen.cpp: In function 'size_t strlen(const char*)': /Users/sergey/src/CloverHackyColor/rEFIt_UEFI/Platform/Posix/strlen.cpp:31:24: error: comparison of integer expressions of different signedness: 'long int' and 'UINTN' {aka 'long long unsigned int'} [-Werror=sign-compare] 31 | if ( char_ptr - str > SIZE_T_MAX ) abort(); cc1plus: all warnings being treated as errors Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 The solution is if ( (size_t)(char_ptr - str) > SIZE_T_MAX ) abort(); Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 Just now, Slice said: The solution is if ( (size_t)(char_ptr - str) > SIZE_T_MAX ) abort(); Not really, as size_t is not guaranteed to be big enough. There is intptr_t and uinptr_t that I'm committing now. done. Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 OK, all works. O, no! Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 debug.log is absent so the crash before InitBooterLog(); Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 Time to try the gdb_launch and put a breakpoint on abort() or panic() Did you get the commit "uintptr_t in strlen.cpp". I was to quick to solve the warning... cast to a signed type of SIZE_T_MAX doesn't work if SIZE_T_MAX is 8 bytes. Working here, so it must be it. Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 6 minutes ago, Jief_Machak said: Time to try the gdb_launch and put a breakpoint on abort() or panic() Did you get the commit "uintptr_t in strlen.cpp". I was to quick to solve the warning... cast to a signed type of SIZE_T_MAX doesn't work if SIZE_T_MAX is 8 bytes. Working here, so it must be it. How to delete my two commits? Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 Doesn't matter, it works! Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 Have you tried Xcode/CloverX64/CloverX64.xcodeproj ? Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 1 hour ago, Jief_Machak said: Have you tried Xcode/CloverX64/CloverX64.xcodeproj ? Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 You need a DEBUG build with XCODE8, once first. Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 But Autogen.h should be regenerated after each header update. What else? ld: file not found: /Users/sergey/src/CloverHackyColor/Xcode/CloverX64/DerivedData/CloverX64/Build/Products/Debug/libCloverX64.a Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 In practice, autogen.h almost never changes. Currently at least. When refactoring, for example I changed a CHAR16* to XStringW, then I use the compiler to tell me what to change. So I do tons of compilation. Xcode put me right on the error. When use to it, hard to go back to only compile in command line... I think. Link to comment Share on other sites More sharing options...
Slice Posted March 13, 2020 Share Posted March 13, 2020 There is an option for ebuild.sh -fr (Force Rebuild) which means generate Autogen.h. I often have to use this option else no compile or not work. Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 9 hours ago, Download-Fritz said: Print argument semantics are of course unaffected by the family of functions used. "%a" is ASCII, "%s" is UCS-2, always. It makes no sense to make argument interpretation different based on the destination type anyway. I tried : DBG("Test ascii=%a ucs-2=%s\n", "a string", L"Выход из подменю, обновление главного меню\n"); DBG("Test ascii=%a ucs-2=%s\n", "a string", "Выход из подменю, обновление главного меню\n"); DBG("Test ascii=%a ucs-2=%a\n", "a string", "Выход из подменю, обновление главного меню\n"); And I got : 1:719 1:594 Test ascii=a string ucs-2=KE>4 87 ?>4<5=N, >1=>2;5=85 3;02=>3> <5=N 1:721 0:002 Test ascii=a string ucs-2=����� ���������,���������� ������������ Ts si=aus2 Uioeolto tts SmlTxE tts 1:724 0:002 Test ascii=a string ucs-2=Выход из подменю, обновление главного меню So I don't know what %s expect, but obviously %s doesn't work with Ascii...Printf function ? Anyway, will replace that by the printf implementation I provided, that is small (last time I tried it was 414 bytes on an arduino 16 bits!) and won't have that problem. Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 I've compared AutoGen.c and AutoGen.h between a version from the 6th of January and today's version. The only change is when the name went from CLOVER to CLOVERX64. So I can confirm that there is no need to regenerate regularly AutoGen.{c,h}, except for non-ordinary changes (like the name, or a new guid used). It's true that we have sometime to rebuild from scratch, but it's not because of AutoGen. 50 minutes ago, Slice said: ld: file not found: /Users/sergey/src/CloverHackyColor/Xcode/CloverX64/DerivedData/CloverX64/Build/Products/Debug/libCloverX64.a I was hoping this setting would be saved with the project. DerivedData has to be project relative. File menu -> Project settings -> Derived Data = Project-relative Location. There is probably a better solution like a post-build step that would copy the lib to a specific location next to the project. Link to comment Share on other sites More sharing options...
apianti Posted March 13, 2020 Share Posted March 13, 2020 47 minutes ago, Jief_Machak said: I tried : DBG("Test ascii=%a ucs-2=%s\n", "a string", L"Выход из подменю, обновление главного меню\n"); DBG("Test ascii=%a ucs-2=%s\n", "a string", "Выход из подменю, обновление главного меню\n"); DBG("Test ascii=%a ucs-2=%a\n", "a string", "Выход из подменю, обновление главного меню\n"); And I got : 1:719 1:594 Test ascii=a string ucs-2=KE>4 87 ?>4<5=N, >1=>2;5=85 3;02=>3> <5=N 1:721 0:002 Test ascii=a string ucs-2=����� ���������,���������� ������������ Ts si=aus2 Uioeolto tts SmlTxE tts 1:724 0:002 Test ascii=a string ucs-2=Выход из подменю, обновление главного меню So I don't know what %s expect, but obviously %s doesn't work with Ascii...Printf function ? Anyway, will replace that by the printf implementation I provided, that is small (last time I tried it was 414 bytes on an arduino 16 bits!) and won't have that problem. I'm positive they work correctly, because they all end up using the same function underneath. And also because there was no problem before, it worked perfectly fine to do such things. Why wouldn't you just use the printf builtin to the standard library for arduino avr compiler...? Link to comment Share on other sites More sharing options...
Jief_Machak Posted March 13, 2020 Author Share Posted March 13, 2020 9 minutes ago, apianti said: I'm positive they work correctly. Obviously they can't print UCS-2 string. Exactly like printf can't. Have you tried to compile printf fron glibc for an arduino 16KB ??? Link to comment Share on other sites More sharing options...
Recommended Posts