lkml.org 
[lkml]   [2020]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7 2/2] tty: add rpmsg driver
From
Date
On Wed, 2020-03-25 at 14:31 +0100, Jiri Slaby wrote:
> The question was exactly about that: can a compiler optimize it to a
> bare number or will strlen call remain there?

$ cat str.c
#include <string.h>

int foo(void)
{
return strlen("abc");
}

$ gcc -c -O2 str.c
$ objdump -d str.o
str.o: file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <foo>:
0: f3 0f 1e fa endbr64
4: b8 03 00 00 00 mov $0x3,%eax
9: c3 retq


\
 
 \ /
  Last update: 2020-03-26 01:04    [W:0.115 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site