<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>I am trying to solve issue I am demonstrating at
</span><a href="https://reviews.llvm.org/D29217" rel="noreferrer" target="_blank" style="color: rgb(33, 33, 33); font-size: 12pt;">https://reviews.llvm.org/D2921<wbr>7</a><span style="color: rgb(33, 33, 33); font-size: 12pt;"> page.</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>It has:</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<font color="#212121">>><br>
</font>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .section .aaa.1,"a"</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .byte 11</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .section .aaa.2,"a"</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .byte 22</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<font color="#212121">>><br>
</font>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .section .bbb.1,"aMS",@progbits,1</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .asciz "foo"</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .section .bbb.2,"aMS",@progbits,1</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .asciz "foo"</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<font color="#212121">>><br>
</font>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .section .ccc.1,"a"</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .byte 33</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .section .ccc.2,"a"</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .byte 44</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<font color="#212121">>><br>
</font>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>It has also symbols assignments to A and B that should mark the start/end of .ccc :</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<font color="#212121">>><br>
</font>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>  .rodata </span><span style="color: rgb(33, 33, 33); font-size: 12pt;">: { *(.aaa.*) *(.bbb.*) A = .; *(.ccc.*) B = .; }</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<font color="#212121">>><br>
</font>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>*</span><span style="color: rgb(33, 33, 33); font-size: 12pt;">*1. LLD currently (clean head revision) do: **</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<font color="#212121">>><br>
</font>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>It creates 2 output .rodata sections:</span><br>
<blockquote class="gmail_quote" style="color: rgb(33, 33, 33); margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
</blockquote>
<span style="color: rgb(33, 33, 33); font-size: 12pt;">>>.rodata (.aaa.1 .aaa.2 .ccc.1 .ccc.2)</span><br>
>>.rodata (.bbb.1 .bbb.2)<br>
<div style="color: rgb(33, 33, 33);">> </div>
<div style="color: rgb(33, 33, 33);">>OK, so my understanding is this.</div>
<div style="color: rgb(33, 33, 33);">></div>
<div style="color: rgb(33, 33, 33);">>Assume you have four mergeable string input sections .foo.1, .foo.2, .bar.1 and .bar.2, where .foo.{1,2} are writable but .bar.{1,2} are not. Also assume you have this >linker script.</div>
<div style="color: rgb(33, 33, 33);">> </div>
<div style="color: rgb(33, 33, 33);">>  .rodata : { *(.foo.*) *(.bar.*); }<br>
</div>
<div style="color: rgb(33, 33, 33);">> </div>
<div style="color: rgb(33, 33, 33);">>LLD currently creates two .rodata sections for those inputs. One for .foo.{1,2} and the other for .bar.{1,2}. This is because mergeable sections are merged based on >section attributes.</div>
<div style="color: rgb(33, 33, 33);">> </div>
<div style="color: rgb(33, 33, 33);">>Is this correct? What do you think is a correct behavior?<br>
</div>
<div style="color: rgb(33, 33, 33);"><br>
</div>
<div style="color: rgb(33, 33, 33);">If you look at my testcase D29217, you'll see it is not issue I am trying to solve. </div>
<div style="color: rgb(33, 33, 33);"><span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">Also, looking at the </span><span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">writable-merge.s</span><span style="color: rgb(33, 33, 33); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">​
 testcase, I think your example is unreal, we do not support writable merge sections.</span>​<br>
</div>
<div style="color: rgb(33, 33, 33);"><br>
</div>
<div style="color: rgb(33, 33, 33);">I am trying to solve situation when mergeable and non-mergeable sections are mixed inside single command, what results in a two different output section and breaks symbol assigning logic.<br>
</div>
<div style="color: rgb(33, 33, 33);">Clean solution here is to create synthetic mergeable sections, right ? So I think correct behavior for my testcase it to create single output section.<br>
</div>
<div style="color: rgb(33, 33, 33);"><br>
</div>
<div style="color: rgb(33, 33, 33);">George.<br>
</div>
<div style="color: rgb(33, 33, 33);"><br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>