Skip to content

Commit 27f2a4d

Browse files
nickdesaulnierswilldeacon
authored andcommitted
Makefile: fix GDB warning with CONFIG_RELR
GDB produces the following warning when debugging kernels built with CONFIG_RELR: BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn' when loading a kernel built with CONFIG_RELR into GDB. It can also prevent debugging symbols using such relocations. Peter sugguests: [That flag] means that lld will use dynamic tags and section type numbers in the OS-specific range rather than the generic range. The kernel itself doesn't care about these numbers; it determines the location of the RELR section using symbols defined by a linker script. Link: ClangBuiltLinux#1057 Suggested-by: Peter Collingbourne <pcc@google.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20210522012626.2811297-1-ndesaulniers@google.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent c468154 commit 27f2a4d

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ LDFLAGS_vmlinux += $(call ld-option, -X,)
10311031
endif
10321032

10331033
ifeq ($(CONFIG_RELR),y)
1034-
LDFLAGS_vmlinux += --pack-dyn-relocs=relr
1034+
LDFLAGS_vmlinux += --pack-dyn-relocs=relr --use-android-relr-tags
10351035
endif
10361036

10371037
# We never want expected sections to be placed heuristically by the

scripts/tools-support-relr.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ trap "rm -f $tmp_file.o $tmp_file $tmp_file.bin" EXIT
77
cat << "END" | $CC -c -x c - -o $tmp_file.o >/dev/null 2>&1
88
void *p = &p;
99
END
10-
$LD $tmp_file.o -shared -Bsymbolic --pack-dyn-relocs=relr -o $tmp_file
10+
$LD $tmp_file.o -shared -Bsymbolic --pack-dyn-relocs=relr \
11+
--use-android-relr-tags -o $tmp_file
1112

1213
# Despite printing an error message, GNU nm still exits with exit code 0 if it
1314
# sees a relr section. So we need to check that nothing is printed to stderr.

0 commit comments

Comments
 (0)