<div dir="ltr">I think I share the goal with you to make the foundation for better dead-strip, so thank you for suggesting. I'm not sure if marking a section as a whole as "safe" or "unsafe" is the best approach, though. Some comments.<div>
<br></div><div> - If the compiler generated code is always "safe", and if we can distinguish it from hand-written assembly code by checking if there's a gap between symbols, can we just assume a section with no gap is always "safe"?</div>
<div> - "Safeness" is not an attribute of the section but of the symbol, I think. The symbol is "safe" if there's no direct reference to the symbol data. All references should go through relocations. A section may contain both "safe" and "unsafe" symbols.</div>
<div> - How about making the compiler to create a new section for each "safe" atom, as it does for inline functions?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 25, 2013 at 10:54 AM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
Currently lld ties up all atoms in a section for ELF together. This
proposal just breaks it by handling it differently.<br>
<br>
<b>This requires </b><b>NO ELF ABI changes.<br>
<br>
</b><u><b>Definitions :-</b></u><br>
<br>
A section is not considered safe if there is some code that appears
to be present between function boundaries (or) optimizes sections to
place data at the end or beginning of a section (that contains no
symbol).<br>
<br>
A section is considered safe if symbols contained within the section
have been associated with their appropriate sizes and there is no
data present between function boundaries.<br>
<br>
Examples of safe sections are, code generated by compilers.<br>
<br>
Examples of unsafe sections are, hand written assembly code.<br>
<br>
<u><b>Changes Needed :-</b></u><br>
<br>
The change that I am trying to propose is the compiler emits a
section, called (<b>.safe_sections) </b>that contains section
indices on what sections are safe.<br>
<br>
The section would have a SHF_EXCLUDE flag, to prevent other linkers
from consuming this section and making it to the output file.<br>
<br>
Data structure for this :-<br>
<br>
.safe_sections<br>
<total size> <br>
<section index> <boolean flag -- safe/unsafe><br>
...<br>
...<br>
<br>
<br>
<b><u>Advantages</u><br>
</b>There are advantages that the atoms within a safe section could
just be allocated in the output file which means better output file
layout, and Better performance!<br>
<br>
This would also result in more atoms getting gc'ed.<br>
<br>
a) looking at profile information<br>
b) taking a order file<br>
<br>
<b><u>Changes needed in the assembler</u><br>
<br>
</b>a) add an additional flag in the section for people writing
assembly code, to mark a section safe or unsafe.<br>
<b><br>
</b><b><u>Changes needed in lld</u><br>
<br>
</b>a) Read the safe section if its present in the object file<br>
b) Tie atoms together within a section if the section is not safe<br>
<b><br>
</b>Thanks<span class="HOEnZb"><font color="#888888"><br>
<br>
Shankar Easwaran<b><br>
</b>
<pre cols="72">--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation</pre>
</font></span></div>
</blockquote></div><br></div>