There's no guarantee that the other partition will be loaded, so it
can't be reused.
Depends on D60353
Differential D62365
ELF: Don't reuse a thunk in a different loadable partition. pcc on May 23 2019, 8:25 PM. Authored by
Details There's no guarantee that the other partition will be loaded, so it Depends on D60353
Diff Detail
Event TimelineComment Actions @pcc There are many partition related revisions. Do you know how to apply them all at once to see the whole picture? I don't know much about arc... Comment Actions I use this script to download patches from Phab (I think there's an arc patch command, but I've never had it work correctly): #!/bin/sh wget -O "/tmp/$1.diff" "https://reviews.llvm.org/$1?download=true" I use it like this: arcdl D12345. Then I just do patch -p0 < /tmp/D12345.diff in my monorepo source tree. I think git apply should work as well, but I normally just use patch. Comment Actions I think this is the right thing to do. I've left a suggestion to abstract the names a bit as I think that there are some other cases where we don't want to reuse Thunks across OutputSection boundaries. A theoretical test case .section .sec1, "ax", %progbits bl far .section .sec2, "ax", %progbits bl far .section .sec3, "ax", %progbits .globl far .type far, %function far: bx lr SECTIONS { .sec1 0x1000 (OVERLAY) : AT (0x1000) { *(.sec1) } .sec2 0x1000 (OVERLAY) : AT (0x2000) { *(.sec2) } .far 0x10000000 : { *(.sec3) } } ld.bfd correctly produces a Thunk in both of .sec1 and .sec2 as .sec1 and .sec2 will not be in memory at the same time. It looks like LLD isn't handling this test case well at the moment. I get relocation out of range errors and .sec1 and .sec2 being given a VMA and LMA of 0. I think that this is because the OVERLAY also has the property of removing SHF_ALLOC from the OutputSection which seems to be having some other side-effects. I'll raise a PR.
Comment Actions Address review comments
Comment Actions Thanks for the update. I've marked as accepted as I think only mechanical changes will be needed if D60353 changes Partition representation. |