On 5/3/24 06:38, Matheus Tavares Bernardino wrote:
On Thu, 2 May 2024 13:00:34 -0700 Richard Henderson 
<richard.hender...@linaro.org> wrote:

On 5/2/24 12:20, Matheus Tavares Bernardino wrote:

+
+void test_multi_cof(void)
+{
+    asm volatile(
+        "p0 = cmp.eq(r0, r0)\n"
+        "{\n"
+        "    if (p0) jump test_multi_cof_unaligned\n"
+        "    if (!p0) jump 1f\n"
+        "}\n"
+        "1: nop\n"

Does it work to write "jump 1f+1" or something?

Unfortunately no :( The assembler will align the address when encoding the
instruction. The only working examples I could think of is using a separated
file, like before, or manually encoding the instruction with a misaligned
address and place it with a `.word` directive... Any preferences, or other
suggestions?

Oof.  The assembler is being too helpful.  :-P

Perhaps using a different section could solve the fragility issue:

asm("
        .pushsection .text.evil
        .org 3
        ...
        .popsection
");

(adjusting syntax as necessary for correctness), then it doesn't matter where in the output assembly the fragment lands.


r~

Reply via email to