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

[Xen-devel] [XEN PATCH v3 22/23] xen, symbols: rework file symbols selection



Rework symbols so it prefer file symbols that names an object file to
file symbols that have a directory component.

But have symbols still prefer the first file symbol if one of the above
is true, or prefer the second file symbols if it names a source file
without directory component.

In a future patch, we are going want to run $(CC) from the root directory
(xen.git/xen that is). So the guest_walk_%.o files are going to have
two file symbols, one with a directory component and another one
which name an object file. We still want to prefer the file symbols
that names an object file, no mater if it is first or second.

And before running everything from the root directory, we will be able
to use the same runes to build the guest_%.o as to build any other %.o
files from %.c files (the rule with the objcopy --redefine-sym).

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 xen/tools/symbols.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index 9f9e2c990061..b7a00b4be487 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -80,11 +80,17 @@ static inline int is_arm_mapping_symbol(const char *str)
               && (str[2] == '\0' || str[2] == '.');
 }
 
+enum symbol_type {
+     symbol = 0,
+     single_source = 1,
+     dir_source = 2,
+     obj_source = 3,
+};
 static int read_symbol(FILE *in, struct sym_entry *s)
 {
        char str[500], type[20] = "";
        char *sym, stype;
-       static enum { symbol, single_source, multi_source } last;
+       static enum symbol_type last;
        static char *filename;
        int rc = -1;
 
@@ -125,13 +131,19 @@ static int read_symbol(FILE *in, struct sym_entry *s)
                 * prefer the first one if that names an object file or has a
                 * directory component (to cover multiply compiled files).
                 */
-               bool multi = strchr(str, '/') || (sym && sym[1] == 'o');
-
-               if (multi || last != multi_source) {
+               enum symbol_type current;
+               if (sym && sym[1] == 'o')
+                   current = obj_source;
+               else if (strchr(str, '/'))
+                   current = dir_source;
+               else
+                   current = single_source;
+
+               if (current > last || last == single_source) {
                        free(filename);
                        filename = *str ? strdup(str) : NULL;
+                       last = current;
                }
-               last = multi ? multi_source : single_source;
                goto skip_tail;
        }
 
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.