From: Kazuhito Hagio <k-hagio-ab(a)nec.com>
As written in the previous patch, some recent kernels do not have the
".rodata" symbol. As a result, the get_linux_banner_from_vmlinux()
returns FALSE and the slower fallback routine is used.
Use "__start_rodata" symbol if the ".rodata" symbol is not available.
Reported-by: Lianbo Jiang <lijiang(a)redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
---
Note that I chose to use ".rodata" first to not change the current
stable behavior for old vmcores, in this case.
kernel.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kernel.c b/kernel.c
index 9801812387bd..2114700eecc8 100644
--- a/kernel.c
+++ b/kernel.c
@@ -11891,8 +11891,13 @@ int get_linux_banner_from_vmlinux(char *buf, size_t size)
{
struct bfd_section *sect;
long offset;
+ ulong start_rodata;
- if (!kernel_symbol_exists(".rodata"))
+ if (kernel_symbol_exists(".rodata"))
+ start_rodata = symbol_value(".rodata");
+ else if (kernel_symbol_exists("__start_rodata"))
+ start_rodata = symbol_value("__start_rodata");
+ else
return FALSE;
sect = bfd_get_section_by_name(st->bfd, ".rodata");
@@ -11905,7 +11910,7 @@ int get_linux_banner_from_vmlinux(char *buf, size_t size)
* value in vmlinux file, but relative offset to linux_banner
* object in .rodata section is idential.
*/
- offset = symbol_value("linux_banner") - symbol_value(".rodata");
+ offset = symbol_value("linux_banner") - start_rodata;
if (!bfd_get_section_contents(st->bfd,
sect,
--
2.31.1