Strip llvm text symbol name ending

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I found an issue when the kernel build by LLVM,many symbol missing,such as irq_desc_tree,causes irq -s command execution failed ,so i add llvm to strip_symbol_end:

Issue fix after applying the patch

 

crash> irq -s

           CPU0       CPU1       CPU2       CPU3       CPU4       CPU5       CPU6       CPU7 

irq: neither irq_desc, _irq_desc, irq_desc_ptrs or irq_desc_tree symbols exist

 

crash> sym irq_desc_tree

symbol not found: irq_desc_tree

possible alternatives:

  ffffffd44bcbbf60 (d) irq_desc_tree.llvm.7481403593665956221

 

diff --git a/symbols.c b/symbols.c

index 449d6d4..3b1f08a 100644

--- a/symbols.c

+++ b/symbols.c

@@ -540,30 +540,28 @@ get_text_init_space(void)

 static char *

 strip_symbol_end(const char *name, char *buf)

 {

+       int i;

        char *p;

+       char *strip[] = {

+               ".isra.",

+               ".part.",

+               ".llvm.",

+               NULL

+       };

 

        if (st->flags & NO_STRIP)

                return (char *)name;

 

-       if ((p = strstr(name, ".isra."))) {

-               if (buf) {

-                       strcpy(buf, name);

-                       buf[p-name] = NULLCHAR;

-                       return buf;

-               } else {

-                       *p = NULLCHAR;

-                       return (char *)name;

-               }

-       }

-

-       if ((p = strstr(name, ".part."))) {

-               if (buf) {

-                       strcpy(buf, name);

-                       buf[p-name] = NULLCHAR;

-                       return buf;

-               } else {

-                       *p = NULLCHAR;

-                       return (char *)name;

+       for (i = 0; strip[i]; i++) {

+               if ((p = strstr(name, strip[i]))) {

+                       if (buf) {

+                               strcpy(buf, name);

+                               buf[p-name] = NULLCHAR;

+                               return buf;

+                       } else {

+                               *p = NULLCHAR;

+                               return (char *)name;

+                       }

                }

        }​

 

 

#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#
From a005374d4b6c4340d32dd23afbe20a86c18fd421 Mon Sep 17 00:00:00 2001
From: zhaoqianli <zhaoqianli@xxxxxxxxxx>
Date: Tue, 21 Apr 2020 21:32:06 +0800
Subject: [PATCH] Strip llvm text symbol name ending,without the patch many
 symbols will be lost if using llvm compiler

Signed-off-by: zhaoqianli <zhaoqianli@xxxxxxxxxx>
---
 symbols.c | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/symbols.c b/symbols.c
index 449d6d4..3b1f08a 100644
--- a/symbols.c
+++ b/symbols.c
@@ -540,30 +540,28 @@ get_text_init_space(void)
 static char *
 strip_symbol_end(const char *name, char *buf)
 {
+	int i;
 	char *p;
+	char *strip[] = {
+		".isra.",
+		".part.",
+		".llvm.",
+		NULL
+	};
 
 	if (st->flags & NO_STRIP)
 		return (char *)name;
 
-	if ((p = strstr(name, ".isra."))) {
-		if (buf) {
-			strcpy(buf, name);
-			buf[p-name] = NULLCHAR;
-			return buf;
-		} else {
-			*p = NULLCHAR;
-			return (char *)name;
-		}
-	}
-
-	if ((p = strstr(name, ".part."))) {
-		if (buf) {
-			strcpy(buf, name);
-			buf[p-name] = NULLCHAR;
-			return buf;
-		} else {
-			*p = NULLCHAR;
-			return (char *)name;
+	for (i = 0; strip[i]; i++) {
+		if ((p = strstr(name, strip[i]))) {
+			if (buf) {
+				strcpy(buf, name);
+				buf[p-name] = NULLCHAR;
+				return buf;
+			} else {
+				*p = NULLCHAR;
+				return (char *)name;
+			}
 		}
 	}
 
-- 
2.7.4

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux