diff mbox

can't compile kernel for parisc

Message ID a4423d670903180455u20ead146k919426a1fb7276c6@mail.gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Alexander Beregalov March 18, 2009, 11:55 a.m. UTC
Hi

ld now does not segfault

http://lists.gnu.org/archive/html/bug-binutils/2009-03/msg00105.html

but I still can not build kernel.

   ld    -r -o init/built-in.o init/main.o init/version.o
init/mounts.o init/noinitramfs.o init/calibrate.o
  ld  --build-id -o .tmp_vmlinux1 -T arch/parisc/kernel/vmlinux.lds
arch/parisc/kernel/head.o   init/built-in.o --start-group
usr/built-in.o  arch/parisc/mm/built-in.o
arch/parisc/kernel/built-in.o  arch/parisc/math-emu/built-in.o
arch/parisc/kernel/init_task.o  kernel/built-in.o  mm/built-in.o
fs/built-in.o  ipc/built-in.o  security/built-in.o  crypto/built-in.o
block/built-in.o  lib/lib.a  arch/parisc/lib/lib.a `gcc
-print-libgcc-file-name`  lib/built-in.o  arch/parisc/lib/built-in.o
`gcc -print-libgcc-file-name`  drivers/built-in.o  sound/built-in.o
firmware/built-in.o  net/built-in.o --end-group
ld: arch/parisc/kernel/built-in.o(.text+0xc84): cannot reach
000000b2_b2:46+4068, recompile with -ffunction-sections
ld: arch/parisc/kernel/built-in.o(.text+0xc84): cannot handle
R_PARISC_PCREL12F for .text

I have recompiled kernel with -ffunction-sections, but still the same problem.



gcc version 4.3.3 (Gentoo 4.3.3-r1 p1.1, pie-10.1.5)
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Grant Grundler March 20, 2009, 9:40 p.m. UTC | #1
On Wed, Mar 18, 2009 at 02:55:13PM +0300, Alexander Beregalov wrote:
> ld: arch/parisc/kernel/built-in.o(.text+0xc84): cannot handle
> R_PARISC_PCREL12F for .text

Alexander,
can you post the .config file used for this build?
It would be the easiest way for someone else to reproduce the problem.

thanks,
grant
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Beregalov March 21, 2009, 1:56 a.m. UTC | #2
2009/3/21 Grant Grundler <grundler@parisc-linux.org>:
> On Wed, Mar 18, 2009 at 02:55:13PM +0300, Alexander Beregalov wrote:
>> ld: arch/parisc/kernel/built-in.o(.text+0xc84): cannot handle
>> R_PARISC_PCREL12F for .text
>
> Alexander,
> can you post the .config file used for this build?
> It would be the easiest way for someone else to reproduce the problem.

Hi

It is in the first mail.
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kyle mcmartin April 2, 2009, 3:52 p.m. UTC | #3
On Wed, Mar 18, 2009 at 02:55:13PM +0300, Alexander Beregalov wrote:
> 
> I have recompiled kernel with -ffunction-sections, but still the same problem.
> 

This is wrong... the kernel is always built with -ffunction-sections,
see arch/parisc/Makefile:

# Without this, "ld -r" results in .text sections that are too big
# (> 0x40000) for branches to reach stubs.
cflags-y        += -ffunction-sections

cheers, Kyle
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kyle mcmartin April 2, 2009, 3:55 p.m. UTC | #4
On Wed, Mar 18, 2009 at 10:00:26AM -0400, John David Anglin wrote:
> > ld: arch/parisc/kernel/built-in.o(.text+0xc84): cannot reach
> > 000000b2_b2:46+4068, recompile with -ffunction-sections
> > ld: arch/parisc/kernel/built-in.o(.text+0xc84): cannot handle
> > R_PARISC_PCREL12F for .text
> > 
> 
> -ffunction-sections won't work because GCC doesn't generate calls
> with instructions that would use a R_PARISC_PCREL12F relocation.
> This is some kind of conditional branch.  Probably, it's in some
> kernel assembly code.
> 
> You need to use nm, objdump and/or readelf to determine which file
> contributing to built-in.o contains the branch.  I looked in one of
> my builds and didn't see this relocation.
> 

This is... somewhat special. I've never seen this either. Possibly I
should install a Gentoo machine so I can reproduce with their toolchain?

objdump -dr arch/parisc/kernel/built-in.o | grep PCREL12F should tell
you where the problem is. I agree with JDA, judging by the fact that
it's the kernel/built-in.o, I would guess it's assembler as well.

(Sorry for taking so long to get to this thread, I must have missed it
 while I was in Boston.)

regards, Kyle
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Beregalov April 3, 2009, 1:57 p.m. UTC | #5
2009/4/2 Kyle McMartin <kyle@mcmartin.ca>:
> On Wed, Mar 18, 2009 at 10:00:26AM -0400, John David Anglin wrote:
>> > ld: arch/parisc/kernel/built-in.o(.text+0xc84): cannot reach
>> > 000000b2_b2:46+4068, recompile with -ffunction-sections
>> > ld: arch/parisc/kernel/built-in.o(.text+0xc84): cannot handle
>> > R_PARISC_PCREL12F for .text
>> >
>>
>> -ffunction-sections won't work because GCC doesn't generate calls
>> with instructions that would use a R_PARISC_PCREL12F relocation.
>> This is some kind of conditional branch.  Probably, it's in some
>> kernel assembly code.
>>
>> You need to use nm, objdump and/or readelf to determine which file
>> contributing to built-in.o contains the branch.  I looked in one of
>> my builds and didn't see this relocation.
>>
>
> This is... somewhat special. I've never seen this either. Possibly I
> should install a Gentoo machine so I can reproduce with their toolchain?
>
> objdump -dr arch/parisc/kernel/built-in.o | grep PCREL12F should tell
> you where the problem is. I agree with JDA, judging by the fact that
> it's the kernel/built-in.o, I would guess it's assembler as well.
Thanks.
now I have

ld: drivers/built-in.o(.devinit.text+0x3f520): cannot reach
00002ea1_memcpy+0, recompile with -ffunction-sections
ld: drivers/built-in.o(.devinit.text+0x3f520): cannot handle
R_PARISC_PCREL17F for memcpy


0003f044 <niu_get_invariants>:
<..>
0003f0ac <.L1724>:
<..>
3f510:       40 bc 01 b0     ldb d8(r5),ret0
3f514:       37 9c 00 02     ldo 1(ret0),ret0
3f518:       60 bc 01 b0     stb ret0,d8(r5)
3f51c:       40 b8 01 e8     ldb f4(r5),r24
3f520:       e8 40 00 00     b,l 3f528 <.L1724+0x47c>,rp
                   3f520: R_PARISC_PCREL17F        memcpy
3f524:       34 ba 02 88     ldo 144(r5),r26
3f528:       e8 5f 04 25     b,l 3e740 <niu_get_and_validate_port>,rp
3f52c:       08 12 02 5a     copy r18,r26
3f530:       c8 7c ae c4     movb,<> ret0,r3,40c98 <.L1884+0x5c>
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 2e2f4a4..61b09b2 100644
--- a/Makefile
+++ b/Makefile
@@ -346,7 +346,7 @@  KBUILD_CPPFLAGS := -D__KERNEL__

 KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                   -fno-strict-aliasing -fno-common \
-                  -Werror-implicit-function-declaration
+                  -Werror-implicit-function-declaration -ffunction-sections
 KBUILD_AFLAGS   := -D__ASSEMBLY__

 # Read KERNELRELEASE from include/config/kernel.release (if it exists)