section mismatch test doesn't work reliably on arm64

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Fri Sep 29 01:15:40 PDT 2023


Hello,

by manual inspection I found a section mismatch in
drivers/hwtracing/coresight/coresight-etm4x-core.c where
etm4_platform_driver (which lives in ".data") contains a reference to
etm4_remove_platform_dev() (which lives in ".exit.text").

However building with CONFIG_DEBUG_SECTION_MISMATCH=y +
CONFIG_CORESIGHT_SOURCE_ETM4X=y doesn't warn about that one.

	$ objdump -Dr drivers/hwtracing/coresight/coresight-etm4x-core.o | grep -A7 etm4_platform_driver
	0000000000000158 <etm4_platform_driver>:
		...
				158: R_AARCH64_ABS64	.text+0x2524
				160: R_AARCH64_ABS64	.exit.text+0x124
				188: R_AARCH64_ABS64	.rodata.str1.8+0x2e0
	 1a8:	00000001 	udf	#1
		...
				1b0: R_AARCH64_ABS64	.rodata+0x2ae8

A similar issue in the same file is etm4x_amba_driver referencing
etm4_remove_amba().

I guess the problem is that the information about the reference is only
stored in the relocation entry?! I shortly looked at modpost.c, but I
don't know enough about elf and that code to fix that.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230929/e79a5f71/attachment.sig>


More information about the linux-arm-kernel mailing list