Re: [BUG mips llvm] MIPS: malformed R_MIPS_{HI16,LO16} with LLVM

From: Nick Desaulniers
Date: Tue Jan 12 2021 - 17:17:33 EST


On Mon, Jan 11, 2021 at 12:50 PM Alexander Lobakin <alobakin@xxxxx> wrote:
>
> > The disassembly for me produces:
> > 399c: 3c 03 00 00 lui $3, 0 <phy_device_free>
> > 0000399c: R_MIPS_HI16 .text
> > ...
> > 39a8: 24 63 3a 5c addiu $3, $3, 14940 <phy_probe>
> > 000039a8: R_MIPS_LO16 .text
>
> So, in your case the values of the instructions that relocs refer are:
>
> 0x3c030000 R_MIPS_HI16
> 0x24633a5c R_MIPS_LO16
>
> Mine were:
>
> 0x3c010000
> 0x24339444
>
> Your second one doesn't have bit 15 set, so I think this pair won't
> break the code.
> Try to hunt for R_MIPS_LO16 that have this bit set, i.e. they have
> '8', '9', 'a', 'b', 'c', 'd' or 'e' as their [15:12].

I don't think any of my R_MIPS_LO16 in that file have that bit set.
See attached.
--
Thanks,
~Nick Desaulniers
0000004c: R_MIPS_LO16 kmalloc_caches
00000088: R_MIPS_LO16 .data
00000098: R_MIPS_LO16 .data
0000010c: R_MIPS_LO16 kmalloc_caches
00000130: R_MIPS_LO16 $.str
0000014c: R_MIPS_LO16 .data
0000015c: R_MIPS_LO16 .data
000001c4: R_MIPS_LO16 kmalloc_caches
00000204: R_MIPS_LO16 .data
00000214: R_MIPS_LO16 .data
00000290: R_MIPS_LO16 .data
000002a0: R_MIPS_LO16 .data
000002a4: R_MIPS_LO16 .data
00000384: R_MIPS_LO16 .data
00000394: R_MIPS_LO16 .data
00000398: R_MIPS_LO16 .data
000003ac: R_MIPS_LO16 $.str
00000474: R_MIPS_LO16 .data
00000484: R_MIPS_LO16 .data
00000488: R_MIPS_LO16 .data
0000055c: R_MIPS_LO16 kmalloc_caches
00000588: R_MIPS_LO16 mdio_bus_type
000005a4: R_MIPS_LO16 .text
000005a8: R_MIPS_LO16 .text
000005ac: R_MIPS_LO16 .text
000005b4: R_MIPS_LO16 .rodata
00000638: R_MIPS_LO16 $.str.1
0000065c: R_MIPS_LO16 $.str.2
00000664: R_MIPS_LO16 .sbss
00000684: R_MIPS_LO16 delayed_work_timer_fn
00000688: R_MIPS_LO16 phy_state_machine
00000998: R_MIPS_LO16 $.str.62
000009f8: R_MIPS_LO16 $.str.63
00000a50: R_MIPS_LO16 __stack_chk_guard
00000d84: R_MIPS_LO16 __stack_chk_guard
00000e3c: R_MIPS_LO16 $.str.3
00000e4c: R_MIPS_LO16 $.str.4
00000ea4: R_MIPS_LO16 .data
00000eb4: R_MIPS_LO16 .data
00000eb8: R_MIPS_LO16 .data
00000ed0: R_MIPS_LO16 $.str
00001164: R_MIPS_LO16 .text
000011ac: R_MIPS_LO16 $.str.19
000011c8: R_MIPS_LO16 $.str.18
000011f4: R_MIPS_LO16 genphy_c45_driver
000011fc: R_MIPS_LO16 .data
00001280: R_MIPS_LO16 .data
000013e4: R_MIPS_LO16 $.str.15
00001404: R_MIPS_LO16 $.str.16
00001444: R_MIPS_LO16 $.str.14
0000145c: R_MIPS_LO16 $.str.17
00001478: R_MIPS_LO16 $.str.64
000014c0: R_MIPS_LO16 mdio_bus_type
000014c8: R_MIPS_LO16 device_match_name
00001568: R_MIPS_LO16 $.str.5
000015f4: R_MIPS_LO16 __stack_chk_guard
00001624: R_MIPS_LO16 $.str.18
0000162c: R_MIPS_LO16 $.str.19
00001648: R_MIPS_LO16 .data
00001660: R_MIPS_LO16 .rodata
00001668: R_MIPS_LO16 .rodata
0000170c: R_MIPS_LO16 .data
0000173c: R_MIPS_LO16 genphy_c45_driver
00001794: R_MIPS_LO16 __stack_chk_guard
00001900: R_MIPS_LO16 __stack_chk_guard
00001930: R_MIPS_LO16 $.str.7
0000193c: R_MIPS_LO16 $.str.6
00001944: R_MIPS_LO16 $.str.8
0000195c: R_MIPS_LO16 $.str.9
00001984: R_MIPS_LO16 $.str.10
0000198c: R_MIPS_LO16 $.str.11
00001998: R_MIPS_LO16 $.str.12
000019b0: R_MIPS_LO16 __stack_chk_guard
00001a10: R_MIPS_LO16 __stack_chk_guard
00001a1c: R_MIPS_LO16 $.str.10
00001a24: R_MIPS_LO16 $.str.11
00001a50: R_MIPS_LO16 $.str.7
00001a5c: R_MIPS_LO16 $.str.6
00001a64: R_MIPS_LO16 $.str.8
00001a80: R_MIPS_LO16 $.str.9
00001ab0: R_MIPS_LO16 $.str.12
00001ae0: R_MIPS_LO16 $.str.13
00001b0c: R_MIPS_LO16 __stack_chk_guard
00001b5c: R_MIPS_LO16 __stack_chk_guard
00001b88: R_MIPS_LO16 $.str.7
00001b94: R_MIPS_LO16 $.str.6
00001b9c: R_MIPS_LO16 $.str.8
00001bb4: R_MIPS_LO16 $.str.9
00001bc4: R_MIPS_LO16 __stack_chk_guard
00001d60: R_MIPS_LO16 mdio_bus_type
00001d68: R_MIPS_LO16 device_match_name
00001dec: R_MIPS_LO16 $.str.5
00001e34: R_MIPS_LO16 .data
00001e90: R_MIPS_LO16 genphy_c45_driver
00001f70: R_MIPS_LO16 kmalloc_caches
000020dc: R_MIPS_LO16 .text
00002218: R_MIPS_LO16 __stack_chk_guard
00002224: R_MIPS_LO16 .rodata
00002248: R_MIPS_LO16 .rodata
000022d0: R_MIPS_LO16 __stack_chk_guard
00002658: R_MIPS_LO16 .rodata
00002870: R_MIPS_LO16 $.str.66
00002c88: R_MIPS_LO16 $.str.21
00002ca0: R_MIPS_LO16 $.str.20
00003218: R_MIPS_LO16 $.str.67
00003220: R_MIPS_LO16 $__func__.phy_poll_reset
000033fc: R_MIPS_LO16 __stack_chk_guard
00003474: R_MIPS_LO16 __stack_chk_guard
000034c0: R_MIPS_LO16 __stack_chk_guard
00003510: R_MIPS_LO16 __stack_chk_guard
00003628: R_MIPS_LO16 __stack_chk_guard
00003688: R_MIPS_LO16 __stack_chk_guard
00003778: R_MIPS_LO16 __stack_chk_guard
00003790: R_MIPS_LO16 $.str.22
000037d0: R_MIPS_LO16 $.str.23
000038c0: R_MIPS_LO16 __stack_chk_guard
00003904: R_MIPS_LO16 $.str.24
00003920: R_MIPS_LO16 $.str.25
00003938: R_MIPS_LO16 __stack_chk_guard
000039a4: R_MIPS_LO16 mdio_bus_type
000039a8: R_MIPS_LO16 .text
000039ac: R_MIPS_LO16 .text
000039b0: R_MIPS_LO16 .text
00003a18: R_MIPS_LO16 $.str.28
00003a30: R_MIPS_LO16 $.str.26
00003a50: R_MIPS_LO16 $.str.27
00003a78: R_MIPS_LO16 __stack_chk_guard
00003c84: R_MIPS_LO16 __stack_chk_guard
00003e9c: R_MIPS_LO16 $.str.31
00003ee4: R_MIPS_LO16 .rodata
00003f00: R_MIPS_LO16 $.str.33
00003f08: R_MIPS_LO16 $.str.59
00003f10: R_MIPS_LO16 $.str.34
00003f3c: R_MIPS_LO16 $.str.61
00003f78: R_MIPS_LO16 __stack_chk_guard
00004014: R_MIPS_LO16 .rodata
00004038: R_MIPS_LO16 .rodata
000040ec: R_MIPS_LO16 __stack_chk_guard
000042e8: R_MIPS_LO16 $.str.61
00000010: R_MIPS_LO16 genphy_c45_driver
0000001c: R_MIPS_LO16 .data
00000028: R_MIPS_LO16 .rodata
00000030: R_MIPS_LO16 phy_basic_t1_features
00000044: R_MIPS_LO16 phy_gbit_features
00000048: R_MIPS_LO16 phy_gbit_fibre_features
00000054: R_MIPS_LO16 phy_gbit_all_ports_features
00000060: R_MIPS_LO16 phy_10gbit_features
00000074: R_MIPS_LO16 phy_10gbit_full_features
00000084: R_MIPS_LO16 phy_basic_t1_features
00000090: R_MIPS_LO16 phy_basic_features
00000098: R_MIPS_LO16 phy_basic_features
0000009c: R_MIPS_LO16 phy_basic_t1_features
000000a4: R_MIPS_LO16 phy_gbit_features
000000a8: R_MIPS_LO16 phy_gbit_fibre_features
000000ac: R_MIPS_LO16 phy_gbit_all_ports_features
000000b0: R_MIPS_LO16 phy_10gbit_features
000000b8: R_MIPS_LO16 phy_10gbit_full_features
000000c0: R_MIPS_LO16 phy_10gbit_fec_features
000000cc: R_MIPS_LO16 phy_10gbit_fec_features
000000d4: R_MIPS_LO16 genphy_c45_driver
000000f0: R_MIPS_LO16 .data
00000110: R_MIPS_LO16 genphy_c45_driver