[PATCH 1/5] arm: bugframe: emit msg offset only if msg is present

Volodymyr Babchuk posted 5 patches 3 weeks, 6 days ago
[PATCH 1/5] arm: bugframe: emit msg offset only if msg is present
Posted by Volodymyr Babchuk 3 weeks, 6 days ago
Before this change, compiler would generate symbol that points right
past .rodata.str section. While GNU ld handles this just fine, LLVM ld
will complain:

ld.lld: error: common/device-tree/device-tree.o:(.rodata.str): offset is outside the section

Fix this issue by providing literal zero instead of calculated zero if
there is no error message in a bugframe.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 xen/arch/arm/include/asm/bug.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/arm/include/asm/bug.h b/xen/arch/arm/include/asm/bug.h
index cacaf014ab..9339e3bbf6 100644
--- a/xen/arch/arm/include/asm/bug.h
+++ b/xen/arch/arm/include/asm/bug.h
@@ -47,7 +47,11 @@ struct bug_frame {
          ".p2align 2\n"                                                     \
          ".long (1b - 4b)\n"                                                \
          ".long (2b - 4b)\n"                                                \
+         ".if " #has_msg "\n"                                               \
          ".long (3b - 4b)\n"                                                \
+         ".else\n"                                                          \
+         ".long 0\n"                                                        \
+         ".endif\n"                                                         \
          ".hword " __stringify(line) ", 0\n"                                \
          ".popsection");                                                    \
 } while (0)
-- 
2.47.0
Re: [PATCH 1/5] arm: bugframe: emit msg offset only if msg is present
Posted by Jan Beulich 3 weeks, 6 days ago
On 29.11.2024 02:49, Volodymyr Babchuk wrote:
> Before this change, compiler would generate symbol that points right
> past .rodata.str section. While GNU ld handles this just fine, LLVM ld
> will complain:
> 
> ld.lld: error: common/device-tree/device-tree.o:(.rodata.str): offset is outside the section

As this is pretty clearly a bug in the linker, has that been reported
there? A reference to such a bug report would then imo want ...

> --- a/xen/arch/arm/include/asm/bug.h
> +++ b/xen/arch/arm/include/asm/bug.h
> @@ -47,7 +47,11 @@ struct bug_frame {
>           ".p2align 2\n"                                                     \
>           ".long (1b - 4b)\n"                                                \
>           ".long (2b - 4b)\n"                                                \
> +         ".if " #has_msg "\n"                                               \
>           ".long (3b - 4b)\n"                                                \
> +         ".else\n"                                                          \
> +         ".long 0\n"                                                        \
> +         ".endif\n"                                                         \
>           ".hword " __stringify(line) ", 0\n"                                \
>           ".popsection");                                                    \
>  } while (0)

... attaching as a comment here, to make clear why the extra complexity is
needed.

Jan