Automake Assembler Assumptions with LLVM-MC

Not all LLVM users are clang users. For example, we're using LLVM to build
OpenVMS cross-compilers to x86 for our porting effort. We have our own set
of frontends. We're using llvm-mc as our assembler for the lower level OS
code.

We'll eventually port clang as well to bootstrap going forward, but OpenVMS
doesn't have the same kind of driver-style so even there, I can't just the
'clang' command to control assembly.

As for bug-for-bug compatibility in any sort of software, that's a tough choice.
Traditionally, I've resisted such pressure but sooner or later, I've had to give
in now and then. As for the command line option matching, that is an area I
wouldn't attempt to match since such options vary greatly across platforms.

John

We are in a similar situation. We technically have a pseudo-functional clang frontend, but many of our initial developers work directly in assembly.

I was able to get our user off the ground using our version of clang. However, I also agree that we do a significant amount of testing/work with early architectures using llvm-mc (especially when we’re only bouncing code off simulators).

John D. Leidel

> It's my understanding that llvm-mc is intended to be a testing tool
> for LLVM developers rather than an assembler for end users. Users
> should be assembling with clang.

Not all LLVM users are clang users. For example, we're using LLVM to build
OpenVMS cross-compilers to x86 for our porting effort. We have our own set
of frontends. We're using llvm-mc as our assembler for the lower level OS
code.

Maybe I'm missing something here, but it seems like if you can run llvm-mc you
should also be able to run clang with the -x assembler flag. Is the problem
that you are unable to install clang on your dev system for some reason?

-Tom

From: Tom Stellard [mailto:tom@stellard.net]
Sent: Thursday, May 19, 2016 1:56 PM

>
> > It's my understanding that llvm-mc is intended to be a testing tool
> > for LLVM developers rather than an assembler for end users. Users
> > should be assembling with clang.
>
> Not all LLVM users are clang users. For example, we're using LLVM to
> build OpenVMS cross-compilers to x86 for our porting effort. We have
> our own set of frontends. We're using llvm-mc as our assembler for
> the lower level OS code.
>

Maybe I'm missing something here, but it seems like if you can run
llvm-mc you should also be able to run clang with the -x assembler
flag. Is the problem that you are unable to install clang on your dev
system for some reason?

-Tom

We haven't attempted to build clang yet as it isn't needed for our OS
bootstrap. In addition, given the somewhat stale C++ compiler we're using
on
OpenVMS Itanium (EDG/Intel-based), we're using LLVM 3.4.2 since it doesn't
use C++11 syntax in source code.

Even then, I had to make some changes to the LLVM source code to
get it past my C++ compiler (it has bugs with no hope of fixes).
I suspect I'll have to do the same in the clang 3.4.2 tree.
I just didn't bother with that yet.

I won't need clang until we have a working version of OpenVMS x86
so I can then bootstrap my way to something newer. Once running
natively, we'll use clang to build things going forward.

The OS team needs a cross-assembler. So I could spend my time to get
binutils
and gas working (it has an OpenVMS target so it isn't that complicated) or I
can just use the llvm-mc that builds with the rest of the LLVM tools. It
may not be the long-term solution once we get clang on the native systems.

Yes, the downside to the model is that there is no pre-processor that is
automatically run over the source (either using llvm-mc or gas) so that is
often run manually by the build system. That's what the OS team prefers
at the moment.

Sorry for missing any context. It appears the thread is forked somewhere.

It's my understanding that llvm-mc is intended to be a testing tool
for LLVM developers rather than an assembler for end users.

This is true.

Users
should be assembling with clang.

This is mostly true, as it’s atypical to be using LLVM for an assembler and not using clang as a C/C++ front end. It’s not, however, supposed to be a requirement to use clang.

Creating an as(1) style user-facing driver to package up the assembler independently of clang is a totally reasonable thing to do. That should, however, be a separate tool from llvm-mc.