llvm compiler

hello sir,
i compiled simple c program for printing hello world using clang front end it generates .s file successfully but while generating bit code it is showing error as

llvm-as: test.s:5:17: error: expected ‘global’ or ‘constant’
@.str = private unnamed_addr constant [12 x i8] c"hello world\00"

how to fix this error?

the .s file is in assembly language(not understandable) to rectify the error.please help me to rectify it.

Hi, it sounds like you are using llvm-as from an older version of LLVM.
Use the same version as you are using for clang.

Ciao, Duncan.

Manoj C <manoj.chinthala@gmail.com> writes:

  i compiled simple c program for printing hello world using clang front
end it generates .s file successfully but while generating bit code it is
showing error as

llvm-as: test.s:5:17: error: expected 'global' or 'constant'
@.str = private unnamed_addr constant [12 x i8] c"hello world\00"

how to fix this error?

the .s file is in assembly language(not understandable) to rectify the
error.please help me to rectify it.

That seems to indicate that llvm-as is not compatible with the LLVM
assembly generated by Clang, probably because llvm-as is more modern
than clang or vice-versa.

Check that Clang and LLVM are built from the source code that
corresponds to roughly the same date and time.

Failing that, show the exact commands you use for executing clang and
llvm-as, along with the output of `clang --version' and `llvm-as
--version'.