Patches objdump (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 3 Jun 2013 16:33:10 +0000 (09:33 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 3 Jun 2013 16:33:10 +0000 (09:33 -0700)
Backports an objdump patch, allowing it to be called with -S from a
Makefile that reincludes one of its parts (such as auto.conf).

Rebuild binutils (rm the builddir, config file, and binutils-2.21.1/
directory, then remake).

Makefile
tools/compilers/gcc-glibc/Makefile
tools/compilers/gcc-glibc/binutils-2.21.1-objdump.patch [new file with mode: 0644]

index 2274775..3385ca1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -433,16 +433,13 @@ $(kern_cpio_obj): $(kern_cpio)
 $(ext2_bdev_obj): $(ext2-bdev)
        $(Q)$(OBJCOPY) -I binary -B $(ld_arch) -O $(ld_emulation) $^ $@
 
-# TODO super-bugged objdump!  Passing -S (intermix source) and having auto.conf
-# be regenerated while the Makefile is running causes a segfault.  This would
-# happen after touching .config and remaking.  For now, just pass -d...
 quiet_cmd_link-akaros = LINK    $@
       cmd_link-akaros = $(LD) -T kern/arch/$(ARCH)/kernel.ld -o $@ \
                               $(akaros-deps) \
                               $(gcc-lib) \
                               $(kern_cpio_obj) \
                               $(ext2_bdev_obj) ; \
-                              $(OBJDUMP) -d $@ > $@.asm
+                              $(OBJDUMP) -S $@ > $@.asm
 
 # For some reason, the if_changed doesn't work with FORCE (like it does in
 # Linux).  It looks like it can't find the .cmd file or something (also
index 11aa5c6..5f020fe 100644 (file)
@@ -140,6 +140,7 @@ binutils-$(BINUTILS_VERSION): binutils-$(BINUTILS_VERSION).tar.bz2
        tar -jxf binutils-$(BINUTILS_VERSION).tar.bz2
        patch -p0 < binutils-$(BINUTILS_VERSION)-ros.patch
        patch --no-backup-if-mismatch -p0 < binutils-$(BINUTILS_VERSION)-riscv.patch
+       patch -p0 < binutils-$(BINUTILS_VERSION)-objdump.patch
 
 gcc-$(GCC_VERSION): gcc-$(GCC_VERSION).tar.bz2
        rm -rf gcc-$(GCC_VERSION)
diff --git a/tools/compilers/gcc-glibc/binutils-2.21.1-objdump.patch b/tools/compilers/gcc-glibc/binutils-2.21.1-objdump.patch
new file mode 100644 (file)
index 0000000..9b86788
--- /dev/null
@@ -0,0 +1,50 @@
+diff -u -p -r1.58 syms.c
+--- binutils-2.21.1/bfd/syms.c 10 Jan 2013 20:03:55 -0000      1.58
++++ binutils-2.21.1/bfd/syms.c 3 Jun 2013 04:01:18 -0000
+@@ -934,7 +934,7 @@ _bfd_stab_section_find_nearest_line (bfd
+   struct stab_find_info *info;
+   bfd_size_type stabsize, strsize;
+   bfd_byte *stab, *str;
+-  bfd_byte *last_stab = NULL;
++  bfd_byte *last_stab, *last_str;
+   bfd_size_type stroff;
+   struct indexentry *indexentry;
+   char *file_name;
+@@ -1147,8 +1147,9 @@ _bfd_stab_section_find_nearest_line (bfd
+       file_name = NULL;
+       directory_name = NULL;
+       saw_fun = 1;
++      stroff = 0;
+-      for (i = 0, stroff = 0, stab = info->stabs, str = info->strs;
++      for (i = 0, last_stab = stab = info->stabs, last_str = str = info->strs;
+          i < info->indextablesize && stab < info->stabs + stabsize;
+          stab += STABSIZE)
+       {
+@@ -1174,7 +1175,7 @@ _bfd_stab_section_find_nearest_line (bfd
+               {
+                 info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF);
+                 info->indextable[i].stab = last_stab;
+-                info->indextable[i].str = str;
++                info->indextable[i].str = last_str;
+                 info->indextable[i].directory_name = directory_name;
+                 info->indextable[i].file_name = file_name;
+                 info->indextable[i].function_name = NULL;
+@@ -1192,6 +1193,7 @@ _bfd_stab_section_find_nearest_line (bfd
+             else
+               {
+                 last_stab = stab;
++                last_str = str;
+                 if (stab + STABSIZE >= info->stabs + stabsize
+                     || *(stab + STABSIZE + TYPEOFF) != (bfd_byte) N_SO)
+                   {
+@@ -1242,7 +1244,7 @@ _bfd_stab_section_find_nearest_line (bfd
+       {
+         info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF);
+         info->indextable[i].stab = last_stab;
+-        info->indextable[i].str = str;
++        info->indextable[i].str = last_str;
+         info->indextable[i].directory_name = directory_name;
+         info->indextable[i].file_name = file_name;
+         info->indextable[i].function_name = NULL;
+