> On May 24, 2016, at 2:02 PM, Palmer, Thomas <[email protected]> wrote: > > Andrew, > > I agree the C code is correct, which is why I figure I must not be > using CLANG correctly. > > I do not see the -arch 386 flag in the compile command. I see that > flag for XCLANG, but not for CLANG35. I'll try to hack the Conf file to > include that flag for IA32. >
XCODE5 is the current clang that ships with Xcode on a Mac so it is the best one to copy. You have to specify -arch or -target or you will get the compiler defaults. The -target flag is more about cross compilers. For example *XCODE5_X64_CC_FLAGS sets -target x86_64-pc-win32-macho to compile using the Windows/EFI Calling convention but to generate a Mach-O (Image format on a Mac like ELF or PE/COFF) to make the debugger happy. I did not see IA32 or X64 targets for CLANG35 in master? Thanks, Andrew Fish > Thomas > > > -----Original Message----- > From: [email protected] [mailto:[email protected]] > Sent: Tuesday, May 24, 2016 3:46 PM > To: Palmer, Thomas <[email protected]> > Cc: [email protected] > Subject: Re: [edk2] Question on CLANG build > > >> On May 24, 2016, at 1:19 PM, Palmer, Thomas <[email protected]> wrote: >> >> EDK2 Clang users: >> >> I've been curious about using CLANG on one of our systems to >> try out the llvm ecosystem. I can compile my project in both GCC48 and >> VS2013, however, when I tried CLANG35 on a Ubuntu 14.04 system, I got this >> error: >> >> Building ... >> MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLi >> bIdt.inf [IA32] >> MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c:58:10: >> warning: cast to 'void *' from smaller integer type 'UINTN' (aka >> 'unsigned int') [-Wint-to-void-pointer-cast] return (VOID *) (UINTN) >> Memory; >> >> I surmise the VOID* or UINTN must be incorrectly configured somewhere? Or >> perhaps I missed some crucial setup steps? >> > > Thomas, > > VOID * is just a pointer. UINTN should be the size of a pointer. The only way > I can reproduce this error is to try and compile IA32 code with the x86_64 > version of the compiler. I'm not 100% sure but I think you only get this > error if sizeof(unsigned int) < sizeof (void *). For IA32 I would expect > UINTN to be an unsigned int and a pointer fits into an int? > > UINTN is defined here: > https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Ia32/ProcessorBind.h > for IA32. > > Are you sure you are using the correct compiler flags for IA32, for the Xcode > version of clang that means pass: -arch i386. No arch usually defaults to > x86_64. > > ~/work/Compiler>cat void.c > > typedef unsigned long long UINT64; > typedef unsigned int UINT32; > typedef UINT32 UINTN; > > > void * > Test (UINT64 Memory) > { > return (void *) (UINTN) Memory; > } > ~/work/Compiler>clang -S void.c > void.c:10:10: warning: cast to 'void *' from smaller integer type 'UINTN' > (aka 'unsigned int') > [-Wint-to-void-pointer-cast] > return (void *) (UINTN) Memory; > ^ > 1 warning generated. > ~/work/Compiler>clang -arch i386 -S void.c > > > Thanks, > > Andrew Fish > _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

