coreboot-kgpe-d16/util/cbfstool
Raul E Rangel 41ba01bb95 util/cbfstool/rmodule: Omit undefined extern symbols from reloc table
When using `DECLARE_OPTIONAL_REGION`, it is assumed that
REGION_SIZE(name) == 0 if the region was not defined in the memlayout.
When using non-rmodule stages (i.e., bootblock, romstage, etc), this
assumption holds true, but breaks down in rmodule (i.e., ramstage)
stages.

The rmodule tool is not currently omitting undefined externals from the
relocation table. e.g.,

    extern u8 _##name##_size[];

This means that when the rmodule loader runs, it will rewrite the symbol
from 0 (which is the default the linker assumed) to 0 + offset. This is
wrong since the symbol doesn't actually exist. Instead we need to omit
the relocation so it continues to keep the default value of 0.

BUG=b:179699789
TEST=Print out REGION_SIZE(cbfs_cache) in ramstage and verify it is set
to 0.
I also see the following printed by the rmodtool now:

DEBUG: Omitting relocation for undefined extern: _watchdog_tombstone_size
DEBUG: Omitting relocation for undefined extern: _watchdog_tombstone
DEBUG: Omitting relocation for undefined extern: _watchdog_tombstone
DEBUG: Omitting relocation for absolute symbol: _stack_size
DEBUG: Omitting relocation for absolute symbol: _program_size
DEBUG: Omitting relocation for absolute symbol: _cbmem_init_hooks_size
DEBUG: Omitting relocation for absolute symbol: _payload_preload_cache_size
DEBUG: Omitting relocation for absolute symbol: _payload_preload_cache
DEBUG: Omitting relocation for absolute symbol: _payload_preload_cache_size
DEBUG: Omitting relocation for absolute symbol: _payload_preload_cache
DEBUG: Omitting relocation for undefined extern: _cbfs_cache
DEBUG: Omitting relocation for undefined extern: _cbfs_cache_size

As you can see the _watchdog_tombstone will also be fixed by this CL.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: Ib57e263fa9014da4f6854637000c1c8ad8eb351a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58376
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
2021-10-20 15:56:28 +00:00
..
bpdt_formats util/cse_serger: Replace cse_layout_regions with array of regions 2021-10-19 16:10:12 +00:00
console treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
flashmap util: Use SPDX headers 2020-05-11 19:38:40 +00:00
fpt_formats util/cse_fpt: Add a new tool for managing Intel CSE FPT binaries 2021-10-19 16:08:03 +00:00
lz4 lz4: Fix out-of-bounds reads 2020-03-02 15:03:03 +00:00
lzma util/cbfstool/lzma: Make clang-11+'s indentation checker happy 2020-02-01 19:51:31 +00:00
.gitignore elogtool: add to gitignore 2021-08-09 15:02:36 +00:00
EXAMPLE
Makefile util/cse_serger: Add a new tool for stitching CSE components 2021-10-19 16:08:24 +00:00
Makefile.inc util/cse*: Add cse_helpers.{c,h} 2021-10-19 16:08:45 +00:00
ProcessorBind.h util: Use SPDX headers 2020-05-11 19:38:40 +00:00
amdcompress.c util/cbfstool/amdcompress: fix argument requirement 2020-11-15 16:49:30 +00:00
cbfs-mkpayload.c util/cbfstool: Add support for ARM64 UefiPayload 2021-10-04 02:31:01 +00:00
cbfs-mkstage.c cbfstool/cbfs-mkstage.c: Change signature of parse_elf_to_xip_stage() 2021-07-01 15:22:08 +00:00
cbfs-payload-linux.c cbfstool: Use cbfs_serialized.h and standard vboot helpers 2020-12-03 00:00:33 +00:00
cbfs.h cbfstool: Add support for platform "fixups" when modifying bootblock 2021-03-13 04:17:35 +00:00
cbfs_glue.h cbfstool: Support CONFIG_CBFS_VERIFICATION and metadata hash anchor 2021-03-13 04:16:20 +00:00
cbfs_image.c cbfs: Move stage header into a CBFS attribute 2021-03-17 08:10:00 +00:00
cbfs_image.h cbfstool: Hide hash printing behind -v and add to parseable output 2020-12-03 00:08:03 +00:00
cbfs_sections.c util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
cbfs_sections.h cbfstool: Support CONFIG_CBFS_VERIFICATION and metadata hash anchor 2021-03-13 04:16:20 +00:00
cbfscomptool.c cbfstool: Use cbfs_serialized.h and standard vboot helpers 2020-12-03 00:00:33 +00:00
cbfstool.c util/cbfstool: Remove unused pagesize parameter 2021-07-17 13:45:45 +00:00
coff.h util/cbfstool: Add support for ARM64 UefiPayload 2021-10-04 02:31:01 +00:00
common.c cbfstool: Add helper function `buffer_from_file_aligned_size` 2021-10-18 21:15:41 +00:00
common.h cbfstool: Add helper function `buffer_from_file_aligned_size` 2021-10-18 21:15:41 +00:00
compress.c cbfstool: Use cbfs_serialized.h and standard vboot helpers 2020-12-03 00:00:33 +00:00
cse_fpt.c util/cse*: Add cse_helpers.{c,h} 2021-10-19 16:08:45 +00:00
cse_fpt.h util/cse*: Add cse_helpers.{c,h} 2021-10-19 16:08:45 +00:00
cse_helpers.c util/cse*: Add cse_helpers.{c,h} 2021-10-19 16:08:45 +00:00
cse_helpers.h util/cse*: Add cse_helpers.{c,h} 2021-10-19 16:08:45 +00:00
cse_serger.c util/cse_serger: Add command `create-cse-region` 2021-10-19 16:32:24 +00:00
cse_serger.h util/cse_serger: Replace cse_layout_regions with array of regions 2021-10-19 16:10:12 +00:00
default-x86.fmd drivers/vpd: Add VPD region to default FMAP when selected 2021-01-04 23:12:35 +00:00
default.fmd
description.md
elf.h cbfstool: Add support for platform "fixups" when modifying bootblock 2021-03-13 04:17:35 +00:00
elfheaders.c util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
elfparsing.h util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
elogtool.c elogtool: compile in 32-bit platforms 2021-09-21 01:02:56 +00:00
eventlog.c elogtool: Fix off-by-one error in month in timestamp 2021-09-24 18:08:43 +00:00
eventlog.h elogtool: add "clear" command 2021-09-10 22:53:05 +00:00
fdt.h treewide: replace GPLv2 long form headers with SPDX header 2020-05-06 22:20:57 +00:00
fit.c util/cbfstool/fit.c: Fix getting the topswap table 2021-05-27 14:38:34 +00:00
fit.h util/ifittool: Add an option to set the FIT pointer a CBFS file 2021-03-19 11:22:55 +00:00
flashmap_tests.c util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
fmap_from_fmd.c util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
fmap_from_fmd.h util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
fmaptool.c util/cbfstool/fmaptool: Generate list of terminal sections 2020-12-08 18:59:05 +00:00
fmd.c util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
fmd.h util/cbfstool/fmd: make flashmap_flags bitfield struct elements unsigned 2020-09-23 13:39:14 +00:00
fmd_parser.c_shipped
fmd_parser.h_shipped
fmd_parser.y util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
fmd_scanner.c_shipped treewide: Remove trailing whitespace 2021-02-17 17:30:05 +00:00
fmd_scanner.h_shipped treewide: Remove trailing whitespace 2021-02-17 17:30:05 +00:00
fmd_scanner.l util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
fv.h util/cbftool: Fix the bug in parsing Uefipayload with extended header 2021-09-02 06:07:08 +00:00
ifittool.c util/ifittool: Add an option to set the FIT pointer a CBFS file 2021-03-19 11:22:55 +00:00
ifwitool.c util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
linux.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
linux_trampoline.S cbfstool/linux_trampoline.S: Fix up the e820 table 2021-06-02 07:47:01 +00:00
linux_trampoline.c cbfstool/linux_trampoline.S: Fix up the e820 table 2021-06-02 07:47:01 +00:00
linux_trampoline.h util/cbfstool/linux_trampoline.h: Fix typo in comment 2021-06-04 12:35:14 +00:00
option.h util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
partitioned_file.c util/cbfstool: unbreak compilation on FreeBSD 2021-01-13 12:07:17 +00:00
partitioned_file.h util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
platform_fixups.c cbfstool: Add support for platform "fixups" when modifying bootblock 2021-03-13 04:17:35 +00:00
rmodtool.c util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00
rmodule.c util/cbfstool/rmodule: Omit undefined extern symbols from reloc table 2021-10-20 15:56:28 +00:00
rmodule.h rmodtool: Make memlayout symbols absolute and do not relocate them 2021-02-18 02:32:06 +00:00
swab.h
xdr.c util/: Replace GPLv2 boiler plate with SPDX header 2020-05-09 21:22:08 +00:00