Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the file name would affect the compiler process? #232

Open
xubenji opened this issue Apr 9, 2021 · 1 comment
Open

Is the file name would affect the compiler process? #232

xubenji opened this issue Apr 9, 2021 · 1 comment

Comments

@xubenji
Copy link

xubenji commented Apr 9, 2021

If you change the boot.S to boot.asm, you won't get boot_s.o when you compiler boot.S.
As you can see in this picture, When I compile boot.S, it can be compiled correctly. But when I change it to boot.asm and other file names. it won't be compiled correctly.
IMELEXM`L(@KMXXG6AA%6PJ
Even it is a warning, it still can't generate the .o file.

@Kristine1975
Copy link

Yes, the file name affects the compiler process. How gcc processes a file depends on its extension. See https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html:

file.s Assembler code.
file.S, file.sx: Assembler code that must be preprocessed.
other: An object file to be fed straight into linking. Any file name with no recognized suffix is treated this way.

So gcc will not process file boot.asm in any way. It won't assemble it like it would file boot.s. Instead it passes it to the linker. And as gcc is called with -c for "compile/assemble only, do not link", it warns that the file is not used. See again https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html:

-c: Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants