I am using my own modified glibc. I saw in the compiled code that compiler was not using many standard library functions from my glibc when I linked with it. Then I put -fno-builtin
flag. Things got better and I could see that many functions which were not taken from glibc were now taken from there, such as malloc
.
However, still for many functions, such as mmap
, the compiler is using some built-in-code. Now how can I ask the compiler to please exclusively use the code from glibc rather than using its built-in-functions?
On my x86-64 function, if I do objdump of the compiled glibc, following is the generated mmap function. I can't find equivalent code in the glibc source.
0000000000000000 <__mmap>:
0: 49 89 ca mov %rcx,%r10
3: b8 09 00 00 00 mov $0x9,%eax
8: 0f 05 syscall
a: 48 3d 01 f0 ff ff cmp $0xfffffffffffff001,%rax
10: 0f 83 00 00 00 00 jae 16 <__mmap+0x16>
16: c3 retq