<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>This is what I see (guess the same thing):<br>
      <br>
      New Compiler:</p>
    <p>FPC_INITIALIZE:<br>
      .Lc3882:<br>
      # path: /Users/ring/devel/fpc/rtl/inc/<br>
      # file: rtti.inc<br>
      # indx: 19<br>
      .Ll10741:<br>
              push    {r4,r5,r14}<br>
      ...</p>
    <p>        ldr     r0,[r0, r1]<br>
              mov     r15,r0<br>
      .La5:<br>
              .long   .Lj13323</p>
    <p>Old Compiler (2 years old):</p>
    <p>FPC_INITIALIZE:<br>
      .Lc3594:<br>
      # path: /Users/ring/devel/freepascal-sources/rtl/inc/<br>
      # file: rtti.inc<br>
      # indx: 19<br>
      .Ll10488:<br>
              push    {r4,r5,r14}<br>
      ...</p>
    <p>        mov     r15,r0<br>
      <b>        .balign 4</b><br>
      .La5:<br>
              .long   .Lj12924<br>
    </p>
    <div class="moz-cite-prefix">Am 31.03.24 um 21:50 schrieb Florian
      Klämpfl via fpc-devel:<br>
    </div>
    <blockquote type="cite"
      cite="mid:DE236F9C-0283-425B-8366-A7DA0C35D93E@freepascal.org">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <br id="lineBreakAtBeginningOfMessage">
      <div><br>
        <blockquote type="cite">
          <div>Am 31.03.2024 um 21:35 schrieb Florian Klämpfl via
            fpc-devel <a class="moz-txt-link-rfc2396E" href="mailto:fpc-devel@lists.freepascal.org"><fpc-devel@lists.freepascal.org></a>:</div>
          <br class="Apple-interchange-newline">
          <div>
            <div><br>
              <br>
              <blockquote type="cite">Am 31.03.2024 um 17:11 schrieb
                Michael Ring via fpc-devel
                <a class="moz-txt-link-rfc2396E" href="mailto:fpc-devel@lists.freepascal.org"><fpc-devel@lists.freepascal.org></a>:<br>
                <br>
                Hi,<br>
                <br>
                it has been a while since I have been deep,deep down in
                the rabbit hole of Cortex Assembly, so please forgive me
                if I am overlooking something...<br>
                <br>
                I have an application for Raspberry Pico (target
                embedded) and it fails during initialization as soon as
                I add a unit that includes an object and I reference the
                object in my code...<br>
                <br>
                In that case fpc_initialize (for rtti?) is called and I
                cannot find source code for fpc_initialize<br>
                <br>
                In the debugger I see that R0 is $1000177E and R1 is $28
                This is in the flash area, so far, so good but $1000177E
                is obviously not word alligned, it is halfword aligned
                so this then triggers _HardFault_Handler.<br>
                <br>
                10001778 4648                     ldr             r0,
                [pc, #280] ; (0x10001894 <fpc_initialize+316>)<br>
                1000177A 4058                     ldr             r0,
                [r0, r1] ; Crash Boom Bang !!!!!<br>
                <br>
                Looking at the map file the address is within
                fpc_initialize, but as I cannot find the proper source I
                am a bit lost...<br>
                <br>
                .text.n_fpc_initialize<br>
                               0x0000000010001758      0x144
/Users/tgdrimi9/fpcupdeluxe/fpc/units/arm-embedded/armv6m/eabi/rtl/system.o<br>
                               0x0000000010001758
                               fpc_initialize<br>
                               0x0000000010001758
                               FPC_INITIALIZE<br>
                .text.n_fpc_finalize<br>
                               0x000000001000189c      0x164
/Users/tgdrimi9/fpcupdeluxe/fpc/units/arm-embedded/armv6m/eabi/rtl/system.o<br>
                <br>
                Any help appreciated,<br>
              </blockquote>
              <br>
              Can you post some more context? fpc_initalize is not that
              big so it should be possible to identify where this comes
              from.<br>
            </div>
          </div>
        </blockquote>
        <div><br>
        </div>
        Ok, I think I found it, it is one for Gareth:</div>
      <div><br>
      </div>
      <div>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">var</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">  i :
            longint;</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">begin</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">  case i
            of </span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">    1:
            writeln(1);</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">    2:
            writeln(2);</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">    3:
            writeln(2);</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">    4:
            writeln(2);</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">    5:
            writeln(2);</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">  end;</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">end.</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures"><br>
          </span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures"></span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures">ppcarm
            -Cparmv6m -al -O2 t.pp -Tlinux -Oonopeephole</span></p>
        <p
style="margin: 0px; font-style: normal; font-variant-caps: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; font-kerning: auto; font-variant-alternates: normal; font-variant-ligatures: normal; font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-position: normal; font-variant-emoji: normal; font-feature-settings: normal; font-optical-sizing: auto; font-variation-settings: normal;"><span
            style="font-variant-ligatures: no-common-ligatures"><br>
          </span></p>
      </div>
      <div>results in: </div>
      <div>...</div>
      <div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>sub<span
          class="Apple-tab-span" style="white-space:pre">        </span>r1,#1</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>lsl<span
          class="Apple-tab-span" style="white-space:pre">        </span>r1,r1,#2</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>ldr<span
          class="Apple-tab-span" style="white-space:pre">        </span>r0,.Lj11</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>ldr<span
          class="Apple-tab-span" style="white-space:pre">        </span>r0,[r0,
          r1]</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>mov<span
          class="Apple-tab-span" style="white-space:pre">        </span>r15,r0</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>.balign
          4</div>
        <div>.La1:</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>.long<span
          class="Apple-tab-span" style="white-space:pre">        </span>.Lj4</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>.long<span
          class="Apple-tab-span" style="white-space:pre">        </span>.Lj5</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>.long<span
          class="Apple-tab-span" style="white-space:pre">        </span>.Lj6</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>.long<span
          class="Apple-tab-span" style="white-space:pre">        </span>.Lj7</div>
        <div><span class="Apple-tab-span" style="white-space:pre">      </span>.long<span
          class="Apple-tab-span" style="white-space:pre">        </span>.Lj8</div>
        <div>…</div>
        <div><br>
        </div>
        <div>
          <div>The peephole removes the alignment before case jump
            tables: if no -Oonopeephole is passed, the .balign 4 is
            gone.</div>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
    </blockquote>
  </body>
</html>