[PATCH RFC v2] Add support for non-contiguous memory regions

Simon Richter Simon.Richter@hogyros.de
Mon Jan 13 17:12:00 GMT 2020


Hi,

On Mon, Jan 13, 2020 at 05:24:07PM +0100, Christophe Lyon wrote:

> > Did you run the testsuite with --enable-non-contiguous-regions? If so, that

> Yes, but after I sent my previous email.... and it shows a few
> regressions, which I'm looking at.

> However the *overlay* tests under ld-elf still work.

Yes, the way overlays are implemented it should be unaffected, because
input sections aren't used twice in that setup.

The bank switching trampoline example is one case where a user might want
to have input sections duplicated during linking -- there might be others.

Unrelated to your patch, that might be an interesting use case as well:
statically linking libraries into overlays:

library.S:

                .section .text
                .globl function
        function:
                blr

overlay1.S:

                .section .text
                mov r0, #0
                bl function

overlay2.S:

                .section .text
                mov r0, #1
                bl function

test.ld:

        SECTIONS {
                OVERLAY : NOCROSSREFS {
                        .text.overlay1 : {
                                overlay1.o(.text)
                                EXCLUDE_FILE(overlay*.o) *(.text)
                        }
                        .text.overlay2 : {
                                overlay2.o(.text)
                                EXCLUDE_FILE(overlay*.o) *(.text)
                        }
                }
        }

My expectation here would be that I'd end up with two copies of "function",
one in each branch of the overlay.

   Simon



More information about the Binutils mailing list