Commit e0f39591cc178026607fcbbe9a53be435fe8285d

Authored by Alan Stern
Committed by Linus Torvalds
1 parent 5cd9194a1b

[PATCH] Workaround for gcc 2.96 (undefined references)

LD      .tmp_vmlinux1
mm/built-in.o(.text+0x100d6): In function `copy_page_range':
: undefined reference to `__pud_alloc'
mm/built-in.o(.text+0x1010b): In function `copy_page_range':
: undefined reference to `__pmd_alloc'
mm/built-in.o(.text+0x11ef4): In function `__handle_mm_fault':
: undefined reference to `__pud_alloc'
fs/built-in.o(.text+0xc930): In function `install_arg_page':
: undefined reference to `__pud_alloc'
make: *** [.tmp_vmlinux1] Error 1

Those missing references in mm/memory.c arise from this code in
include/linux/mm.h, combined with the fact that __PGTABLE_PMD_FOLDED and
__PGTABLE_PUD_FOLDED are both set and __ARCH_HAS_4LEVEL_HACK is not:

/*
 * The following ifdef needed to get the 4level-fixup.h header to work.
 * Remove it when 4level-fixup.h has been removed.
 */
#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
{
        return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address))?
                NULL: pud_offset(pgd, address);
}

static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
{
        return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))?
                NULL: pmd_offset(pud, address);
}
#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */

With my configuration the pgd_none and pud_none routines are inlines
returning a constant 0.  Apparently the old compiler avoids generating
calls to __pud_alloc and __pmd_alloc but still lists them as undefined
references in the module's symbol table.

I don't know which change caused this problem.  I think it was added
somewhere between 2.6.14 and 2.6.15-rc1, because I remember building
several 2.6.14-rc kernels without difficulty.  However I can't point to an
individual culprit.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 12 additions and 0 deletions Side-by-side Diff

... ... @@ -2160,6 +2160,12 @@
2160 2160 spin_unlock(&mm->page_table_lock);
2161 2161 return 0;
2162 2162 }
  2163 +#else
  2164 +/* Workaround for gcc 2.96 */
  2165 +int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
  2166 +{
  2167 + return 0;
  2168 +}
2163 2169 #endif /* __PAGETABLE_PUD_FOLDED */
2164 2170  
2165 2171 #ifndef __PAGETABLE_PMD_FOLDED
... ... @@ -2186,6 +2192,12 @@
2186 2192 pgd_populate(mm, pud, new);
2187 2193 #endif /* __ARCH_HAS_4LEVEL_HACK */
2188 2194 spin_unlock(&mm->page_table_lock);
  2195 + return 0;
  2196 +}
  2197 +#else
  2198 +/* Workaround for gcc 2.96 */
  2199 +int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
  2200 +{
2189 2201 return 0;
2190 2202 }
2191 2203 #endif /* __PAGETABLE_PMD_FOLDED */