2015-04-03 20:19:49

by Chen Gang

[permalink] [raw]
Subject: [PATCH] blackfin: Makefile: Add -D__linux__ flag for KBUILD_CFLAGS

The related error with allmodconfig:

CC [M] fs/coda/psdev.o
In file included from include/linux/coda.h:64:0,
from fs/coda/psdev.c:45:
include/uapi/linux/coda.h:221:2: error: unknown type name 'u_quad_t'
u_quad_t va_size; /* file size in bytes */
^
include/uapi/linux/coda.h:229:2: error: unknown type name 'u_quad_t'
u_quad_t va_bytes; /* bytes of disk space held by file */
^
include/uapi/linux/coda.h:230:2: error: unknown type name 'u_quad_t'
u_quad_t va_filerev; /* file modification number */
^

Signed-off-by: Chen Gang <[email protected]>
---
arch/blackfin/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 1fce086..2ece4e3 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -13,7 +13,7 @@ LDFLAGS_vmlinux := -X
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
GZFLAGS := -9

-KBUILD_CFLAGS += $(call cc-option,-mno-fdpic)
+KBUILD_CFLAGS += $(call cc-option,-mno-fdpic) -D__linux__
ifeq ($(CONFIG_ROMKERNEL),y)
KBUILD_CFLAGS += -mlong-calls
endif
--
1.9.3


2015-04-03 22:56:06

by Richard Weinberger

[permalink] [raw]
Subject: Re: [PATCH] blackfin: Makefile: Add -D__linux__ flag for KBUILD_CFLAGS

On Fri, Apr 3, 2015 at 10:19 PM, Chen Gang <[email protected]> wrote:
> The related error with allmodconfig:

BTW: How do you generate this allmodconfig?
"make allmodconfig ARCH=blackfin" cannot work as you need to specify a board...

> CC [M] fs/coda/psdev.o
> In file included from include/linux/coda.h:64:0,
> from fs/coda/psdev.c:45:
> include/uapi/linux/coda.h:221:2: error: unknown type name 'u_quad_t'
> u_quad_t va_size; /* file size in bytes */
> ^
> include/uapi/linux/coda.h:229:2: error: unknown type name 'u_quad_t'
> u_quad_t va_bytes; /* bytes of disk space held by file */
> ^
> include/uapi/linux/coda.h:230:2: error: unknown type name 'u_quad_t'
> u_quad_t va_filerev; /* file modification number */
> ^
>
> Signed-off-by: Chen Gang <[email protected]>
> ---
> arch/blackfin/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
> index 1fce086..2ece4e3 100644
> --- a/arch/blackfin/Makefile
> +++ b/arch/blackfin/Makefile
> @@ -13,7 +13,7 @@ LDFLAGS_vmlinux := -X
> OBJCOPYFLAGS := -O binary -R .note -R .comment -S
> GZFLAGS := -9
>
> -KBUILD_CFLAGS += $(call cc-option,-mno-fdpic)
> +KBUILD_CFLAGS += $(call cc-option,-mno-fdpic) -D__linux__

Hmm, what compiler are you using?
It's odd that __linux__ is not defined...

--
Thanks,
//richard

2015-04-04 21:13:43

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] blackfin: Makefile: Add -D__linux__ flag for KBUILD_CFLAGS

On 4/4/15 06:56, Richard Weinberger wrote:
> On Fri, Apr 3, 2015 at 10:19 PM, Chen Gang <[email protected]> wrote:
>> The related error with allmodconfig:
>
> BTW: How do you generate this allmodconfig?
> "make allmodconfig ARCH=blackfin" cannot work as you need to specify a board...
>
[...]
> Hmm, what compiler are you using?
> It's odd that __linux__ is not defined...
>

I built the raw cross compiler from the latest gcc/binutils's upsteam
code:

- binutils:

../binutils-gdb/configure --prefix=/upstream/release-blackfin --target=bfin-gchen-elf --disable-nls --with-sysroot=/upstream/release-blackfin --without-headers target_alias=bfin-gchen-elf
make && make install

[root@localhost build-binutils-blackfin]# /upstream/release-blackfin/bin/bfin-gchen-elf-ld -v
GNU ld (GNU Binutils) 2.25.51.20150401

- gcc:

../gcc-blackfin/configure --target=bfin-gchen-elf --disable-nls --disable-threads --disable-shared --disable-libssp --disable-libquadmath --disable-libgomp --disable-libatomic --prefix=/upstream/release-blackfin --without-headers target_alias=bfin-gchen-elf --enable-languages=c,lto
make all-gcc && make all-target-libgcc && make install

[root@localhost build-binutils-blackfin]# /upstream/release-blackfin/bin/bfin-gchen-elf-gcc -v
Using built-in specs.
COLLECT_GCC=/upstream/release-blackfin/bin/bfin-gchen-elf-gcc
COLLECT_LTO_WRAPPER=/upstream/release-blackfin/libexec/gcc/bfin-gchen-elf/5.0.0/lto-wrapper
Target: bfin-gchen-elf
Configured with: ../gcc-blackfin/configure --target=bfin-gchen-elf --disable-nls --disable-threads --disable-shared --disable-libssp --disable-libquadmath --disable-libgomp --disable-libatomic --prefix=/upstream/release-blackfin --without-headers target_alias=bfin-gchen-elf --enable-languages=c,lto
Thread model: single
gcc version 5.0.0 20150401 (experimental) (GCC)

- kernel using:

make ARCH=blackfin CROSS_COMPILE=/upstream/release-blackfin/bin/bfin-gchen-elf-


Is what I have done above correct? Or can we treate it as gcc's issue?


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

2015-04-04 21:17:24

by Richard Weinberger

[permalink] [raw]
Subject: Re: [PATCH] blackfin: Makefile: Add -D__linux__ flag for KBUILD_CFLAGS

Am 04.04.2015 um 23:13 schrieb Chen Gang:
> Is what I have done above correct? Or can we treate it as gcc's issue?

At least ask gcc folks about that before you add a random hack to the kernel.

Thanks,
//richard

2015-04-04 21:29:43

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] blackfin: Makefile: Add -D__linux__ flag for KBUILD_CFLAGS

On 4/5/15 05:17, Richard Weinberger wrote:
> Am 04.04.2015 um 23:13 schrieb Chen Gang:
>> Is what I have done above correct? Or can we treate it as gcc's issue?
>
> At least ask gcc folks about that before you add a random hack to the kernel.
>

For the latest compiler, it should contents -D__linux__, and what I have
done for building gcc/binutils is the common way, so I guess binutils or
gcc need improvement (I shall try to fix it within this month).

But, I am not quite sure whether the old version bfin compilers also
supports -D__linux__ (comparing some of the old compilers of the other
archs, I guess not). Are you sure the old version bfin compilers are OK?


BTW, for the latest bfin compiler from upstream, it contents another
issues which I bypassed now. I shall try to fix them within this month
(try to send all fix patches v1 within 2015-04-20).


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed