1

I have used objdump -S to get an intermix of source code and disassembled binary lines for /lib/x86_64-linux-gnu/libc.so.6.

Digging into the generated output shows that a considerable amount of GNU C library has been written in assembly files with .S format.

Could anyone please let me know if these .S files are for the system calls? If so, what else is covered by these assemblies?

Qix - MONICA WAS MISTREATED
  • 14,451
  • 16
  • 82
  • 145
user3684042
  • 651
  • 2
  • 6
  • 16

2 Answers2

1

Could anyone please let me know if these .S files are for the system calls?

The glibc system calls are implemented in assembly files, yes.

If so, what else is covered by these assemblies?

Lots of other stuff. Off the top of my head, on x86_64:

  • IFUNCs
  • PLT stubs
  • parts of the dynamic loader that actually perform PLT resolution,
  • hand-optimized strcpy, strstr, memcpy, memmove, some trigonometry functions.

Some platforms do not have (some of the) above hand-optimized assembly routines, and have fewer .S files. The PLT resolution can not be done in pure C, and so is implemented in assembly on all platforms.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
0

Instead of reverse engineering them, why not simply look at the source code? glibc is open source: https://www.gnu.org/software/libc/download.html

Also, this question refers to places on the web that the source may be browsed.

Community
  • 1
  • 1
Edward
  • 6,964
  • 2
  • 29
  • 55
  • Thanks for your reply. Since there are too many of these .S files, reading them is not that much easy. So, I would prefer to only know what functionalists in general are implemented in assembly rather than high level C. – user3684042 Aug 06 '14 at 15:20