* Re: linux kernel building for mips malta target board [not found] <E1EXLJV-0005R4-K3@real.realitydiluted.com> @ 2005-11-03 0:45 ` David Daney 2005-11-03 1:02 ` Stuart Anderson 0 siblings, 1 reply; 8+ messages in thread From: David Daney @ 2005-11-03 0:45 UTC (permalink / raw) To: sjhill; +Cc: crossgcc, MIPS Linux List sjhill@realitydiluted.com wrote: >>>I would like to build latest kernel (ie kernel 2.6.13) for mips malta >>>board. Can any one advise me the cross-compiler tools version to be >>>used for building the linux kernel. >>> >> >>I use both gcc-3.3.1 and gcc-3.4.3 to build 2.6.x mips linux kernels. I >>think for the 2.6.13 kernel any of the latest released versions of >>3.3.x, 3.4.x, or 4.0.x would work. Use the latest binutils (2.16.91 >>20050817 is what I am using). >> > > Also, make sure to NOT use any of the 4.1 GCC stuff with Linux/MIPS > kernels. I am still tracking down errors with it. > Is this the problem you are seeing?: In file included from include/linux/nfs_fs.h:15, from init/do_mounts.c:12: include/linux/pagemap.h: In function ‘fault_in_pages_readable’: include/linux/pagemap.h:236: error: read-only variable ‘__gu_val’ used as ‘asm’ output include/linux/pagemap.h:236: error: read-only variable ‘__gu_val’ used as ‘asm’ output include/linux/pagemap.h:236: error: read-only variable ‘__gu_val’ used as ‘asm’ output include/linux/pagemap.h:236: error: read-only variable ‘__gu_val’ used as ‘asm’ output The compiler behavior has changed since 4.0.1, but I think the new behavior is correct. I am blaming the __get_user macro in include/asm-mips/uaccess.h. It should be possible to fix it there. The alternative is to hack up include/linux/pagemap.h. David Daney ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: linux kernel building for mips malta target board 2005-11-03 0:45 ` linux kernel building for mips malta target board David Daney @ 2005-11-03 1:02 ` Stuart Anderson 2005-11-03 1:19 ` David Daney 0 siblings, 1 reply; 8+ messages in thread From: Stuart Anderson @ 2005-11-03 1:02 UTC (permalink / raw) To: crossgcc; +Cc: MIPS Linux List On Wed, 2 Nov 2005, David Daney wrote: > Is this the problem you are seeing?: > In file included from include/linux/nfs_fs.h:15, > from init/do_mounts.c:12: > include/linux/pagemap.h: In function \x18fault_in_pages_readable\x19: > include/linux/pagemap.h:236: error: read-only variable \x18__gu_val\x19 used as > \x18asm\x19 output > include/linux/pagemap.h:236: error: read-only variable \x18__gu_val\x19 used as > \x18asm\x19 output > include/linux/pagemap.h:236: error: read-only variable \x18__gu_val\x19 used as > \x18asm\x19 output > include/linux/pagemap.h:236: error: read-only variable \x18__gu_val\x19 used as > \x18asm\x19 output > > The compiler behavior has changed since 4.0.1, but I think the new behavior > is correct. I am blaming the __get_user macro in include/asm-mips/uaccess.h. > It should be possible to fix it there. The alternative is to hack up > include/linux/pagemap.h. __get_user() is unhappy, with tpyes that are "const". It uses __typeof() to create a local variable that it wants to write to. I've intended to have offer up a patch by now, but, too manyunexpected thing have happened in the firs thalf of this week. Stuart Stuart R. Anderson anderson@netsweng.com Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: linux kernel building for mips malta target board 2005-11-03 1:02 ` Stuart Anderson @ 2005-11-03 1:19 ` David Daney 2005-11-03 2:20 ` Stuart Anderson 0 siblings, 1 reply; 8+ messages in thread From: David Daney @ 2005-11-03 1:19 UTC (permalink / raw) To: Stuart Anderson; +Cc: crossgcc, MIPS Linux List Stuart Anderson wrote: > On Wed, 2 Nov 2005, David Daney wrote: > >> Is this the problem you are seeing?: >> In file included from include/linux/nfs_fs.h:15, >> from init/do_mounts.c:12: >> include/linux/pagemap.h: In function \x18fault_in_pages_readable\x19: >> include/linux/pagemap.h:236: error: read-only variable \x18__gu_val\x19 >> used as \x18asm\x19 output >> include/linux/pagemap.h:236: error: read-only variable \x18__gu_val\x19 >> used as \x18asm\x19 output >> include/linux/pagemap.h:236: error: read-only variable \x18__gu_val\x19 >> used as \x18asm\x19 output >> include/linux/pagemap.h:236: error: read-only variable \x18__gu_val\x19 >> used as \x18asm\x19 output >> >> The compiler behavior has changed since 4.0.1, but I think the new >> behavior is correct. I am blaming the __get_user macro in >> include/asm-mips/uaccess.h. It should be possible to fix it there. >> The alternative is to hack up include/linux/pagemap.h. > > > __get_user() is unhappy, with tpyes that are "const". It uses __typeof() > to create a local variable that it wants to write to. I've intended to > have offer up a patch by now, but, too manyunexpected thing have > happened in the firs thalf of this week. > That is my analysis as well. The typeof converts the const char * into a const char which is then unsuitable as the destination in an inline asm. David Daney ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: linux kernel building for mips malta target board 2005-11-03 1:19 ` David Daney @ 2005-11-03 2:20 ` Stuart Anderson 2005-11-03 16:33 ` Ralf Baechle 0 siblings, 1 reply; 8+ messages in thread From: Stuart Anderson @ 2005-11-03 2:20 UTC (permalink / raw) To: David Daney; +Cc: crossgcc, MIPS Linux List [-- Attachment #1: Type: TEXT/PLAIN, Size: 1109 bytes --] On Wed, 2 Nov 2005, David Daney wrote: >> __get_user() is unhappy, with tpyes that are "const". It uses __typeof() >> to create a local variable that it wants to write to. I've intended to >> have offer up a patch by now, but, too many unexpected thing have happened >> in the firs thalf of this week. I shamed myself into sitting down and doing this. 8-) The attached patch seems to work, or at least doesn't seem to cause things to blow up. An o32 userspace on a 64-bit kernel comes up multi-user and can build a kernel, and run a quick subset of LTP. There was a comment on IRC that there was a register allocation issue which lead to the current code. I'm not sure of the exact details, but I _think_ this change ends up being equivilent to the code it replaces. Stuart Stuart R. Anderson anderson@netsweng.com Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149 [-- Attachment #2: uaccess.h.patch --] [-- Type: TEXT/PLAIN, Size: 1354 bytes --] Index: uaccess.h =================================================================== --- uaccess.h (revision 84) +++ uaccess.h (working copy) @@ -210,17 +210,35 @@ #define __get_user_nocheck(x,ptr,size) \ ({ \ - __typeof(*(ptr)) __gu_val = (__typeof(*(ptr))) 0; \ long __gu_err = 0; \ \ switch (size) { \ - case 1: __get_user_asm("lb", ptr); break; \ - case 2: __get_user_asm("lh", ptr); break; \ - case 4: __get_user_asm("lw", ptr); break; \ - case 8: __GET_USER_DW(ptr); break; \ + case 1: { \ + s8 __gu_val = (s8) 0; \ + __get_user_asm("lb", ptr); \ + (x) = (__typeof__(*(ptr))) __gu_val; \ + break; \ + } \ + case 2: { \ + s16 __gu_val = (s16) 0; \ + __get_user_asm("lh", ptr); \ + (x) = (__typeof__(*(ptr))) __gu_val; \ + break; \ + } \ + case 4: { \ + s32 __gu_val = (s32) 0; \ + __get_user_asm("lw", ptr); \ + (x) = (__typeof__(*(ptr))) __gu_val; \ + break; \ + } \ + case 8: { \ + s64 __gu_val = (s64) 0; \ + __GET_USER_DW(ptr); \ + (x) = (__typeof__(*(ptr))) __gu_val; \ + break; \ + } \ default: __get_user_unknown(); break; \ } \ - (x) = (__typeof__(*(ptr))) __gu_val; \ __gu_err; \ }) ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: linux kernel building for mips malta target board 2005-11-03 2:20 ` Stuart Anderson @ 2005-11-03 16:33 ` Ralf Baechle 2006-01-18 12:52 ` Martin Michlmayr 0 siblings, 1 reply; 8+ messages in thread From: Ralf Baechle @ 2005-11-03 16:33 UTC (permalink / raw) To: Stuart Anderson; +Cc: David Daney, crossgcc, MIPS Linux List > I shamed myself into sitting down and doing this. 8-) > > The attached patch seems to work, or at least doesn't seem to cause > things to blow up. An o32 userspace on a 64-bit kernel comes up > multi-user and can build a kernel, and run a quick subset of LTP. > > There was a comment on IRC that there was a register allocation issue which > lead to the current code. I'm not sure of the exact details, but I _think_ > this change ends up being equivilent to the code it replaces. It's correct - but triggers plenty of extra warnings and you forgot about get_user() which has the same kind of issue. Also you don't have the guarantee that <linux/types.h> has been included, so in order to avoid a yet another header file dependency I changed s8, s16 etc. to char, short, int, long long. Working on it but as usual uaccess.h is quite a quiz. Ralf ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: linux kernel building for mips malta target board 2005-11-03 16:33 ` Ralf Baechle @ 2006-01-18 12:52 ` Martin Michlmayr 2006-01-18 13:05 ` Ralf Baechle 0 siblings, 1 reply; 8+ messages in thread From: Martin Michlmayr @ 2006-01-18 12:52 UTC (permalink / raw) To: MIPS Linux List; +Cc: Stuart Anderson * Ralf Baechle <ralf@linux-mips.org> [2005-11-03 16:33]: > > There was a comment on IRC that there was a register allocation issue which > > lead to the current code. I'm not sure of the exact details, but I _think_ > > this change ends up being equivilent to the code it replaces. > > It's correct - but triggers plenty of extra warnings and you forgot about > get_user() which has the same kind of issue. Also you don't have the > guarantee that <linux/types.h> has been included, so in order to avoid a > yet another header file dependency I changed s8, s16 etc. to char, short, > int, long long. Working on it but as usual uaccess.h is quite a quiz. What's the status of this? With current linux-mips git I still get the problem. As a reminder, the error is: CC fs/compat_ioctl.o fs/compat_ioctl.c: In function 'fd_ioctl_trans': fs/compat_ioctl.c:1831: error: read-only variable '__gu_val' used as 'asm' output fs/compat_ioctl.c:1831: error: read-only variable '__gu_val' used as 'asm' output fs/compat_ioctl.c:1831: error: read-only variable '__gu_val' used as 'asm' output fs/compat_ioctl.c:1831: error: read-only variable '__gu_val' used as 'asm' output make[1]: *** [fs/compat_ioctl.o] Error 1 -- Martin Michlmayr http://www.cyrius.com/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: linux kernel building for mips malta target board 2006-01-18 12:52 ` Martin Michlmayr @ 2006-01-18 13:05 ` Ralf Baechle 2006-01-18 13:37 ` Martin Michlmayr 0 siblings, 1 reply; 8+ messages in thread From: Ralf Baechle @ 2006-01-18 13:05 UTC (permalink / raw) To: Martin Michlmayr; +Cc: MIPS Linux List, Stuart Anderson On Wed, Jan 18, 2006 at 12:52:03PM +0000, Martin Michlmayr wrote: > * Ralf Baechle <ralf@linux-mips.org> [2005-11-03 16:33]: > > > There was a comment on IRC that there was a register allocation issue which > > > lead to the current code. I'm not sure of the exact details, but I _think_ > > > this change ends up being equivilent to the code it replaces. > > > > It's correct - but triggers plenty of extra warnings and you forgot about > > get_user() which has the same kind of issue. Also you don't have the > > guarantee that <linux/types.h> has been included, so in order to avoid a > > yet another header file dependency I changed s8, s16 etc. to char, short, > > int, long long. Working on it but as usual uaccess.h is quite a quiz. > > What's the status of this? > > With current linux-mips git I still get the problem. As a reminder, > the error is: > > CC fs/compat_ioctl.o > fs/compat_ioctl.c: In function 'fd_ioctl_trans': > fs/compat_ioctl.c:1831: error: read-only variable '__gu_val' used as 'asm' output > fs/compat_ioctl.c:1831: error: read-only variable '__gu_val' used as 'asm' output > fs/compat_ioctl.c:1831: error: read-only variable '__gu_val' used as 'asm' output > fs/compat_ioctl.c:1831: error: read-only variable '__gu_val' used as 'asm' output > make[1]: *** [fs/compat_ioctl.o] Error 1 I have not been able to find some construct that keeps gcc happy and at the same time doesn't result in significantly worse code. That matters because get_user / put_user are used very often throughout the kernel. Ralf ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: linux kernel building for mips malta target board 2006-01-18 13:05 ` Ralf Baechle @ 2006-01-18 13:37 ` Martin Michlmayr 0 siblings, 0 replies; 8+ messages in thread From: Martin Michlmayr @ 2006-01-18 13:37 UTC (permalink / raw) To: MIPS Linux List, Stuart Anderson, David Daney * Ralf Baechle <ralf@linux-mips.org> [2006-01-18 13:05]: > > With current linux-mips git I still get the problem. As a reminder, > > the error is: > > > > CC fs/compat_ioctl.o > > fs/compat_ioctl.c: In function 'fd_ioctl_trans': > > fs/compat_ioctl.c:1831: error: read-only variable '__gu_val' used as 'asm' output > I have not been able to find some construct that keeps gcc happy and at the > same time doesn't result in significantly worse code. That matters because > get_user / put_user are used very often throughout the kernel. Who could help with that? Maciej? David Daney? (See the original discussion and the proposed patch at http://www.spinics.net/lists/mips/msg20671.html) -- Martin Michlmayr http://www.cyrius.com/ ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-01-18 13:35 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <E1EXLJV-0005R4-K3@real.realitydiluted.com>
2005-11-03 0:45 ` linux kernel building for mips malta target board David Daney
2005-11-03 1:02 ` Stuart Anderson
2005-11-03 1:19 ` David Daney
2005-11-03 2:20 ` Stuart Anderson
2005-11-03 16:33 ` Ralf Baechle
2006-01-18 12:52 ` Martin Michlmayr
2006-01-18 13:05 ` Ralf Baechle
2006-01-18 13:37 ` Martin Michlmayr
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox