system-clang (elfv2) and devel/binutil@powerpc (32-bit): booting fail very early on PowerMac3,6 example ; also build problem why I tried this

Mark Millard via freebsd-ppc <[email protected]>
Newsgroups gmane.os.freebsd.devel.ppc,gmane.os.freebsd.devel.toolchain
Message-ID <[email protected]>
(There are later notes below with build failure
information that lead me to try devel/binutils@powerpc .)

Because of the (cross-)build failure (from amd64):

--- acl_nfs4.ko.full ---
ld: acl_nfs4.kld(.text+0x234): R_PPC_PLTREL24 reloc against local symbol
acl_nfs4.kld: could not read symbols: Bad value
*** [acl_nfs4.ko.full] Error code 1

when using the default ld for 32-bit powerpc, I
tried using devel/binutil@powerpc for which
buildworld buildkernel at least ran to completion.
The build was of a non-debug kernel (and world),
but with symbols.

But the result failed to boot, stopping very early:
(typed from a image)

. . .
Booted from: /pci@f4000000/ata-6@d/disk@0

Loading /boot/defaults/loader.conf
/boot/kernel/kernel data=0xd97874+0x2ebdd4 syms=[0x4+0x97740+0x4+0xc34d2]

Invalid memory access at   %SRR0: 04C00000   %SRR1: c0000000

Apple PowerMac3,6 4.6.0f1 BootROM built on 02/20/03 at 13:52:27
. . .




As for the build failure . . .


# Meta data file /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/acl_nfs4/acl_nfs4.kld.meta
CMD ld -m elf32ppc_fbsd --secure-plt -d -warn-common  -r -d  -o acl_nfs4.kld subr_acl_nfs4.o
CMD ctfmerge -L VERSION -g -o acl_nfs4.kld subr_acl_nfs4.o
CMD :> export_syms
CMD awk -f /usr/src/sys/conf/kmod_syms.awk acl_nfs4.kld  export_syms | xargs -J% objcopy % acl_nfs4.kld
CWD /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/sys/GENERICvtsc-NODBG/modules/usr/src/sys/modules/acl_nfs4
TARGET acl_nfs4.kld
. . .



From readelf -a for the subr_acl_nfs4.o :
(acl_nfs4_sync_mode_from_acl is GLOBAL here)

. . .
Relocation section with addend (.rela.text):
r_offset r_info   r_type              st_value st_name + r_addend
00000076 000014fc <unknown: 0xfc>     00000000 .got2 + 8022
0000007a 000014fa <unknown: 0xfa>     00000000 .got2 + 8026
000001ac 00003112 R_PPC_PLTREL24      00000000 groupmember + 8000
00000234 00003012 R_PPC_PLTREL24      00000458 acl_nfs4_sync_mode_from_acl + 8000
000002c4 00003312 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
000002f4 00003312 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
0000032c 00003312 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
00000360 00003312 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
0000038c 00003312 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
000007c6 000014fc <unknown: 0xfc>     00000000 .got2 + 800a
000007ca 000014fa <unknown: 0xfa>     00000000 .got2 + 800e
00001026 000014fc <unknown: 0xfc>     00000000 .got2 + 8006
0000102a 000014fa <unknown: 0xfa>     00000000 .got2 + 800a
00001676 000014fc <unknown: 0xfc>     00000000 .got2 + 800a
0000167a 000014fa <unknown: 0xfa>     00000000 .got2 + 800e
00001698 00002a12 R_PPC_PLTREL24      00000000 acl_alloc + 8000
000016a8 00003012 R_PPC_PLTREL24      00000458 acl_nfs4_sync_mode_from_acl + 8000
00001748 00002b12 R_PPC_PLTREL24      00000000 acl_free + 8000
000017e8 00002b12 R_PPC_PLTREL24      00000000 acl_free + 8000
0000183a 000014fc <unknown: 0xfc>     00000000 .got2 + 800a
0000183e 000014fa <unknown: 0xfa>     00000000 .got2 + 800e
. . .
Relocation section with addend (.rela.text):
r_offset r_info   r_type              st_value st_name + r_addend
. . .
    47: 00000000000007a0   128 FUNC    GLOBAL DEFAULT    2 acl_nfs4_sync_acl_from_mode
    48: 0000000000000458   840 FUNC    GLOBAL DEFAULT    2 acl_nfs4_sync_mode_from_acl
    49: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND groupmember
. . .


But after:

CMD ld -m elf32ppc_fbsd --secure-plt -d -warn-common  -r -d  -o acl_nfs4.kld subr_acl_nfs4.o
CMD ctfmerge -L VERSION -g -o acl_nfs4.kld subr_acl_nfs4.o
CMD :> export_syms
CMD awk -f /usr/src/sys/conf/kmod_syms.awk acl_nfs4.kld  export_syms | xargs -J% objcopy % acl_nfs4.kld

From readelf -a for the acl_nfs4.kld :
(acl_nfs4_sync_mode_from_acl is LOCAL here)

. . .
Relocation section with addend (.rela.text):
r_offset r_info   r_type              st_value st_name + r_addend
. . .
00000076 000004fc <unknown: 0xfc>     00000000 .got2 + 8022
0000007a 000004fa <unknown: 0xfa>     00000000 .got2 + 8026
000001ac 00003012 R_PPC_PLTREL24      00000000 groupmember + 8000
00000234 00002c12 R_PPC_PLTREL24      00000458 acl_nfs4_sync_mode_from_acl + 8000
000002c4 00003212 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
000002f4 00003212 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
0000032c 00003212 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
00000360 00003212 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
0000038c 00003212 R_PPC_PLTREL24      00000000 priv_check_cred + 8000
000007c6 000004fc <unknown: 0xfc>     00000000 .got2 + 800a
000007ca 000004fa <unknown: 0xfa>     00000000 .got2 + 800e
00001026 000004fc <unknown: 0xfc>     00000000 .got2 + 8006
0000102a 000004fa <unknown: 0xfa>     00000000 .got2 + 800a
00001676 000004fc <unknown: 0xfc>     00000000 .got2 + 800a
0000167a 000004fa <unknown: 0xfa>     00000000 .got2 + 800e
00001698 00003c12 R_PPC_PLTREL24      00000000 acl_alloc + 8000
000016a8 00002c12 R_PPC_PLTREL24      00000458 acl_nfs4_sync_mode_from_acl + 8000
00001748 00003912 R_PPC_PLTREL24      00000000 acl_free + 8000
000017e8 00003912 R_PPC_PLTREL24      00000000 acl_free + 8000
0000183a 000004fc <unknown: 0xfc>     00000000 .got2 + 800a
0000183e 000004fa <unknown: 0xfa>     00000000 .got2 + 800e
. . .

Symbol table (.symtab) contains 62 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
. . .
    43: 0000000000000000  1112 FUNC    LOCAL  DEFAULT    1 vaccess_acl_nfs4
    44: 0000000000000458   840 FUNC    LOCAL  DEFAULT    1 acl_nfs4_sync_mode_from_acl
    45: 000000000000181c   248 FUNC    LOCAL  DEFAULT    1 acl_nfs4_check

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

_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.