0

when i run gcc -c *.c, it runs:-

gcc -c file1.c -o file1.o
gcc -c file2.c -o file2.o
gcc -c file3.c -o file3.o
...

but as *.s runs:-

as file1.s -o a.out
as file2.s -o a.out
as file3.s -o a.out
...

by default, gcc replaces the only the file extension while compiling into an object file but gnu as sets the default file output as a.out. how to make gnu as to replace .s into .o while assembling?

1 Answer 1

2

I don’t think you can get as to do that on its own, but you can use gcc to drive as:

gcc -c *.s

This will produce file1.o, file2.o etc.

If you need to provide as-specific options, you can add them with -Xassembler, e.g.

gcc -c -Xassembler -mindex-reg *.s
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.