diff mbox series

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

Message ID 20241129014850.2852844-2-volodymyr_babchuk@epam.com (mailing list archive)
State New
Headers show
Series aarch64, common: improve clang and llvm support | expand

Commit Message

Volodymyr Babchuk Nov. 29, 2024, 1:49 a.m. UTC
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(+)

Comments

Jan Beulich Nov. 29, 2024, 7:44 a.m. UTC | #1
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
diff mbox series

Patch

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)