>>>>> "DM" == Daniel-Constantin Mierla <notifications@github.com> writes:<br>
<br>
DM> If the function is not used in the same object (source file) only,<br>
DM> then inline should be removed,<br>
<br>
It is only used in the .xs file where it is defined.<br>
<br>
Without optimization gcc (at least gcc 5) leaves it in the .o file as an<br>
undefined symbol.<br>
<br>
I just duplicated what kamailio master does to make(1) kamailioxs.s, but<br>
with -S instead of -c.  The four places where sv2int_str() is called<br>
show up as:<br>
<br>
        call    sv2int_str@PLT<br>
<br>
With -O2 or -O1 it gets inlined.<br>
<br>
So it seems that w/o optimization gcc5 fails to inline the function at<br>
its call sites, but also leaves it out because it was defined as inline.<br>
<br>
Gcc-4.8, OTOH, compiles it as a non-inlined function called run w/o<br>
optimization.<br>
<br>
So this is a gcc bug which kamailio can work around by optimizing.<br>
<br>
I see in Makefile.defs that CC_OPT defaults to -O3 when using clang.<br>
And before that it is ?='ed to -O9.  But that -O9 didn't make it into<br>
the gcc calls when I tried compiling with Q=0.<br>
<br>
<br>
To test, make kama however you normally do, then:<br>
<br>
   cd src/modules/app_perl<br>
   rm kamailioxs.o<br>
   make kamailioxs.o Q=0<br>
<br>
copy the resulting cc line, replacing -c with -S and kamailioxs.o with<br>
kamailioxs.s and search for sv2int_str in that kamailioxs.s.<br>
<br>
-JimC<br>
-- <br>
James Cloos <cloos@jhcloos.com>         OpenPGP: 0x997A9F17ED7DAEA6<br>


<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you commented.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1012#issuecomment-284442048">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZYQeWNK_9IGsIzisXLuoR588U94Gks5rjC76gaJpZM4MPLTv">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36Za9Go7T21mVwGceyoDhNUGIy53pbks5rjC76gaJpZM4MPLTv.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/1012#issuecomment-284442048"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@jhcloos in #1012: \u003e\u003e\u003e\u003e\u003e \"DM\" == Daniel-Constantin Mierla \u003cnotifications@github.com\u003e writes:\n\nDM\u003e If the function is not used in the same object (source file) only,\nDM\u003e then inline should be removed,\n\nIt is only used in the .xs file where it is defined.\n\nWithout optimization gcc (at least gcc 5) leaves it in the .o file as an\nundefined symbol.\n\nI just duplicated what kamailio master does to make(1) kamailioxs.s, but\nwith -S instead of -c.  The four places where sv2int_str() is called\nshow up as:\n\n        call    sv2int_str@PLT\n\nWith -O2 or -O1 it gets inlined.\n\nSo it seems that w/o optimization gcc5 fails to inline the function at\nits call sites, but also leaves it out because it was defined as inline.\n\nGcc-4.8, OTOH, compiles it as a non-inlined function called run w/o\noptimization.\n\nSo this is a gcc bug which kamailio can work around by optimizing.\n\nI see in Makefile.defs that CC_OPT defaults to -O3 when using clang.\nAnd before that it is ?='ed to -O9.  But that -O9 didn't make it into\nthe gcc calls when I tried compiling with Q=0.\n\n\nTo test, make kama however you normally do, then:\n\n   cd src/modules/app_perl\n   rm kamailioxs.o\n   make kamailioxs.o Q=0\n\ncopy the resulting cc line, replacing -c with -S and kamailioxs.o with\nkamailioxs.s and search for sv2int_str in that kamailioxs.s.\n\n-JimC\n-- \nJames Cloos \u003ccloos@jhcloos.com\u003e         OpenPGP: 0x997A9F17ED7DAEA6\n"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1012#issuecomment-284442048"}}}</script>