Thomas,

You might look at this fork of the edk2 project that is working through CLANG38 
toolchain issues.

https://github.com/shijunjing/edk2/tree/llvm

Archive of email discussion 

http://thread.gmane.org/gmane.comp.bios.edk2.devel/11866

Mike

> -----Original Message-----
> From: edk2-devel [mailto:[email protected]] On Behalf Of 
> Palmer, Thomas
> Sent: Tuesday, May 24, 2016 2:28 PM
> To: [email protected]
> Cc: [email protected]
> Subject: Re: [edk2] Question on CLANG build
> 
> I hacked the tools_def template and got -arch 386 into the build command, 
> however I
> saw this fly across the screen:
> 
> clang: warning: argument unused during compilation: '-arch 386'
> 
> The clang I have is from Ubuntu's repos:
> clang --version
> Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based 
> on LLVM
> 3.5.0)
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> 
> Bummer.  I suppose I'll have to make my own clang-3.5 instead of using 
> Ubuntu's
> packages.
> 
> 
> So.... I then tried to build  BaseLib.inf using -a X64, and I get a totally 
> different
> kind of error:
> 
> build.py...
>  : error C0DE: Unknown fatal error when processing
> [MdePkg/Library/BaseLib/BaseLib.inf]
> 
> (Please send email to [email protected] for help, attaching following 
> call
> stack trace!)
> 
> (Python 2.7.6 on linux2) Traceback (most recent call last):
>   File "BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", 
> line
> 2298, in Main
>     MyBuild.Launch()
>   File "BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", 
> line
> 2054, in Launch
>     self._BuildModule()
>   File "BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", 
> line
> 1721, in _BuildModule
>     self._Build(self.Target, Ma, BuildModule=True)
>   File "BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", 
> line
> 1243, in _Build
>     AutoGenObject.CreateMakeFile(CreateDepsMakeFile)
>   File "BaseTools/Source/Python/AutoGen/AutoGen.py", line 3931, in 
> CreateMakeFile
>     if Makefile.Generate():
>   File "BaseTools/Source/Python/AutoGen/GenMake.py", line 184, in Generate
>     FileContent = self._TEMPLATE_.Replace(self._TemplateDict)
>   File "BaseTools/Source/Python/AutoGen/GenMake.py", line 512, in 
> _CreateTemplateDict
>     RespDict = self.CommandExceedLimit()
>   File "BaseTools/Source/Python/AutoGen/GenMake.py", line 702, in 
> CommandExceedLimit
>     Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']
> KeyError: 'FLAGS'
> 
> Fun times ...
> 
> Thomas
> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Tuesday, May 24, 2016 4:13 PM
> To: Palmer, Thomas <[email protected]>
> Cc: [email protected]
> Subject: Re: [edk2] Question on CLANG build
> 
> 
> > 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/PeiServicesTablePointerL
> >> i
> >> 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
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to