Skip to contentSkip to conversation

question about 'r2' !!!

DISCUSSION Rolf Liu 6 participants 8 messages Sep 6, 2000 – Sep 7, 2000

lore
Share & tools
lore

Rolf Liu

author
#0 lore raw

Hi, all,
As everyone konws, Linux use register 'r2' as a reference of 'current',which is realized by
GCC. Also, the exeception handling of Linux do some work about 'r2'.

I am currently engaged in compiling Linux-ppc source tree using a CC other than GCC.
The CC can only produce the executable format of 'EABI', a convention made by Motorola.
And 'EABI' use 'r2' as a base address register for reference of const data, which can't
be changed. So I want to use a general global varialbe as 'current', leaving 'r2' to 'EABI'.

Anyone has some experence in such issue?
what consideration I must take?
I am pleased to get any comments from you .
Thanks a lot

Rolf

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

#1 lore raw
Quoted 2 lines · Rolf Liu

I am currently engaged in compiling Linux-ppc source tree using a CC other than GCC.

May I ask you _why_ you want to do that?!?

I think the same rule applies to compilers as to makefiles (`Don't write portable Makefiles, use a portable make').

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

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

#2 lore raw
Quoted 5 lines
Quoted 3 lines

I am currently engaged in compiling Linux-ppc source tree using a CC other than GCC.

May I ask you _why_ you want to do that?!?

The mind fairly boggles. Anyway, once upon a time, current wasn't kept in a register but in memory. And if r2 won't do, just pick another register and tell the compiler not to touch it. Hope your compiler of choice has such a thing as --fixed-r2 ...

Michael

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

#3 lore raw
Quoted 4 lines · Michael Schmitz
Quoted 4 lines
Quoted 3 lines

I am currently engaged in compiling Linux-ppc source tree using a CC other than GCC.

Quoted 9 lines
Quoted 1 line

May I ask you _why_ you want to do that?!?

The mind fairly boggles. Anyway, once upon a time, current wasn't kept in a register but in memory. And if r2 won't do, just pick another register and tell the compiler not to touch it. Hope your compiler of choice has such a thing as --fixed-r2 ...

Michael

And if you want to use kgdb to debug your kernel, gdb knows that current is r2...

-Frank
--
Frank Rowand <[email protected]>
MontaVista Software, Inc

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

#4 lore raw
Quoted 8 lines
Quoted 6 lines

The mind fairly boggles. Anyway, once upon a time, current wasn't kept in a register but in memory. And if r2 won't do, just pick another register and tell the compiler not to touch it. Hope your compiler of choice has such a thing as --fixed-r2 ...

And if you want to use kgdb to debug your kernel, gdb knows that current is r2...

If you're unable to use gcc for building your kernels, chances are there won't be a gdb around either. I fully expect to see yet another kernel debugger option in the kernel if that sort of 'build a Linux kernel using the compiler of your choice' game does catch on. If you can get the kernel to build without relying on gcc, adding a new remote debug stub should not pose a major problem.

For the rest of us, let's stick to gcc and friends.

Michael

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

#5 lore raw
Quoted 1 line · Michael Schmitz

If you're unable to use gcc for building your kernels, ....

With the gcc/gas specific syntax, and the reliance on gcc inline assembler, there is lots of work to do to make something else compile this software in any case.

Then, all you have done is the easy part, which is getting a kernel to boot. What about applications, libraries and other tools that actually make a system do something?

	-- Dan

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

#7 lore raw
In reply to Rolf Liu
Quoted 2 lines · Rolf Liu

I am currently engaged in compiling Linux-ppc source tree using a CC other than GCC.

This is going to be fraught with difficulty. The Linux kernel source uses quite a lot of the extensions to the C language which gcc provides. Basically the kernel is not designed to be compiled by anything other than gcc.

--
Paul Mackerras, Senior Open Source Researcher, Linuxcare, Inc. +61 2 6262 8990 tel, +61 2 6262 8991 fax [email protected], http://www.linuxcare.com.au/
Linuxcare. Support for the revolution.

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

#6 lore raw
In reply to Dan Malek
Quoted 6 lines
Quoted 2 lines

If you're unable to use gcc for building your kernels, ....

With the gcc/gas specific syntax, and the reliance on gcc inline assembler, there is lots of work to do to make something else compile this software in any case.

I know. He's been advised to forget compiling the kernel with that other compiler numerous times on this list. He happily seems to ignore that advice and try it anyway, so who am I to dissuade someone from a great learning experience?

Quoted 3 lines

Then, all you have done is the easy part, which is getting a kernel to boot. What about applications, libraries and other tools that actually make a system do something?

I'd assume that you can just use any old distribution (unless you broke binary compatibility).

Michael

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