Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jun 2019 16:05:42 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   Re: 32-bit powerpc and powerpc64 kernel relocation types when built via system-clang-8 and devel/powerpc64-binutils: a few R_PPC*_ADDR32 mixed in with the R_PPC*_RELATIVE
Message-ID:  <E4A3D219-4F78-4083-8EA4-D1EF6407580E@yahoo.com>
In-Reply-To: <51FF912A-46FD-49D7-A981-9370FFD0CE75@yahoo.com>
References:  <51FF912A-46FD-49D7-A981-9370FFD0CE75@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On 2019-Jun-2, at 13:25, Mark Millard <marklmi at yahoo.com> wrote:

> I'm not sure if getting a few R_PPC_ADDR32/R_PPC64_ADDR64
> in the kernel is expected or not.
>=20
> This was a amd64 -> powerpc cross build from/for:
>=20
> # uname -apKU
> FreeBSD FBSDFSSD 13.0-CURRENT FreeBSD 13.0-CURRENT #20 r347549M: Fri =
May 31 17:00:45 PDT 2019     =
markmi@FBSDFSSD:/usr/obj/amd64_clang/amd64.amd64/usr/src/amd64.amd64/sys/G=
ENERIC-NODBG  amd64 amd64 1300025 1300025
>=20
> system clang was used for the build but devel/powerpc64-binutils was =
used.
>=20
> # readelf -asW =
/usr/obj/DESTDIRs/clang-powerpc-installkernel_altbinutils/boot/kernel/kern=
el | grep -v R_PPC_RELATIVE | less
> . . .
> Relocation section with addend (.rela.dyn):
> r_offset r_info   r_type              st_value st_name + r_addend
> 00da1744 00275101 R_PPC_ADDR32        00000000 uart_quicc_class + 0
>=20
> Relocation section with addend (.rela.text):
> r_offset r_info   r_type              st_value st_name + r_addend
>=20
> Relocation section with addend (.rela.data):
> r_offset r_info   r_type              st_value st_name + r_addend
>=20
> Relocation section with addend (.rela.got):
> r_offset r_info   r_type              st_value st_name + r_addend
>=20
> Relocation section with addend (.rela.got2):
> r_offset r_info   r_type              st_value st_name + r_addend
> 00e646d0 00117401 R_PPC_ADDR32        00000000 mfs_root_end + 0
> 00e646d4 002d7c01 R_PPC_ADDR32        00000000 mfs_root + 0
> 00e67c94 002b3a01 R_PPC_ADDR32        00000000 =
__stop_set_uart_fdt_class_set + 0
> 00e67c98 00210301 R_PPC_ADDR32        00000000 =
__start_set_uart_fdt_class_set + 0
>=20
> . . .
>=20
>=20
> # readelf -asW =
/usr/obj/DESTDIRs/clang-powerpc64-installkernel_altbinutils/boot/kernel/ke=
rnel | grep -v R_PPC64_RELATIVE | less
> . . .
> Relocation section with addend (.rela.dyn):
> r_offset         r_info           r_type                   st_value    =
     st_name + r_addend
> 000000000130c360 00002d2800000026 R_PPC64_ADDR64           =
0000000000000000 uart_quicc_class + 0
> 0000000001362008 0000143600000026 R_PPC64_ADDR64           =
0000000000000000 mfs_root_end + 0
> 0000000001362010 0000343300000026 R_PPC64_ADDR64           =
0000000000000000 mfs_root + 0
> 0000000001362018 000031a000000026 R_PPC64_ADDR64           =
0000000000000000 __stop_set_uart_fdt_class_set + 0
> 0000000001362020 000025fd00000026 R_PPC64_ADDR64           =
0000000000000000 __start_set_uart_fdt_class_set + 0
>=20
> Relocation section with addend (.rela.text):
> r_offset         r_info           r_type                   st_value    =
     st_name + r_addend
>=20
> Relocation section with addend (.rela.data):
> r_offset         r_info           r_type                   st_value    =
     st_name + r_addend
>=20
> . . .
>=20
> So it is always:
>=20
> uart_quicc_class
> mfs_root_end
> mfs_root
> __stop_set_uart_fdt_class_set
> __start_set_uart_fdt_class_set
>=20
> but the .rela.got2 vs. .rela.dyn status varies for all
> but uart_quicc_class in my context.
>=20

Turns out that the gcc 4.2.1 related toolchain for 32-bit powerpc
produces:

# readelf -asW =
/usr/obj/DESTDIRs/gcc421-powerpc-installkernel/boot/kernel/kernel | grep =
-v R_PPC_RELATIVE | less
. . .
Relocation section with addend (.rela.dyn):
r_offset r_info   r_type              st_value st_name + r_addend

Relocation section with addend (.rela.text):
r_offset r_info   r_type              st_value st_name + r_addend

Relocation section with addend (.rela.data):
r_offset r_info   r_type              st_value st_name + r_addend

Relocation section with addend (.rela.got):
r_offset r_info   r_type              st_value st_name + r_addend

Relocation section with addend (.rela.got2):
r_offset r_info   r_type              st_value st_name + r_addend
00eaf92c 00117401 R_PPC_ADDR32        00000000 mfs_root_end + 0
00eaf930 002d7c01 R_PPC_ADDR32        00000000 mfs_root + 0
00eb28ec 00210401 R_PPC_ADDR32        00000000 =
__start_set_uart_fdt_class_set + 0
00eb28f0 002b3b01 R_PPC_ADDR32        00000000 =
__stop_set_uart_fdt_class_set + 0
00eb2940 00275101 R_PPC_ADDR32        00000000 uart_quicc_class + 0

Relocation section with addend (.rela.sdata):
r_offset r_info   r_type              st_value st_name + r_addend

. . .

So uart_quicc_class varies .rela.dyn vs. .rela.got2 compared to
system-clang with devel/powerpc64-binutils being used to target
32-bit powerpc. But there are still a count of 5 instances of
R_PPC_ADDR32.

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E4A3D219-4F78-4083-8EA4-D1EF6407580E>