Friday, May 21, 2010

FEATURES installsources not working on MIPS?

Update 2010-07-09: the patch received upstream attention. The maintainer said it's better to send to rpm-devel@rpm5.org directly.
Update: just reported to upstream http://rpm5.org/cvs/tktview?tn=61

I resumed my quest to xulrunner linking problem on Loongson: http://old.nabble.com/R_MIPS_TLS_GD-reloc-overflow-when-linking-%3E%3Dxulrunner-1.9.1.5-td26755056.html

But I found that "installsources" FEATURE is not working on Loongson. I investigated it and found that it is because debug.sources file produced by debugedit is empty.

Then I found that in turn was because debug related sections in MIPS elf file is not of type SHT_PROGBITS, but SHT_MIPS_DWARF.

[32] .debug_aranges MIPS_DWARF 00000000 0845c4 0002c0 00 0 0 1
[33] .debug_pubnames MIPS_DWARF 00000000 084884 001a2a 00 0 0 1
[34] .debug_info MIPS_DWARF 00000000 0862ae 015221 00 0 0 1
[35] .debug_abbrev MIPS_DWARF 00000000 09b4cf 002c9a 00 0 0 1
[36] .debug_line MIPS_DWARF 00000000 09e169 009ce3 00 0 0 1
[37] .debug_str MIPS_DWARF 00000000 0a7e4c 0049d7 01 MS 0 0 1
[38] .debug_loc MIPS_DWARF 00000000 0ac823 004c7d 00 0 0 1
[39] .debug_macinfo MIPS_DWARF 00000000 0b14a0 1cf9d6 00 0 0 1
[40] .debug_ranges MIPS_DWARF 00000000 280e76 0001d8 00 0 0 1
So the fix is very easy and straight forward.

--- debugedit.c.orig 2010-05-21 16:26:13.000000000 +0800
+++ debugedit.c 2010-05-21 01:44:08.000000000 +0800
@@ -1596,6 +1596,7 @@
switch (dso->shdr[i].sh_type)
{
case SHT_PROGBITS:
+ case SHT_MIPS_DWARF:
name = strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[i].sh_name);
/* TODO: Handle stabs */
#if 0