<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
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="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal" style="margin-left:.5in">Ah, yep. I thought about the possibility of actually doing symbol lookup - but that seemed a bit extreme to me (having to go outside the DWARF to figure out the name). Though that wouldn't work if the variable/function
is optimized out (if it's defined in another object file and that isn't referenced/is omitted by the linker, or -Wl,-gc-sections, etc).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Don’t necessarily need to go outside the DWARF? given that the symbol ought to have a DWARF description whose location expression should be the same address. If you’ve already loaded the unit then the address-based lookup is feasible.
And in fact (for example) ELF symbol lookup isn’t going to work for a `static` item anyway, AFAICT only non-private symbols end up in the ELF symbol table.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><br>
There's some quirks here - for some reason these relocations used in the ELF file to write the address of the variables/functions for pointer non-type-template parameters into the DWARF data cause linker errors if those globals aren't defined (which leads to
-g/-g0 codegen differences, since the linker is pulling in these symbols, could pull in global ctors in the objects that define those symbols, etc) but the symbols /can/ still be eliminated with -ffunction-sections f-data-sections -Wl,-gc-sections... <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hmm don’t think that references from .debug_* sections count as gc roots? I may be mistaken, this might be a Sony-proprietary linker behavior and not something LLD does, but IMO that should be LLD’s behavior as well. The relocations would
end up as unresolved and be tombstoned. <o:p></o:p></p>
<p class="MsoNormal">--paulr<o:p></o:p></p>
</div>
</body>
</html>