On 24 July 2017 at 12:42, Hua Yanghao <huayang...@gmail.com> wrote: >> If you're hitting this error case then I think the >> affected segments must both be of type PT_LOAD. >> (If you're not sure you can post here the output >> of running 'objdump -p' on the binary or otherwise >> show us the program header.) > > Here is the objdump -p: > hua@grass:~/git/usw $ arm-none-eabi-objdump -p > output/qemu_arm_vexpress/qemu_arm > _vexpress.elf > > output/qemu_arm_vexpress/qemu_arm_vexpress.elf: file format > elf32-littlearm > > Program Header: > 0x70000001 off 0x00076e6c vaddr 0x60076d8c paddr 0x60076d8c align 2**2 > filesz 0x00000008 memsz 0x00000008 flags r-- > LOAD off 0x000000e0 vaddr 0x60000000 paddr 0x60000000 align 2**5 > filesz 0x0007773c memsz 0x00077c00 flags rwx > LOAD off 0x00077820 vaddr 0x70000000 paddr 0x60077740 align 2**3 > filesz 0x00000038 memsz 0x00000038 flags r-x > LOAD off 0x00077858 vaddr 0x70080000 paddr 0x60077780 align 2**3 > filesz 0x00000038 memsz 0x00000038 flags r-x > LOAD off 0x00077890 vaddr 0x70090000 paddr 0x600777c0 align 2**3 > filesz 0x00000038 memsz 0x00000038 flags r-x > private flags = 5000200: [Version5 EABI] [soft-float ABI]
> rom: requested regions overlap (rom phdr #2: > output/qemu_arm_vexpress/qemu_arm_vexpress.elf. > free=0x0000000060077c00, addr=0x0000000060077740) Yep, this is complaining because you have two LOAD segments which overlap: LOAD off 0x000000e0 vaddr 0x60000000 paddr 0x60000000 align 2**5 filesz 0x0007773c memsz 0x00077c00 flags rwx which goes from 0x60000000 up to 0x600077bff, and LOAD off 0x00077820 vaddr 0x70000000 paddr 0x60077740 align 2**3 filesz 0x00000038 memsz 0x00000038 flags r-x which starts at 0x60077740, in the middle of the previous one. So should the loader honour the first of these segment definitions (which says "fill it with zeroes", because the memsz is greater than the filesz), or the second (which says "fill it with data from the file") ? Also, it has different rwx flags -- so are you asking for the memory to be rwx or r-x ? (This kind of inconsistency is why overlapping segments are weird.) >> PS: you're consistently saying "section", but in the >> ELF format "section" and "segment" are two different >> things. QEMU doesn't actually look at the section table. >> In an ELF file, sections are used by the linker, but a >> program loader like QEMU (or the Linux kernel) >> looks only at the segment table in the program header. > Yes I am looking from the "section" perspective. > As I intentionally want two sections to overlap (.bss and the lmu > section starting from LMA _lmu0_load_start). > I know loaders only care about segments. :-) Right, but QEMU only cares about segments and the check you're trying to disable is a *segment* overlap check, not a section overlap check. You can overlap sections all you want as long as you don't end up with a final ELF file with overlapping segments... thanks -- PMM