<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:70.85pt 70.85pt 56.7pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Try adding -fno-function-sections to make sure it’s turned off (sounds like it is on by default for your target).<o:p></o:p></p>
<p class="MsoNormal">--paulr<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> cfe-dev <cfe-dev-bounces@lists.llvm.org> <b>On Behalf Of
</b>Gaier, Bjoern via cfe-dev<br>
<b>Sent:</b> Wednesday, January 20, 2021 5:01 AM<br>
<b>To:</b> Clang Dev <cfe-dev@lists.llvm.org><br>
<b>Subject:</b> [cfe-dev] Clang function-sections flag<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB">Hey Clang-people,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">I have a nooby question about the -ffunction-sections flag of Clang.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">As far as I used to understand, setting this flag means, that every function gets their own section. Makes sense so far.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Recently I started to look into the ELF format a bit so that subject came up. I created a macro to quickly generate me some functions:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">#define wuff(a, b) \<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">a##b<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE">#define crap(num) \<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">int wuff(schwimmflugel, num) () \<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">{ \<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"> return num; \<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Creating the object file and looking into it, I found a section header for every of my functions no matter if I set the -ffunction-sections flag or not.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Also setting my function to static didn't changed a thing.... well besides from having those functions striped from my object file xD<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">So... what does that flag effect?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Kind greetings<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Björn<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Takashi Nagano, Junichi Tajika, Ergin Cansiz.
<o:p></o:p></span></p>
</div>
</div>
</body>
</html>