clang dependence on gcc for assembler even with -filetype=obj

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

clang dependence on gcc for assembler even with -filetype=obj

Aaron Gray-2
Hi,

I just compiled llvm+clang with MSVC++ and tried using the -filetype=obj but clang seems to be dependent on GCC.

Aaron


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Chris Lattner

On Jun 9, 2010, at 9:20 AM, Aaron Gray wrote:

> Hi,
>
> I just compiled llvm+clang with MSVC++ and tried using the -filetype=obj but clang seems to be dependent on GCC.

Clang defaults to using GCC as a portability layer for targets that don't have a ToolChain set up in the driver.  Define a ToolChain for your platform and this goes away.

-Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Aaron Gray-2
On 9 June 2010 17:29, Chris Lattner <[hidden email]> wrote:

On Jun 9, 2010, at 9:20 AM, Aaron Gray wrote:

> Hi,
>
> I just compiled llvm+clang with MSVC++ and tried using the -filetype=obj but clang seems to be dependent on GCC.

Clang defaults to using GCC as a portability layer for targets that don't have a ToolChain set up in the driver.  Define a ToolChain for your platform and this goes away.

Hi Chris,

Congratulations on your ACM SIGPLAN award.

Sorry to be dumb but how or where do I define a ToolChain ?

Aaron


 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Chris Lattner

On Jun 9, 2010, at 9:39 AM, Aaron Gray wrote:

On 9 June 2010 17:29, Chris Lattner <[hidden email]> wrote:

On Jun 9, 2010, at 9:20 AM, Aaron Gray wrote:

> Hi,
>
> I just compiled llvm+clang with MSVC++ and tried using the -filetype=obj but clang seems to be dependent on GCC.

Clang defaults to using GCC as a portability layer for targets that don't have a ToolChain set up in the driver.  Define a ToolChain for your platform and this goes away.

Hi Chris,

Congratulations on your ACM SIGPLAN award.

Sorry to be dumb but how or where do I define a ToolChain ?

Take a look at clang/docs/DriverInternals.html

-Chris

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Aaron Gray-2
On 9 June 2010 17:41, Chris Lattner <[hidden email]> wrote:

On Jun 9, 2010, at 9:39 AM, Aaron Gray wrote:

On 9 June 2010 17:29, Chris Lattner <[hidden email]> wrote:

On Jun 9, 2010, at 9:20 AM, Aaron Gray wrote:

> Hi,
>
> I just compiled llvm+clang with MSVC++ and tried using the -filetype=obj but clang seems to be dependent on GCC.

Clang defaults to using GCC as a portability layer for targets that don't have a ToolChain set up in the driver.  Define a ToolChain for your platform and this goes away.

Hi Chris,

Congratulations on your ACM SIGPLAN award.

Sorry to be dumb but how or where do I define a ToolChain ?

Take a look at clang/docs/DriverInternals.html


Okay I have to study the code a bit, but basically I have defined a Win32HostInfo class, associated creator, and Driver::GetHostInfo() creator entry.

next a clang::driver::toolchains::Win32 class ? Should there be ("pure") Win32Clang for native Windows and Win32GCC classes for Cygwin and MinGW to use ?

Aaron




_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Daniel Dunbar-2
Just the Win32 host info would be a good start.

There should be no need for a Win32Clang or Win32GCC classes. On Win32 we want to just get to the point where the integrated assembler works.

 - Daniel


On Jun 9, 2010, at 10:37, Aaron Gray <[hidden email]> wrote:

On 9 June 2010 17:41, Chris Lattner <[hidden email]> wrote:

On Jun 9, 2010, at 9:39 AM, Aaron Gray wrote:

On 9 June 2010 17:29, Chris Lattner <[hidden email]> wrote:

On Jun 9, 2010, at 9:20 AM, Aaron Gray wrote:

> Hi,
>
> I just compiled llvm+clang with MSVC++ and tried using the -filetype=obj but clang seems to be dependent on GCC.

Clang defaults to using GCC as a portability layer for targets that don't have a ToolChain set up in the driver.  Define a ToolChain for your platform and this goes away.

Hi Chris,

Congratulations on your ACM SIGPLAN award.

Sorry to be dumb but how or where do I define a ToolChain ?

Take a look at clang/docs/DriverInternals.html


Okay I have to study the code a bit, but basically I have defined a Win32HostInfo class, associated creator, and Driver::GetHostInfo() creator entry.

next a clang::driver::toolchains::Win32 class ? Should there be ("pure") Win32Clang for native Windows and Win32GCC classes for Cygwin and MinGW to use ?

Aaron



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Michael Spencer-2
On Wed, Jun 9, 2010 at 12:20 PM, Aaron Gray <[hidden email]> wrote:
> Hi,
> I just compiled llvm+clang with MSVC++ and tried using the -filetype=obj but
> clang seems to be dependent on GCC.
> Aaron

Use the integrated assembler with this patch:
http://old.nabble.com/Re:-Win32-COFF-Support-p28702793.html

On Thu, Jun 10, 2010 at 1:39 PM, Daniel Dunbar <[hidden email]> wrote:
> Just the Win32 host info would be a good start.
> There should be no need for a Win32Clang or Win32GCC classes. On Win32 we
> want to just get to the point where the integrated assembler works.
>  - Daniel

The Generic_GCC HostInfo  works with -integrated-as with the COFF
patch for MC over on the llvmdev ML. No changes to clang are needed. I
have the beginnings of a WindowsClang HostInfo that  defaults to
-integrated-as (no need to pass the arg) and uses MSVC link.exe for
linking. This allows "echo int main(){printf("Hello World!");} | clang
-x c -o hello.exe - && hello.exe" to work (and output what one would
expect).

It's not quite ready for review yet, mainly because I'm not sure
exactly how it all should be organized. Right now I just copy what's
done on darwin/linux as best I can.

- Michael Spencer

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Michael Spencer-2
On Thu, Jun 10, 2010 at 5:14 PM, Bigcheese <[hidden email]> wrote:

>> Could you send me a patch for this ? I have tried to do similarly but cannot
>> get it to work.
>> I am working on a COFF linker for LLVM.
>>
>> Aaron
>
> http://codereview.appspot.com/1638043/show
> (ignore test/CMakeLists.txt)
>
> How are you planning on doing the linker? This is probably something
> that should be done like LLVMMC. In fact they should probably share
> Elf/MachO/COFF code.
>

Ahhhh sorry about that. I added the wrong mailing list back. Please
don't kill me :(.

- Michael Spencer
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Michael Spencer-2
In reply to this post by Michael Spencer-2
On Thu, Jun 10, 2010 at 6:01 PM, Aaron Gray <[hidden email]> wrote:
> Okay, looks good, a few points.
>  - The Tools.cpp diff seems to be a bit odd, its done a total replacement
> rather than just the changes, you may want to look into this.

I have no idea why it's like that. I made the patch with git, so I
must have messed something up in there.

>  - InitHeaderSearch.cpp is going to want to have a conditional '#ifdef
> WIN32' round it as 'getSystemRegistryString() as this as obviously this is
> not supported on non Windows platforms.

It's already ifdefed.

>  - We will probably want a non native WindowsToolChain for Cygwin and MinGW,
> both of these require to be based on Generic GCC, and have '.o' suffixes on
> object modules where are native windows wants '.obj' suffixes.

Yep, we should have Windows{Clang,MSVC,Cygwin,MinGW}. I have only
worked on the clang + windows native bit.

> Its just a COFF linker, so far I have implemented COFF::ObjectModule,
> COFF::Reader, COFF::Writer, COFF::Dumper.
> I was hoping the Reader and Dumper could be used for a test tool.
> Here's a link to the code if you are interested :-
>     http://www.aarongray.org/LLVM-COFF/Dumper
> I am currently looking at a library ArchiveReader, and maybe a Writer too
> for a library tool.

Cool, I'll take a look.

On Thu, Jun 10, 2010 at 6:42 PM, Aaron Gray <[hidden email]> wrote:

> Okay got it working with attached patch for cc1as_main.cpp for WinCOFF with
> '-c' outputting an object module but without '-c' the linker is not being
> found.
> C:\cygwin\home\ang\tests\llvm\C++>"\open
> source\llvm+clang\bin\Debug\clang++" -x
>  c HelloWorldStdio.cpp
> /cygdrive/c/Cygwin/bin/link: extra operand
> `C:/Users/ang/AppData/Local/Temp/cc-0
> 00000.o'
> Try `/cygdrive/c/Cygwin/bin/link --help' for more information.
> clang++: error: linker command failed with exit code 1 (use -v to see
> invocation
> )
> Anyway half way there, object module looks fine.
> Aaron

Ah, my patch did something it should not have. It switched all windows
builds (not just native) to use MSVC link.exe.

For now you can just remove my patch (keep Nathan's) and pass
-integrated-as and it should use the Cygwin ld linker.

Oh, and can you reply to [hidden email] too?

- Michael Spencer

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Sebastian Redl

On Thu, 10 Jun 2010 19:05:16 -0400, Bigcheese <[hidden email]>
wrote:
> On Thu, Jun 10, 2010 at 6:01 PM, Aaron Gray <[hidden email]>
> wrote:
>> Okay, looks good, a few points.
>>  - The Tools.cpp diff seems to be a bit odd, its done a total
>> replacement
>> rather than just the changes, you may want to look into this.
>
> I have no idea why it's like that. I made the patch with git, so I
> must have messed something up in there.

Sounds like line endings to me. Did you accidentally switch the entire
file to Windows line endings?

Sebastian

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang dependence on gcc for assembler even with -filetype=obj

Michael Spencer-2
On Fri, Jun 11, 2010 at 4:50 AM, Sebastian Redl
<[hidden email]> wrote:
> Sounds like line endings to me. Did you accidentally switch the entire
> file to Windows line endings?
>
> Sebastian

Oh duh! Thanks. One thing I hate about Visual Studio is it always
wants to mess up line endings. I should go look for a setting for
that...

- Michael Spencer
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev