modpost: Fix address calculation in reloc_location()
[cascardo/linux.git] / scripts / mod / modpost.c
index 1ec7158..97d2259 100644 (file)
@@ -790,6 +790,7 @@ static const char *section_white_list[] =
 {
        ".comment*",
        ".debug*",
+       ".zdebug*",             /* Compressed debug sections. */
        ".GCC-command-line",    /* mn10300 */
        ".mdebug*",        /* alpha, score, mips etc. */
        ".pdr",            /* alpha, score, mips etc. */
@@ -1208,6 +1209,9 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
  * .cpuinit.data => __cpudata
  * .memexitconst => __memconst
  * etc.
+ *
+ * The memory of returned value has been allocated on a heap. The user of this
+ * method should free it after usage.
 */
 static char *sec2annotation(const char *s)
 {
@@ -1230,7 +1234,7 @@ static char *sec2annotation(const char *s)
                        strcat(p, "data ");
                else
                        strcat(p, " ");
-               return r; /* we leak her but we do not care */
+               return r;
        } else {
                return strdup("");
        }
@@ -1438,7 +1442,7 @@ static unsigned int *reloc_location(struct elf_info *elf,
        int section = shndx2secindex(sechdr->sh_info);
 
        return (void *)elf->hdr + sechdrs[section].sh_offset +
-               r->r_offset - sechdrs[section].sh_addr;
+               r->r_offset;
 }
 
 static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)