gcc -O0 relocation 28 out of range (need new gcc)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

gcc -O0 relocation 28 out of range (need new gcc)

2,403 Views
fatalfeel
Contributor V

continue this problem how do i solve this problem relocation 28 out of range i.mx6

Gcc build kernel in -O0, module's cflag use -O1

[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)

[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

[    0.000000]     vmalloc : 0xc0800000 - 0xff000000   (1000 MB)

[    0.000000]     lowmem  : 0x80000000 - 0xc0000000   (1024 MB)

[    0.000000]     pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)

[    0.000000]     modules : 0x7f000000 - 0x7fe00000   (  14 MB)

[    0.000000]       .text : 0x80008000 - 0x81b47e38   (27904 kB)

[    0.000000]       .init : 0x81b48000 - 0x81c2f6c0   ( 926 kB)

[    0.000000]       .data : 0x81c30000 - 0x81cc75e0   ( 606 kB)

[    0.000000]        .bss : 0x81cc75e0 - 0x81d865fc   ( 765 kB)

.

.

.

[   14.173801] compat: section 2 reloc 4 sym 'genl_unregister_family': relocation 28 out of range (0x7f0000b8 -> 0x811414e4)

.text part become larger

how do i solve this problem => relocation 28 out of range

I TRY add KBUILD_CFLAGS cflag -mlong-calls still failed....

how to rearrange code~~~?

my compat section in the /hardware not under the /kernel_imx

modify vmlinux.lds.S ???

or

modify the directory to build code on another place like kernel_imx/drivers?

here are some info but not solve problem

1. far_away_symbol
Mailing List Archive: Re: ARM: relocation out of range (when loading a module)

2. modify vmlinux.lds.S

Mailing List Archive: Re: ARM: relocation out of range (when loading a module)

3.mlong-calls
[PATCH] ARM: MMUless Core: Fix insmod error - module relocation out of range

Labels (2)
0 Kudos
6 Replies

1,252 Views
dogisfat
Contributor IV

I had this issue on an imx7 project and found the solution was adding the -mlong-calls. Both the kernel modules and the zImage had to be rebuilt with the flag before the relocation error disappeared in the kernel output.

0 Kudos

1,252 Views
igorpadykov
NXP Employee
NXP Employee

Hi jesse

to overcome branch size limit one can try to create additional

branch table or try various compiler optimization options.

Also since this is specific compiler problem recommended to post

it to gcc mailing list

GCC mailing lists- GNU Project - Free Software Foundation (FSF)

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,252 Views
fatalfeel
Contributor V

already use -mlong-calls but failed again

create additionalbranch table

how to do????????? need help

0 Kudos

1,252 Views
igorpadykov
NXP Employee
NXP Employee

For obtaining full solution for custom task one can apply to NXP Professional Services:

http://www.nxp.com/pages/freescale-professional-services:PROFESSIONAL-SERVICES

Best regards

igor

0 Kudos

1,252 Views
fatalfeel
Contributor V

But I still want to have all kernel compile with -O0 -g

its more easier to use kgdb or openocd to debug struct and value

If someday freescale have new compiler to support -mlong-calls

and do branch long jump is no problem please me know

still need a good gcc compiler for branch long jump

0 Kudos

1,252 Views
fatalfeel
Contributor V

i want to debug driver so i use this way to solve

gedit free_imx/myandroid/kernel_imx/Makefile

KBUILD_CFLAGS    += -O2 -g

gedit free_imx/myandroid/kernel_imx/drivers/Makefile
add in first line

KBUILD_CFLAGS+= -O0 -g
0 Kudos