Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are .S files?

I've seen .S files in various projects such as in the Linux Kernel, FreeBSD kernel, or in some other projects. What do these files do and why can't we have .c files instead ?

like image 745
Eastern Monk Avatar asked Apr 23 '12 17:04

Eastern Monk


People also ask

What does a .S file do?

An S file is a generic source code file that contains the source for a computer program. It may be written in a number of different programming languages, but is commonly used for storing Assembly code.

How do I open a .S file?

You need a suitable software like Modula-3 to open an S file. Without proper software you will receive a Windows message "How do you want to open this file?" or "Windows cannot open this file" or a similar Mac/iPhone/Android alert. If you cannot open your S file correctly, try to right-click or long-press the file.

What are .S files in C?

. S files are assembly language files. They are a form of machine code. It is at a low level of programming.

How do I write .S file?

a . S file is assembly language source code, for code written with the Gnu assembler that is part of gcc. You just create it with whichever editor you're using "new tab" will work fine - just create "foo. S" or whatever.


1 Answers

.S files are source code files written in assembly. Assembly is an extremely low-level form of programming. The files contain assembly instructions to the processor in sequential order and are typically compiled based on a selected architecture. Examples of such files are often seen in the linux kernel for specific architectures, e.g. x86, sparc, ARM, etc.

For more information about assembly language:

  • X86 Assembly/GAS syntax
  • x86 Instruction list
  • TLDP Linux Assembly Howto
  • Example in the Linux kernel: arch/x86/net/bpf_jit.S
like image 199
lukecampbell Avatar answered Oct 12 '22 17:10

lukecampbell