Skip to content

Commit

Permalink
linux/export: Fix alignment for 64-bit ksymtab entries
Browse files Browse the repository at this point in the history
An alignment of 4 bytes is wrong for 64-bit platforms which don't define
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS (which then store 64-bit pointers).
Fix their alignment to 8 bytes.

Fixes: ddb5cdb ("kbuild: generate KSYMTAB entries by modpost")
Signed-off-by: Helge Deller <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
hdeller authored and masahir0y committed Dec 23, 2023
1 parent 2cc14f5 commit f684780
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/linux/export-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
* and eliminates the need for absolute relocations that require runtime
* processing on relocatable kernels.
*/
#define __KSYM_ALIGN ".balign 4"
#define __KSYM_REF(sym) ".long " #sym "- ."
#elif defined(CONFIG_64BIT)
#define __KSYM_ALIGN ".balign 8"
#define __KSYM_REF(sym) ".quad " #sym
#else
#define __KSYM_ALIGN ".balign 4"
#define __KSYM_REF(sym) ".long " #sym
#endif

Expand All @@ -42,7 +45,7 @@
" .asciz \"" ns "\"" "\n" \
" .previous" "\n" \
" .section \"___ksymtab" sec "+" #name "\", \"a\"" "\n" \
" .balign 4" "\n" \
__KSYM_ALIGN "\n" \
"__ksymtab_" #name ":" "\n" \
__KSYM_REF(sym) "\n" \
__KSYM_REF(__kstrtab_ ##name) "\n" \
Expand Down

0 comments on commit f684780

Please sign in to comment.