Bug 231887 - kldxref reports 'Bad address' for mips64el modules
Summary: kldxref reports 'Bad address' for mips64el modules
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: mips Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
Depends on:
Reported: 2018-10-02 21:03 UTC by Ed Maste
Modified: 2018-10-13 00:12 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2018-10-02 21:03:14 UTC
After the objcopy fix in r339083 (PR 231790) I can kldload modules on mips64el, but kldxref when it runs reports:

root@:~ # kldxref -v /boot/kernel/ 
kldxref: ef_obj_seg_read_string(/boot/kernel/accf_data.ko): bad offset (948200f2)
kldxref: error while reading /boot/kernel/accf_data.ko: Bad address
kldxref: ef_obj_seg_read_string(/boot/kernel/accf_dns.ko): bad offset (8c8201e0)
kldxref: error while reading /boot/kernel/accf_dns.ko: Bad address
kldxref: ef_obj_seg_read_string(/boot/kernel/accf_http.ko): bad offset (3e00008)
kldxref: error while reading /boot/kernel/accf_http.ko: Bad address
kldxref: ef_obj_seg_read_string(/boot/kernel/acl_nfs4.ko): bad offset (8c8300042402ffff)

root@:~ # readelf -x set_modmetadata_set /boot/kernel/accf_data.ko

Hex dump of section 'set_modmetadata_set':
  0x00000000 00000000 00000000 00000000 00000000 ................

root@:~ # readelf -r /boot/kernel/accf_data.ko | grep -A 8 set_modmeta
Relocation section with addend (.relaset_modmetadata_set):
r_offset     r_info       r_type              st_value         st_name + r_addend
000000000000 000300000012 R_MIPS_64           0000000000000000 .data + 18
                   Type2: R_MIPS_NONE
                   Type3: R_MIPS_NONE
000000000008 000300000012 R_MIPS_64           0000000000000000 .data + 30
                   Type2: R_MIPS_NONE
                   Type3: R_MIPS_NONE

root@:~ # readelf -S /boot/kernel/accf_data.ko
There are 19 section headers, starting at offset 0x880:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 6] .data             PROGBITS         0000000000000000  000000e0
       00000000000000a0  0000000000000000  WA       0     0     16
Comment 1 Ed Maste freebsd_committer 2018-10-02 21:06:26 UTC
I see no ef_mips.c in usr.sbin/kldxref; it appears kldxref is just unable to process relocations on mips.
Comment 2 Ed Maste freebsd_committer 2018-10-13 00:12:26 UTC
See r339242 which added RISC-V support; a similar change is needed for MIPS.