linux-stable/scripts
Masahiro Yamada a2a121a193 modpost: fix section mismatch message for R_ARM_{PC24,CALL,JUMP24}
[ Upstream commit 56a24b8ce6 ]

addend_arm_rel() processes R_ARM_PC24, R_ARM_CALL, R_ARM_JUMP24 in a
wrong way.

Here, test code.

[test code for R_ARM_JUMP24]

  .section .init.text,"ax"
  bar:
          bx      lr

  .section .text,"ax"
  .globl foo
  foo:
          b       bar

[test code for R_ARM_CALL]

  .section .init.text,"ax"
  bar:
          bx      lr

  .section .text,"ax"
  .globl foo
  foo:
          push    {lr}
          bl      bar
          pop     {pc}

If you compile it with ARM multi_v7_defconfig, modpost will show the
symbol name, (unknown).

  WARNING: modpost: vmlinux.o: section mismatch in reference: foo (section: .text) -> (unknown) (section: .init.text)

(You need to use GNU linker instead of LLD to reproduce it.)

Fix the code to make modpost show the correct symbol name.

I imported (with adjustment) sign_extend32() from include/linux/bitops.h.

The '+8' is the compensation for pc-relative instruction. It is
documented in "ELF for the Arm Architecture" [1].

  "If the relocation is pc-relative then compensation for the PC bias
  (the PC value is 8 bytes ahead of the executing instruction in Arm
  state and 4 bytes in Thumb state) must be encoded in the relocation
  by the object producer."

[1]: https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst

Fixes: 56a974fa2d ("kbuild: make better section mismatch reports on arm")
Fixes: 6e2e340b59 ("ARM: 7324/1: modpost: Fix section warnings for ARM for many compilers")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-11 11:33:38 +02:00
..
basic fixdep: trivial: typo fix and correction 2017-08-10 01:01:03 +09:00
coccinelle fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock 2019-06-11 12:21:51 +02:00
dtc scripts/dtc: dtx_diff: remove broken example from help text 2022-01-27 09:01:01 +01:00
gcc-plugins gcc-plugins: latent_entropy: use /dev/urandom 2022-04-20 09:08:32 +02:00
gdb scripts/gdb: fix debugging modules compiled with hot/cold partitioning 2019-12-05 15:37:04 +01:00
genksyms License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kconfig kconfig: display recursive dependency resolution hint just once 2022-12-08 11:16:30 +01:00
ksymoops Fix dead URLs to ftp.kernel.org 2017-03-28 16:16:52 +02:00
mod modpost: fix section mismatch message for R_ARM_{PC24,CALL,JUMP24} 2023-08-11 11:33:38 +02:00
package builddeb: Fix header package regarding dtc source links 2018-05-30 07:52:21 +02:00
selinux selinux: use "grep -E" instead of "egrep" 2022-10-26 13:16:58 +02:00
tracing scripts/tracing: fix the bug that can't parse raw_trace_func 2021-08-15 13:03:31 +02:00
.gitignore Docs: clean up some DocBook loose ends 2017-06-23 14:17:38 -06:00
Kbuild.include kbuild: improve cc-option to clean up all temporary files 2020-06-30 15:38:06 -04:00
Lindent License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile scripts: set proper OpenSSL include dir also for sign-file 2021-03-07 11:27:41 +01:00
Makefile.asm-generic License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile.build tracing: Avoid calling cc-option -mrecord-mcount for every Makefile 2021-02-23 14:00:33 +01:00
Makefile.clean License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile.dtbinst License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile.extrawarn Makefile.extrawarn: Move -Wcast-function-type-strict to W=1 2022-10-26 13:16:51 +02:00
Makefile.gcc-plugins License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile.headersinst License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile.help
Makefile.host License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile.kasan kasan: rework Kconfig settings 2018-02-16 20:23:04 +01:00
Makefile.lib kbuild: Handle builtin dtb file names containing hyphens 2018-03-15 10:54:33 +01:00
Makefile.modbuiltin License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile.modinst License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile.modpost kbuild: Fix include path in scripts/Makefile.modpost 2022-09-05 10:25:06 +02:00
Makefile.modsign License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile.ubsan License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
adjust_autoksyms.sh kbuild: make scripts/adjust_autoksyms.sh robust against timestamp races 2018-05-30 07:52:17 +02:00
asn1_compiler.c ASN.1: Fix check for strdup() success 2023-04-26 11:18:58 +02:00
bloat-o-meter scripts: switch explicitly to Python 3 2021-06-03 08:36:11 +02:00
bootgraph.pl scripts: Switch to more portable Perl shebang 2017-05-14 11:20:44 +09:00
check_00index.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
check_extable.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
checkincludes.pl License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
checkkconfigsymbols.py checkkconfigsymbols.py: support Kconfig's 'imply' statement 2017-02-03 11:49:06 +01:00
checkpatch.pl checkpatch: fix unescaped left brace 2020-12-29 13:47:02 +01:00
checkstack.pl scripts/checkstack.pl: Fix arm64 wrong or unknown architecture 2019-06-25 11:36:53 +08:00
checksyscalls.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
checkversion.pl License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cleanfile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cleanpatch License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
coccicheck coccinelle: fix parallel build with CHECK=scripts/coccicheck 2017-12-14 09:53:06 +01:00
config tweewide: Fix most Shebang lines 2021-06-03 08:36:11 +02:00
conmakehash.c
const_structs.checkpatch const_structs.checkpatch: add frequently used from Julia Lawall's list 2016-10-11 15:06:30 -07:00
decode_stacktrace.sh scripts/decode_stacktrace: strip basepath from all paths 2020-07-29 07:42:54 +02:00
decodecode scripts/decodecode: fix trapping instruction formatting 2020-05-20 08:17:01 +02:00
depmod.sh depmod: handle the case of /sbin/depmod without /sbin in PATH 2021-01-12 20:09:06 +01:00
diffconfig scripts: switch explicitly to Python 3 2021-06-03 08:36:11 +02:00
export_report.pl scripts: Switch to more portable Perl shebang 2017-05-14 11:20:44 +09:00
extract-cert.c cert host tools: Stop complaining about deprecated OpenSSL functions 2022-11-25 17:36:47 +01:00
extract-ikconfig
extract-module-sig.pl License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
extract-sys-certs.pl License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
extract-vmlinux
extract_xc3028.pl scripts: Switch to more portable Perl shebang 2017-05-14 11:20:44 +09:00
faddr2line scripts/faddr2line: fix CROSS_COMPILE unset error 2018-02-07 11:12:17 -08:00
gcc-goto.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gcc-ld License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gcc-plugin.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gcc-version.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gcc-x86_32-has-stack-protector.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gcc-x86_64-has-stack-protector.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gen_initramfs_list.sh Kbuild misc updates for 4.13 2017-07-07 15:09:09 -07:00
get_dvb_firmware scripts: Switch to more portable Perl shebang 2017-05-14 11:20:44 +09:00
get_maintainer.pl get_maintainer: Prepare for separate MAINTAINERS files 2017-08-08 11:09:31 -07:00
gfp-translate
headerdep.pl License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
headers.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
headers_check.pl License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
headers_install.sh linux/compiler.h: Split into compiler.h and compiler_types.h 2017-12-25 14:26:33 +01:00
insert-sys-cert.c
kallsyms.c scripts/kallsyms: fix definitely-lost memory leak 2020-01-04 13:59:51 +01:00
kernel-doc scripts/kernel-doc: Don't fail with status != 0 if error encountered with -none 2018-02-25 11:07:58 +01:00
ld-version.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
leaking_addresses.pl leaking_addresses: Always print a trailing newline 2021-11-26 11:40:28 +01:00
link-vmlinux.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
makelst License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
markup_oops.pl scripts: Switch to more portable Perl shebang 2017-05-14 11:20:44 +09:00
mkcompile_h kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set 2021-07-28 11:12:15 +02:00
mkmakefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mksysmap mksysmap: Fix the mismatch of 'L0' symbols in System.map 2022-09-28 10:56:49 +02:00
mkuboot.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
module-common.lds module: set .init_array alignment to 8 2017-03-13 09:40:28 -07:00
namespace.pl namespace: fix namespace.pl script to support relative paths 2019-10-29 09:16:59 +01:00
objdiff scripts: objdiff: Ignore debug info when comparing 2017-03-11 11:13:38 +09:00
parse-maintainers.pl parse-maintainers: Mark as executable 2020-04-02 16:34:15 +02:00
patch-kernel License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pnmtologo.c
profile2linkerlist.pl License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
prune-kernel License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
recordmcount.c recordmcount: Fix memory leaks in the uwrite function 2023-05-30 12:38:36 +01:00
recordmcount.h recordmcount: Fix spurious mcount entries on powerpc 2019-07-31 07:28:53 +02:00
recordmcount.pl recordmcount.pl: fix typo in s390 mcount regex 2022-01-05 12:33:48 +01:00
setlocalversion scripts/setlocalversion: make git describe output more reliable 2020-11-05 11:06:51 +01:00
show_delta tweewide: Fix most Shebang lines 2021-06-03 08:36:11 +02:00
sign-file.c cert host tools: Stop complaining about deprecated OpenSSL functions 2022-11-25 17:36:47 +01:00
sortextable.c powerpc: Build-time sort the exception table 2016-11-14 11:11:51 +11:00
sortextable.h
spelling.txt scripts/spelling.txt: add more spelling mistakes to spelling.txt 2017-10-03 17:54:23 -07:00
sphinx-pre-install tweewide: Fix most Shebang lines 2021-06-03 08:36:11 +02:00
stackdelta License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stackusage License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tags.sh scripts/tags.sh: Resolve gtags empty index generation 2023-08-11 11:33:32 +02:00
unifdef.c unifdef: use memcpy instead of strncpy 2018-12-08 13:03:35 +01:00
ver_linux License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xen-hypercalls.sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xz_wrap.sh