Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn' #1057

Closed
nickdesaulniers opened this issue Jun 17, 2020 · 15 comments
Assignees
Labels
[ARCH] arm64 This bug impacts ARCH=arm64 [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LINUX] 5.14 This bug was fixed in Linux 5.14

Comments

@nickdesaulniers
Copy link
Member

nickdesaulniers commented Jun 17, 2020

from a thread with @broonie , I wasn't able to hit breakpoints in gdb for a kernel under test in QEMU for a mainline aarch64 kernel build with PAC/BTI enabled. Turned out, those were red herrings.

I was also seeing

BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn'

(not sure why BFD is invoked from GDB)
@pcc mentioned that --use-android-relr-tags may be needed to be added to KBUILD_LDFLAGS for CONFIG_RELR=y.

When I disabled CONFIG_RELR=y, I was able to hit breakpoints again.

@nickdesaulniers nickdesaulniers added [BUG] Untriaged Something isn't working [ARCH] arm64 This bug impacts ARCH=arm64 labels Jun 17, 2020
@pcc
Copy link

pcc commented Jun 17, 2020

I would first of all check whether --use-android-relr-tags fixes breakpoints. If it does, it indicates that GDB doesn't like seeing unrecognized tags in the generic range. If that's the case, you could either fix GDB to recognize these sections, or change the kernel to pass the flag (although it would be strange to be passing an Android-specific flag outside of an Android context).

@nickdesaulniers
Copy link
Member Author

Looks like that flag fixes the warning, and restores the ability to hit breakpoints.

(gdb) hbreak start_kernel
No hardware breakpoint support in the target.
diff --git a/Makefile b/Makefile
index ae5d8220f431..dd54412ada4c 100644
--- a/Makefile
+++ b/Makefile
@@ -966,7 +966,7 @@ LDFLAGS_vmlinux     += $(call ld-option, -X,)
 endif
 
 ifeq ($(CONFIG_RELR),y)
-LDFLAGS_vmlinux        += --pack-dyn-relocs=relr
+LDFLAGS_vmlinux        += --pack-dyn-relocs=relr --use-android-relr-tags
 endif
 
 # Align the bit size of userspace programs with the kernel
(gdb) hbreak start_kernel
Hardware assisted breakpoint 1 at 0xffff800011510790: file init/main.c, line 835.

(although it would be strange to be passing an Android-specific flag outside of an Android context).

What are the implications of setting that flag?

@nickdesaulniers
Copy link
Member Author

eek, stepping produces one of these for each step

(gdb) n
Call Frame Instruction op 45 in vendor extension space is not handled on this architecture.

may be unrelated?

@pcc
Copy link

pcc commented Jun 17, 2020

What are the implications of setting that flag?

Nothing significant from the kernel's perspective. It means that lld will use dynamic tags and section type numbers in the OS-specific range rather than the generic range.
http://llvm-cs.pcc.me.uk/tools/lld/ELF/Config.h/ruseAndroidRelrTags

The kernel itself doesn't care about these numbers; it determines the location of the RELR section using symbols defined by a linker script.
https://github.com/torvalds/linux/blob/1b5044021070efa3259f3e9548dc35d1eb6aa844/arch/arm64/kernel/vmlinux.lds.S#L202

may be unrelated?

I think so.

libunwind/src/dwarf2.h: DW_CFA_AARCH64_negate_ra_state = 0x2D

This CFI instruction is associated with PAC, which presumably isn't supported by your version of gdb.

@nickdesaulniers
Copy link
Member Author

If that's the case, you could either fix GDB to recognize these sections, or change the kernel to pass the flag (although it would be strange to be passing an Android-specific flag outside of an Android context).

Didn't you attempt to send binutils patches for RELR? If they were accepted into the kernel, but not binutils, then I think it's more appropriate to add the flag to the kernel.

cc @DanielKristofKiss @kbeyls for the GDB PAC warning.

$ gdb-multiarch --version
GNU gdb (Debian 8.3.1-1) 8.3.1

great job matching the warning to the value!

@pcc
Copy link

pcc commented Jun 18, 2020

No, I didn't send anything to binutils. @MaskRay seems to be in the habit of sending patches to binutils, so maybe he could give that a try? I would imagine that it wouldn't need to be a full RELR implementation but just defining the section type constant and teaching GDB not to blow up if it sees that constant.

That being said, I would imagine that even if we did get a change landed in binutils it would be a good idea to add the flag to the kernel in order to allow older versions of gdb to debug the kernel, so maybe we should make the kernel change anyway.

@MaskRay
Copy link
Member

MaskRay commented Jun 18, 2020

I did ask about -z relr but I do not get a response https://sourceware.org/pipermail/binutils/2020-May/111086.html

My impression is that some ChromeOS folks may have a gold RELR patch which isn't upstreamed. Note that --use-android-relr-tags is probably not a good name. There is little chance that binutils will accept an ELF specific option which isn't named -z

ChromeOS folks also have a glibc patch. I hope they can make some efforts upstreaming that as well.

It also does not look like a good idea to me that we permanently use DT_ANDROID_RELR_* instead of DT_RELR_*. See also android/ndk#909 (comment)

@pcc
Copy link

pcc commented Jun 18, 2020

Again, I'm just talking about teaching GDB about SHT_RELR, not either of the linkers. That can be done independently of any decisions that might be made about the command line syntax.

@nickdesaulniers
Copy link
Member Author

Ok, so probably if CONFIG_RELR and CONFIG_GDB_SCRIPTS are both set, then this flag should be added.

@nickdesaulniers nickdesaulniers added [BUG] linux A bug that should be fixed in the mainline kernel. good first issue Good for newcomers and removed [BUG] Untriaged Something isn't working labels Mar 1, 2021
@nickdesaulniers nickdesaulniers self-assigned this Mar 18, 2021
@nickdesaulniers
Copy link
Member Author

@nickdesaulniers nickdesaulniers added [PATCH] Submitted A patch has been submitted for review and removed good first issue Good for newcomers labels Mar 19, 2021
fengguang pushed a commit to 0day-ci/linux that referenced this issue Mar 19, 2021
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>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
MrArtemSid pushed a commit to MrArtemSid/beryllium-mainline that referenced this issue Mar 29, 2021
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.

Suggested-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: ClangBuiltLinux/linux#1057
Bug: 182884953
(am from https://lore.kernel.org/linux-kbuild/20210319000708.1694662-1-ndesaulniers@google.com/T/#u)
Change-Id: I2c2508da33fcf3cf8485d63be60c523970e3d120
hmtheboy154 pushed a commit to hmtheboy154/Darkmatter-kernel that referenced this issue Apr 15, 2021
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.

Suggested-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: ClangBuiltLinux/linux#1057
Bug: 182884953
(am from https://lore.kernel.org/linux-kbuild/20210319000708.1694662-1-ndesaulniers@google.com/T/#u)
Change-Id: I2c2508da33fcf3cf8485d63be60c523970e3d120
@nickdesaulniers
Copy link
Member Author

Pretty sure this means that GNU objdump can't be used to disassemble kernels built with llvm.

$ aarch64-linux-gnu-objdump -dr vmlinux
aarch64-linux-gnu-objdump: vmlinux.bad: unknown type [0x13] section `.relr.dyn'

vmlinux.bad:     file format elf64-little

aarch64-linux-gnu-objdump: can't disassemble for architecture UNKNOWN!

@pcc
Copy link

pcc commented May 4, 2021

In my experience it's possible to work around that issue by passing -m aarch64 to objdump.

rsglobal pushed a commit to rsglobal/glodroid_forks that referenced this issue May 18, 2021
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.

Suggested-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: ClangBuiltLinux/linux#1057
Bug: 182884953
(am from https://lore.kernel.org/linux-kbuild/20210319000708.1694662-1-ndesaulniers@google.com/T/#u)
Change-Id: I2c2508da33fcf3cf8485d63be60c523970e3d120
Signed-off-by: Matthias Maennich <maennich@google.com>
hisenyiu2015 pushed a commit to hisenyiu2015/msm-4.14 that referenced this issue May 20, 2021
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.

Suggested-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: ClangBuiltLinux/linux#1057
Bug: 182884953
(am from https://lore.kernel.org/linux-kbuild/20210319000708.1694662-1-ndesaulniers@google.com/T/#u)
Change-Id: I2c2508da33fcf3cf8485d63be60c523970e3d120
Signed-off-by: Matthias Maennich <maennich@google.com>
@nickdesaulniers
Copy link
Member Author

@nickdesaulniers nickdesaulniers added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Jun 8, 2021
trixirt pushed a commit to trixirt/linux-next that referenced this issue Jun 9, 2021
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/linux#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>
hisenyiu2015 pushed a commit to hisenyiu2015/msm-4.14 that referenced this issue Jun 18, 2021
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.

[CPNOTE: 21/05/21] Lee: Poked the MLs

Suggested-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: ClangBuiltLinux/linux#1057
Bug: 182884953
(am from https://lore.kernel.org/linux-kbuild/20210319000708.1694662-1-ndesaulniers@google.com/T/#u)
Change-Id: I2c2508da33fcf3cf8485d63be60c523970e3d120
Signed-off-by: Matthias Maennich <maennich@google.com>
ShelbyHell pushed a commit to shelby-stuffs/android_kernel_xiaomi_juice that referenced this issue Jul 4, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mar.pashter1922@gmail.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 6, 2024
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/linux#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>
(cherry picked from commit 27f2a4db76e8d8a8b601fc1c6a7a17f88bd907ab)
Change-Id: Ia8f7c912573f8583e0dc8bc70585a336980967c6
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 6, 2024
Commit 27f2a4db76e8 ("Makefile: fix GDB warning with CONFIG_RELR")
added --use-android-relr-tags to fix a GDB warning

BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn'

The GDB warning has been fixed in version 11.2.

The DT_ANDROID_RELR tag was deprecated since DT_RELR was standardized.
Thus, --use-android-relr-tags should be removed. While making the
change, try -z pack-relative-relocs, which is supported since LLD 15.
Keep supporting --pack-dyn-relocs=relr as well for older LLD versions.
There is no indication of obsolescence for --pack-dyn-relocs=relr.

As of today, GNU ld supports the latter option for x86 and powerpc64
ports and has no intention to support --pack-dyn-relocs=relr. In the
absence of the glibc symbol version GLIBC_ABI_DT_RELR,
--pack-dyn-relocs=relr and -z pack-relative-relocs are identical in
ld.lld.

GNU ld and newer versions of LLD report warnings (instead of errors) for
unknown -z options. Only errors lead to non-zero exit codes. Therefore,
we should test --pack-dyn-relocs=relr before testing
-z pack-relative-relocs.

Link: ClangBuiltLinux/linux#1057
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a619b58721f0a03fd91c27670d3e4c2fb0d88f1e
Signed-off-by: Fangrui Song <maskray@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit ccb2d173b983984bfa35398abed3f8a76c75f788)
Change-Id: I3532ca303af1a6ba098a76b2961400f110867894
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 6, 2024
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/linux#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>
(cherry picked from commit 27f2a4db76e8d8a8b601fc1c6a7a17f88bd907ab)
Change-Id: Ia8f7c912573f8583e0dc8bc70585a336980967c6
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 6, 2024
Commit 27f2a4db76e8 ("Makefile: fix GDB warning with CONFIG_RELR")
added --use-android-relr-tags to fix a GDB warning

BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn'

The GDB warning has been fixed in version 11.2.

The DT_ANDROID_RELR tag was deprecated since DT_RELR was standardized.
Thus, --use-android-relr-tags should be removed. While making the
change, try -z pack-relative-relocs, which is supported since LLD 15.
Keep supporting --pack-dyn-relocs=relr as well for older LLD versions.
There is no indication of obsolescence for --pack-dyn-relocs=relr.

As of today, GNU ld supports the latter option for x86 and powerpc64
ports and has no intention to support --pack-dyn-relocs=relr. In the
absence of the glibc symbol version GLIBC_ABI_DT_RELR,
--pack-dyn-relocs=relr and -z pack-relative-relocs are identical in
ld.lld.

GNU ld and newer versions of LLD report warnings (instead of errors) for
unknown -z options. Only errors lead to non-zero exit codes. Therefore,
we should test --pack-dyn-relocs=relr before testing
-z pack-relative-relocs.

Link: ClangBuiltLinux/linux#1057
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a619b58721f0a03fd91c27670d3e4c2fb0d88f1e
Signed-off-by: Fangrui Song <maskray@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit ccb2d173b983984bfa35398abed3f8a76c75f788)
Change-Id: I3532ca303af1a6ba098a76b2961400f110867894
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 7, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 7, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 7, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 8, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 8, 2024
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/linux#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>
(cherry picked from commit 27f2a4db76e8d8a8b601fc1c6a7a17f88bd907ab)
Change-Id: Ia8f7c912573f8583e0dc8bc70585a336980967c6
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 8, 2024
Commit 27f2a4db76e8 ("Makefile: fix GDB warning with CONFIG_RELR")
added --use-android-relr-tags to fix a GDB warning

BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn'

The GDB warning has been fixed in version 11.2.

The DT_ANDROID_RELR tag was deprecated since DT_RELR was standardized.
Thus, --use-android-relr-tags should be removed. While making the
change, try -z pack-relative-relocs, which is supported since LLD 15.
Keep supporting --pack-dyn-relocs=relr as well for older LLD versions.
There is no indication of obsolescence for --pack-dyn-relocs=relr.

As of today, GNU ld supports the latter option for x86 and powerpc64
ports and has no intention to support --pack-dyn-relocs=relr. In the
absence of the glibc symbol version GLIBC_ABI_DT_RELR,
--pack-dyn-relocs=relr and -z pack-relative-relocs are identical in
ld.lld.

GNU ld and newer versions of LLD report warnings (instead of errors) for
unknown -z options. Only errors lead to non-zero exit codes. Therefore,
we should test --pack-dyn-relocs=relr before testing
-z pack-relative-relocs.

Link: ClangBuiltLinux/linux#1057
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a619b58721f0a03fd91c27670d3e4c2fb0d88f1e
Signed-off-by: Fangrui Song <maskray@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit ccb2d173b983984bfa35398abed3f8a76c75f788)
Change-Id: I3532ca303af1a6ba098a76b2961400f110867894
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 8, 2024
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/linux#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>
(cherry picked from commit 27f2a4db76e8d8a8b601fc1c6a7a17f88bd907ab)
Change-Id: Ia8f7c912573f8583e0dc8bc70585a336980967c6
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 8, 2024
Commit 27f2a4db76e8 ("Makefile: fix GDB warning with CONFIG_RELR")
added --use-android-relr-tags to fix a GDB warning

BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn'

The GDB warning has been fixed in version 11.2.

The DT_ANDROID_RELR tag was deprecated since DT_RELR was standardized.
Thus, --use-android-relr-tags should be removed. While making the
change, try -z pack-relative-relocs, which is supported since LLD 15.
Keep supporting --pack-dyn-relocs=relr as well for older LLD versions.
There is no indication of obsolescence for --pack-dyn-relocs=relr.

As of today, GNU ld supports the latter option for x86 and powerpc64
ports and has no intention to support --pack-dyn-relocs=relr. In the
absence of the glibc symbol version GLIBC_ABI_DT_RELR,
--pack-dyn-relocs=relr and -z pack-relative-relocs are identical in
ld.lld.

GNU ld and newer versions of LLD report warnings (instead of errors) for
unknown -z options. Only errors lead to non-zero exit codes. Therefore,
we should test --pack-dyn-relocs=relr before testing
-z pack-relative-relocs.

Link: ClangBuiltLinux/linux#1057
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a619b58721f0a03fd91c27670d3e4c2fb0d88f1e
Signed-off-by: Fangrui Song <maskray@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit ccb2d173b983984bfa35398abed3f8a76c75f788)
Change-Id: I3532ca303af1a6ba098a76b2961400f110867894
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 8, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 9, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 9, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 10, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 10, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 11, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 12, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 13, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 14, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 17, 2024
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/linux#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>
(cherry picked from commit 27f2a4db76e8d8a8b601fc1c6a7a17f88bd907ab)
Change-Id: Ia8f7c912573f8583e0dc8bc70585a336980967c6
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 17, 2024
Commit 27f2a4db76e8 ("Makefile: fix GDB warning with CONFIG_RELR")
added --use-android-relr-tags to fix a GDB warning

BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn'

The GDB warning has been fixed in version 11.2.

The DT_ANDROID_RELR tag was deprecated since DT_RELR was standardized.
Thus, --use-android-relr-tags should be removed. While making the
change, try -z pack-relative-relocs, which is supported since LLD 15.
Keep supporting --pack-dyn-relocs=relr as well for older LLD versions.
There is no indication of obsolescence for --pack-dyn-relocs=relr.

As of today, GNU ld supports the latter option for x86 and powerpc64
ports and has no intention to support --pack-dyn-relocs=relr. In the
absence of the glibc symbol version GLIBC_ABI_DT_RELR,
--pack-dyn-relocs=relr and -z pack-relative-relocs are identical in
ld.lld.

GNU ld and newer versions of LLD report warnings (instead of errors) for
unknown -z options. Only errors lead to non-zero exit codes. Therefore,
we should test --pack-dyn-relocs=relr before testing
-z pack-relative-relocs.

Link: ClangBuiltLinux/linux#1057
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a619b58721f0a03fd91c27670d3e4c2fb0d88f1e
Signed-off-by: Fangrui Song <maskray@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit ccb2d173b983984bfa35398abed3f8a76c75f788)
Change-Id: I3532ca303af1a6ba098a76b2961400f110867894
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 18, 2024
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/linux#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>
(cherry picked from commit 27f2a4db76e8d8a8b601fc1c6a7a17f88bd907ab)
Change-Id: Ia8f7c912573f8583e0dc8bc70585a336980967c6
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 18, 2024
Commit 27f2a4db76e8 ("Makefile: fix GDB warning with CONFIG_RELR")
added --use-android-relr-tags to fix a GDB warning

BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn'

The GDB warning has been fixed in version 11.2.

The DT_ANDROID_RELR tag was deprecated since DT_RELR was standardized.
Thus, --use-android-relr-tags should be removed. While making the
change, try -z pack-relative-relocs, which is supported since LLD 15.
Keep supporting --pack-dyn-relocs=relr as well for older LLD versions.
There is no indication of obsolescence for --pack-dyn-relocs=relr.

As of today, GNU ld supports the latter option for x86 and powerpc64
ports and has no intention to support --pack-dyn-relocs=relr. In the
absence of the glibc symbol version GLIBC_ABI_DT_RELR,
--pack-dyn-relocs=relr and -z pack-relative-relocs are identical in
ld.lld.

GNU ld and newer versions of LLD report warnings (instead of errors) for
unknown -z options. Only errors lead to non-zero exit codes. Therefore,
we should test --pack-dyn-relocs=relr before testing
-z pack-relative-relocs.

Link: ClangBuiltLinux/linux#1057
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a619b58721f0a03fd91c27670d3e4c2fb0d88f1e
Signed-off-by: Fangrui Song <maskray@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit ccb2d173b983984bfa35398abed3f8a76c75f788)
Change-Id: I3532ca303af1a6ba098a76b2961400f110867894
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 18, 2024
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/linux#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>
(cherry picked from commit 27f2a4db76e8d8a8b601fc1c6a7a17f88bd907ab)
Change-Id: Ia8f7c912573f8583e0dc8bc70585a336980967c6
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
clarencelol pushed a commit to clarencekopitiam/kernel_xiaomi_sm6250 that referenced this issue Jul 18, 2024
Commit 27f2a4db76e8 ("Makefile: fix GDB warning with CONFIG_RELR")
added --use-android-relr-tags to fix a GDB warning

BFD: /android0/linux-next/vmlinux: unknown type [0x13] section `.relr.dyn'

The GDB warning has been fixed in version 11.2.

The DT_ANDROID_RELR tag was deprecated since DT_RELR was standardized.
Thus, --use-android-relr-tags should be removed. While making the
change, try -z pack-relative-relocs, which is supported since LLD 15.
Keep supporting --pack-dyn-relocs=relr as well for older LLD versions.
There is no indication of obsolescence for --pack-dyn-relocs=relr.

As of today, GNU ld supports the latter option for x86 and powerpc64
ports and has no intention to support --pack-dyn-relocs=relr. In the
absence of the glibc symbol version GLIBC_ABI_DT_RELR,
--pack-dyn-relocs=relr and -z pack-relative-relocs are identical in
ld.lld.

GNU ld and newer versions of LLD report warnings (instead of errors) for
unknown -z options. Only errors lead to non-zero exit codes. Therefore,
we should test --pack-dyn-relocs=relr before testing
-z pack-relative-relocs.

Link: ClangBuiltLinux/linux#1057
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a619b58721f0a03fd91c27670d3e4c2fb0d88f1e
Signed-off-by: Fangrui Song <maskray@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
(cherry picked from commit ccb2d173b983984bfa35398abed3f8a76c75f788)
Change-Id: I3532ca303af1a6ba098a76b2961400f110867894
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 21, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
mrsrimar22 pushed a commit to KrustyCook/android_kernel_xiaomi_sm6225 that referenced this issue Jul 21, 2024
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/linux#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>
Signed-off-by: mrsrimar22 <mrsrimar22@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] arm64 This bug impacts ARCH=arm64 [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LINUX] 5.14 This bug was fixed in Linux 5.14
Projects
None yet
Development

No branches or pull requests

3 participants