makefile - gcc-4.1 -> gcc-4.8 linker error. New ".text.unlikely" section overlap ".text" section -


i'm trying build cromwell (original xbox legal firmware replacement) using more recent version of gcc after altering project compilation setup slightly, ld throws following error:

ld: section .text.unlikely loaded @ [0000000000000000,0000000000000669] overlaps section .text loaded @ [0000000000000000,0000000000021515]

you can clone project here if want have look: https://github.com/not404/cromwell

first , foremost, want mention able build , run project(on xbox) using gcc-3.3 on x32 linux vm , gcc-4.1 on cygwin x86 (built gcc target i686-linux-gnu). had remove -werror cflag in main makefile build in gcc-3.3. trying build using gcc-4.8.2 on x32 vm after modifying makefile result in error mentionned above.

in order there, modified cflags in makefile in root of project. still had -werror removed clags. had add -fno-stack-protector flags in cflags , eth_cflags past undefined reference '__stack_chk_fail' error. think workaround quite harmless. older gcc versions didn't support such stack smashing protection mechanism disabling should not pose problem.

after modifications made makefile, presented linker error section overlapping. read .text.unlikely section added around gcc 4.6 not considered when cromwell project actively developped!

so, in order past error, tried explicitely define .text.unlikely section in "ldscript-crom.ld" linker script. originally, script contained following:

.text low_rom : @ ( 0 ){     _start_low_rom = . ;     *(.text);     _end_low_rom = . ; } 

i changed to:

    .text low_rom : @ ( 0 ){     _start_low_rom = . ;     *(.text);     *(.text.unlikely);     _end_low_rom = . ; } 

after change, yet error:

ld: section .eh_frame loaded @ [0000000000000000,00000000000062b3] overlaps section .text loaded @ [0000000000000000,0000000000021b7f]

from read on internet, .eh_frame section related exception handling , targeted c++ catch exceptions.

i able fix adding following flags cflags , eht_cflags in main makefile:

-fno-reorder-functions -fno-unwind-tables -fno-asynchronous-unwind-tables  

after that, output file. unfortunately, there error in execution. seems start no video , execution seem crash @ point.

i tried print map of linked file don't see relevant. won't post 2 maps(with gcc-3.3 , gcc-4.8, same ld) here big. here part of map containing .text.unlikely section definition(from gcc-4.8):

                0x0000000003a216f0                disable  *fill*         0x0000000003a2170e        0x2   .text          0x0000000003a21710      0x165 /home/cromwelldev/workspace/cromwell/obj/xbox_main.o                 0x0000000003a21710                loadkernel                 0x0000000003a21870                cleanup  *fill*         0x0000000003a21875        0xb   .text          0x0000000003a21880      0x2b5 /home/cromwelldev/workspace/cromwell/obj/elf.o                 0x0000000003a21880                prepare_boot_params                 0x0000000003a21b20                elf_start  *fill*         0x0000000003a21b35        0xb   .text          0x0000000003a21b40       0x46 /home/cromwelldev/workspace/cromwell/obj/exec_elf.o                 0x0000000003a21b40                try_elf_boot  *(.text.unlikely)                 0x0000000003a21b86                _end_low_rom = .  .iplt           0x0000000000000000        0x0  .iplt          0x0000000000000000        0x0 /home/cromwelldev/workspace/cromwell/obj/bootstartup.o  .rel.dyn        0x0000000000000000        0x0  .rel.iplt      0x0000000000000000        0x0 /home/cromwelldev/workspace/cromwell/obj/bootstartup.o  .rel.text      0x0000000000000000        0x0 /home/cromwelldev/workspace/cromwell/obj/bootstartup.o  .rel.data      0x0000000000000000        0x0 /home/cromwelldev/workspace/cromwell/obj/bootstartup.o  .rodata         0x0000000003a21b86    0x108b1 load address 0x0000000000021b86  *(.rodata)  *fill*         0x0000000003a21b86        0x2  

here's same section gcc-3.3:

                    0x0000000003a1f7a0                disable      *fill*         0x0000000003a1f7c2        0xe       .text          0x0000000003a1f7d0      0x165 /home/cromwelldev/workspace/cromwell/obj/xbox_main.o                     0x0000000003a1f7d0                loadkernel                     0x0000000003a1f930                cleanup      *fill*         0x0000000003a1f935        0xb       .text          0x0000000003a1f940      0x2b6 /home/cromwelldev/workspace/cromwell/obj/elf.o                     0x0000000003a1f940                prepare_boot_params                     0x0000000003a1fbe0                elf_start      *fill*         0x0000000003a1fbf6        0xa       .text          0x0000000003a1fc00       0x33 /home/cromwelldev/workspace/cromwell/obj/exec_elf.o                     0x0000000003a1fc00                try_elf_boot                     0x0000000003a1fc33                _end_low_rom = .      .iplt           0x0000000000000000        0x0      .iplt          0x0000000000000000        0x0 /home/cromwelldev/workspace/cromwell/obj/bootstartup.o      .rel.dyn        0x0000000000000000        0x0      .rel.iplt      0x0000000000000000        0x0 /home/cromwelldev/workspace/cromwell/obj/bootstartup.o      .rel.text      0x0000000000000000        0x0 /home/cromwelldev/workspace/cromwell/obj/bootstartup.o      .rel.data      0x0000000000000000        0x0 /home/cromwelldev/workspace/cromwell/obj/bootstartup.o      .rodata         0x0000000003a1fc33    0x11024 load address 0x000000000001fc33      *(.rodata) 

i think problem reside in .text.unlikely section put in linker script. must i'm @ lost here. i'm not familiar linker scripts so don't know do.

is there way build project without separating .text.unlikely section rest of .text section? way solve problem?

i think -fno-reorder-functions -fno-unwind-tables -fno-asynchronous-unwind-tables flags not solution problem. in such project, there elements need @ specific memory locations , fear these flags move things around in bad way!

thank in advance!

ben

what did fix error .text.unlikely overlapping .text correct -- linker error caused linker "punting" beginning .text.unlikely section @ load address 0 because linker script not specify anywhere go. repeating linker script change .eh_frame section , removing -fno-reorder-functions -fno-unwind-tables -fno-asynchronous-unwind-tables compiler flags should correct error .eh_frame overlapping .text without causing further trouble downstream.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

c# - Retrieve google contact -

javascript - How to insert selected radio button value into table cell -