Attention is currently required from: Martin Roth, Furquan Shaikh. Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Furquan Shaikh, Aaron Durbin,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/50629
to look at the new patch set (#3).
Change subject: rmodtool: Make memlayout symbols absolute and do not relocate them ......................................................................
rmodtool: Make memlayout symbols absolute and do not relocate them
Memlayout is a mechanism to define memory areas outside the normal program segment constructed by the linker. Therefore, it generally doesn't make sense to relocate memlayout symbols when the program is relocated. They tend to refer to things that are always in one specific spot, independent of where the program is loaded.
This hasn't really hurt us in the past because the use case we have for rmodules (ramstage on x86) just happens to not really need to refer to any memlayout-defined areas at the moment. But that use case may come up in the future so it's still worth fixing.
This patch declares all memlayout-defined symbols as ABSOLUTE() in the linker, which is then reflected in the symbol table of the generated ELF. We can then use that distinction to have rmodtool skip them when generating the relocation table for an rmodule. (Also rearrange rmodtool a little to make the primary string table more easily accessible to the rest of the code, so we can refer to symbol names in debug output.)
A similar problem can come up with userspace unit tests, but we cannot modify the userspace relocation toolchain (and for unfortunate historical reasons, it tries to relocate even absolute symbols). We'll just disable PIC and make those binaries fully static to avoid that issue.
Signed-off-by: Julius Werner jwerner@chromium.org Change-Id: Ic51d9add3dc463495282b365c1b6d4a9bf11dbf2 --- M src/include/memlayout.h M tests/Makefile.inc M util/cbfstool/rmodule.c M util/cbfstool/rmodule.h 4 files changed, 56 insertions(+), 38 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/50629/3