Skip to contentSkip to conversation

Crosscompiler broken ?

DISCUSSION Dag Nygren 2 participants 3 messages Sep 27, 2000 – Sep 28, 2000

lore
Share & tools
lore

Dag Nygren

author
#0 lore raw

Hi again,

tracing down a severe probem I am seeing when
porting Linux to a PPC-board.

The compilation of the kernel is done with a crosscompiler on an Intel x86 system and strange things are happening:

This is the part of the code from fs/dcache.c:

==================== Code =============

    do {
        unsigned long tmp;

        nr_hash = (1UL << order) * PAGE_SIZE /
            sizeof(struct list_head);
        d_hash_mask = (nr_hash - 1);

        tmp = nr_hash;
        d_hash_shift = 0;
        while ((tmp >>= 1UL) != 0UL)
            d_hash_shift++;

        dentry_hashtable = (struct list_head *)
            __get_free_pages(GFP_ATOMIC, order);
printk("dentry_hashtable(0.5)(addr = 0x%lx) = 0x%lx\n", &dentry_hashtable,
dentry_hashtable);   /* DEB
UG */
    } while (dentry_hashtable == NULL && --order >= 0);

printk("dentry_hashtable(0.7)(addr = 0x%lx) = 0x%lx\n", &dentry_hashtable,
dentry_hashtable); /* DEB
UG */

==================== Code end =============

here is the output:

__get_free_pages(): page = 0xC024A000, page_address = 0xC0240000 &dentry_hashtable = 0xc01cf0d4, stack = 0xc018af68 __get_free_pages(): page = 0xC0274000, page_address = 0xC0CC0000 dentry_hashtable(0.5)(addr = 0xc01cf0d4) = 0xc0cc0000 dentry_hashtable(0.7)(addr = 0xc01cf0d4) = 0x5

The last line is really strange, who the %&¤&%¤/ is messing around with the contents of dentry_hashtable ?

Compiler bug ?

--
Dag Nygren email: [email protected]
Oy NewTech Ab phone: +358 9 8024910
Trasktorpet 3 fax: +358 9 8024916
02360 ESBO GSM: 0400-426312
FINLAND

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 2 lines · Dag Nygren

The compilation of the kernel is done with a crosscompiler on an Intel x86 system and strange things are happening:

What version of the compiler and kernel are you using?

Quoted 2 lines

printk("dentry_hashtable(0.5)(addr = 0x%lx) = 0x%lx\n", &dentry_hashtable,
dentry_hashtable); /* DEBUG */

I couldn't reproduce this problem. However, you might want to get into the habit of using the correct format specifiers. It doesn't make a difference in this instance, but it will trip you up eventually. Use %p to print pointers, not %lx.

Regards,
Graham
--
Graham Stoney
Principal Hardware/Software Engineer
Canon Information Systems Research Australia
Ph: +61 2 9805 2909 Fax: +61 2 9805 2929

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

author
#2 lore raw
Quoted 6 lines
Quoted 2 lines · Dag Nygren

The compilation of the kernel is done with a crosscompiler on an Intel x86 system and strange things are happening:

What version of the compiler and kernel are you using?

Sorry, should of course have included that:
Compiler: 2.95.1
Kernel: 2.2.15

Quoted 8 lines
Quoted 3 lines

printk("dentry_hashtable(0.5)(addr = 0x%lx) = 0x%lx\n", &dentry_hashtable,
dentry_hashtable); /* DEBUG */

I couldn't reproduce this problem. However, you might want to get into the habit of using the correct format specifiers. It doesn't make a difference in this instance, but it will trip you up eventually. Use %p to print pointers, not %lx.

Yep, changed that later on and it really makes no difference. The %lx comes from a time when I learned C-programming, at that point there were no %p in printf() etc.

Also upgraded to 2.95.2. No change.

BRGDS

--
Dag Nygren email: [email protected]
Oy NewTech Ab phone: +358 9 8024910
Trasktorpet 3 fax: +358 9 8024916
02360 ESBO GSM: 0400-426312
FINLAND

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/