lkml.org 
[lkml]   [1999]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectMixing egcs and gcc-2.7.2.3 compiled code: struct alignment issues?
Okay, this one had me scratching my head for a good hour. I've got this
function:

#define NTFS_I(i) ((struct ntfs2_inode_info *)((i)->u.generic_ip))

clear_inode (struct inode *i)
{
struct list_head *entry;

entry = NTFS_I(i)->i_attr_list.next;
while (entry != &NTFS_I(i)->i_attr_list) {
struct list_head *tmp = entry;
entry = entry->next;
printk(KERN_DEBUG "freeing attr %p from inode %p (%lu)\n",
list_entry(tmp, struct ntfs2_attr, a_list),
i, i->i_ino);
ntfs_free_attr(list_entry(tmp, struct ntfs2_attr, a_list));
}
printk(KERN_DEBUG "kfree()ing inode %p (%lu)\n",
i, i->i_ino);
kfree(NTFS_I(i));
}

gcc-2.7.2.3 and egcs compiled it differently:

gcc-2.7: egcs-1.1.2:

ntfs_clear_inode: ntfs_clear_inode:
pushl %edi pushl %edi
pushl %esi %pushl esi
pushl %ebx pushl %ebx
movl 16(%esp),%edi movl 16(%esp),%edi
movl 176(%edi),%eax << >> movl 188(%edi),%eax
movl (%eax),%esi movl (%eax),%esi
cmpl %eax,%esi cmpl %eax,%esi
je .L897 je .L1668

The differing line is obviously the equivalent of the NTFS_I macro.
Now, my kernel was compiled with 2.7.2.3, and the module compiled with
2.7.2.3 works. The one compiled with egcs doesn't.

Does this mean that the compilers are padding struct inode *differently*,
resulting in u.generic_ip being at different offsets? That's a nightmare :(

--
"His mind is like a steel trap -- full of mice"

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:4.630 / U:1.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site