<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=us-ascii"><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;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        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="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>I’ve been adding ELF/AArch64 support to lld based off the existing x86_64 code that is already there in lld. I’ve been able to compile and link a simple “Hello World”-type program. However, I’m getting what appears to be a misplacement/name change of the _start atom. When I do the link, the _start section gets named __tls_get_addr. The code inside this section appears to be correct, just the name is wrong. If I output in YAML, it appears to have the correct name. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Since I know this is new code that no one has seen, I was just wondering if anyone might give me a hint as to why this might happen or a good place to start looking. I’m new to the linker and only have been looking into lld for about a week. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The output in YAML for the section in question is:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>  - name:            _start<o:p></o:p></p><p class=MsoNormal>    scope:           global<o:p></o:p></p><p class=MsoNormal>    content:         [ 1D, 00, 80, D2, 1E, 00, 80, D2, FD, 03, 00, 91, <o:p></o:p></p><p class=MsoNormal>                       E5, 03, 00, AA, E1, 03, 40, F9, E2, 23, 00, 91, <o:p></o:p></p><p class=MsoNormal>                       E6, 03, 00, 91, A0, 00, 00, 58, C3, 00, 00, 58, <o:p></o:p></p><p class=MsoNormal>                       E4, 00, 00, 58, 00, 00, 00, 94, 00, 00, 00, 94 ]<o:p></o:p></p><p class=MsoNormal>    alignment:       2^3<o:p></o:p></p><p class=MsoNormal>    section-name:    .text<o:p></o:p></p><p class=MsoNormal>    references:      <o:p></o:p></p><p class=MsoNormal>      - kind:            R_AARCH64_CALL26<o:p></o:p></p><p class=MsoNormal>        offset:          40<o:p></o:p></p><p class=MsoNormal>        target:          __plt___libc_start_main<o:p></o:p></p><p class=MsoNormal>      - kind:            R_AARCH64_CALL26<o:p></o:p></p><p class=MsoNormal>        offset:          44<o:p></o:p></p><p class=MsoNormal>        target:          __plt_abort<o:p></o:p></p><p class=MsoNormal>      - kind:            in-group<o:p></o:p></p><p class=MsoNormal>        offset:          0<o:p></o:p></p><p class=MsoNormal>        target:          L030<o:p></o:p></p><p class=MsoNormal>      - kind:            layout-after<o:p></o:p></p><p class=MsoNormal>        offset:          0<o:p></o:p></p><p class=MsoNormal>        target:          '$d.010'<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The output during objdump of that section is:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>00000000004006d0 <__tls_get_addr>:<o:p></o:p></p><p class=MsoNormal>  4006d0:              d280001d             mov       x29, #0x0                             // #0<o:p></o:p></p><p class=MsoNormal>  4006d4:              d280001e             mov       x30, #0x0                             // #0<o:p></o:p></p><p class=MsoNormal>  4006d8:              910003fd              mov       x29, sp<o:p></o:p></p><p class=MsoNormal>  4006dc:               aa0003e5             mov       x5, x0<o:p></o:p></p><p class=MsoNormal>  4006e0:              f94003e1              ldr           x1, [sp]<o:p></o:p></p><p class=MsoNormal>  4006e4:              910023e2             add        x2, sp, #0x8<o:p></o:p></p><p class=MsoNormal>  4006e8:              910003e6             mov       x6, sp<o:p></o:p></p><p class=MsoNormal>  4006ec:               580000a0             ldr           x0, 400700 <__tls_get_addr+0x30><o:p></o:p></p><p class=MsoNormal>  4006f0:               580000c3              ldr           x3, 400708 <__tls_get_addr+0x38><o:p></o:p></p><p class=MsoNormal>  4006f4:               580000e4             ldr           x4, 400710 <__tls_get_addr+0x40><o:p></o:p></p><p class=MsoNormal>  4006f8:               97ffffe6                bl            400690 <__libc_start_main@plt><o:p></o:p></p><p class=MsoNormal>  4006fc:                97ffffe9                bl            4006a0 <abort@plt><o:p></o:p></p><p class=MsoNormal>  400700:               004008a0             .inst       0x004008a0 ; undefined<o:p></o:p></p><p class=MsoNormal>  400704:               00000000             .inst       0x00000000 ; undefined<o:p></o:p></p><p class=MsoNormal>  400708:               00400934             .inst       0x00400934 ; undefined<o:p></o:p></p><p class=MsoNormal>  40070c:               00000000             .inst       0x00000000 ; undefined<o:p></o:p></p><p class=MsoNormal>  400710:               004009ac              .inst       0x004009ac ; undefined<o:p></o:p></p><p class=MsoNormal>  400714:               00000000             .inst       0x00000000 ; undefined<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Daniel<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>--<o:p></o:p></p><p class=MsoNormal>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>