On 01/08/13 09:43, Chen Gang wrote:
On 08/01/2013 04:12 PM, Stefan Kristiansson wrote:
On Thu, Aug 1, 2013 at 10:21 AM, Jonas Bonn <[email protected]> wrote:
Hi Gang,

(Taking this off the Linux mailing list as it's an OpenRISC issue)

Hi Toolchain-people!

Don't we define __linux__ for the or32-*-linux-* target?  If not, shouldn't
we?

/Jonas

Mine does:

$ or32-linux-gcc -dM -E ~/empty.c -o -|grep __linux__
#define __linux__ 1

$ or32-linux-gcc -v
Using built-in specs.
COLLECT_GCC=or32-linux-gcc
COLLECT_LTO_WRAPPER=/home/stefan/openrisc/toolchain-or32-20120619/bin/../libexec/gcc/or32-linux/4.5.1-or32-1.0rc4/lto-wrapper
Target: or32-linux
Configured with: ../gcc-svn/configure --target=or32-linux
--prefix=/home/stefan/openrisc/toolchain --disable-libssp
--srcdir=../gcc-svn --enable-languages=c --enable-threads=posix
--disable-libgomp --disable-libmudflap
--with-sysroot=/home/stefan/openrisc/toolchain/or32-linux/sys-root
Thread model: posix
gcc version 4.5.1-or32-1.0rc4 (GCC)


Hmm... does it mean the cross compiler which I built is incorrect ?

I reference : http://openrisc.net/toolchain-build.html, I only build
stage 1 gcc (I guess it is enough for kernel), and also use my own
configuration:

   "../gcc-openrisc/configure --target=or32-linux --disable-nls --enable-languages=c 
--without-headers --disable-shared --disable-threads --enable-werror=no"

It will build "gcc version 4.5.1-or32-1.0rc1 (GCC)", (not Orc4).

Hi Chen,

If you build the stage1 library, you won't be incorporating the uClibc libraries and headers, including all the uClibc C startup code. So it is very likely that anything uClibc specific, like defining __linux__ will not be there. You must build the full stage2 compiler.

You might prefer to use the Wiki instructions and bld-all.sh script:

  http://opencores.org/or1k/OpenRISC_GNU_tool_chain#Building

which will cleanly build you a full uClibc compiler.

HTH,


Jeremy


(BTW could you please provide the related information for Orc4 ?).


FWIW, so does also or1k-linux-uclibc-gcc
$ or1k-linux-uclibc-gcc -dM -E ~/empty.c -o -|grep __linux__
#define __linux__ 1

That said, does it hurt to add the define to the kernel?
(I have in mind the fact that we currently can't build the kernel with the
or1k-linux-*- toolchain, but have to use or1k-elf-, which for obvious reasons
doesn't define __linux__)


Hmm... for the latest gcc for Linux, it should define __linux__
automatically.

So if some of old versions of gcc which do not define __linux__ and
still need be maintained, they need get a patch to let them add
__linux__ automatically.


Thanks.

On 07/31/2013 05:34 AM, Chen Gang wrote:

Need append "_D__linux__" to KBUILD_CFLAGS, just like some of another
architectures have done, or 'allmodconfig' can not pass compiling.

The related error:

      CC [M]  fs/coda/psdev.o
    In file included from include/linux/coda.h:65:0,
                     from fs/coda/psdev.c:45:
    include/uapi/linux/coda.h:221:2: error: expected
specifier-qualifier-list before 'u_quad_t'

The related compiler information:

    [root@dhcp122 ~]# /usr/local/bin/or32-linux-gcc -v
    Using built-in specs.
    COLLECT_GCC=/usr/local/bin/or32-linux-gcc

COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/or32-linux/4.5.1-or32-1.0rc1/lto-wrapper
    Target: or32-linux
    Configured with: ../gcc-openrisc/configure --target=or32-linux
--disable-nls --enable-languages=c --without-headers --disable-shared
--disable-threads --enable-werror=no
    Thread model: single
    gcc version 4.5.1-or32-1.0rc1 (GCC)


Signed-off-by: Chen Gang <[email protected]>
---
   arch/openrisc/Makefile |    2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
index 4739b83..89076a6 100644
--- a/arch/openrisc/Makefile
+++ b/arch/openrisc/Makefile
@@ -24,7 +24,7 @@ OBJCOPYFLAGS    := -O binary -R .note -R .comment -S
   LDFLAGS_vmlinux :=
   LIBGCC                := $(shell $(CC) $(KBUILD_CFLAGS)
-print-libgcc-file-name)

-KBUILD_CFLAGS  += -pipe -ffixed-r10
+KBUILD_CFLAGS  += -pipe -ffixed-r10 -D__linux__

   ifeq ($(CONFIG_OPENRISC_HAVE_INST_MUL),y)
         KBUILD_CFLAGS += $(call cc-option,-mhard-mul)


_______________________________________________
OpenRISC mailing list
[email protected]
http://lists.openrisc.net/listinfo/openrisc



Thanks.



--
Tel:      +44 (1590) 610184
Cell:     +44 (7970) 676050
SkypeID: jeremybennett
Twitter: @jeremypbennett
Email:   [email protected]
Web:     www.embecosm.com
_______________________________________________
OpenRISC mailing list
[email protected]
http://lists.openrisc.net/listinfo/openrisc

Reply via email to