Bug 271849 - Ld.elf.so.1 /usr/local/lib/libc.so.6 : Unsupported relocation type 160 in non-PLT relocations
Summary: Ld.elf.so.1 /usr/local/lib/libc.so.6 : Unsupported relocation type 160 in non...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: 12.4-STABLE
Hardware: arm Any
: --- Affects Only Me
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-05 19:04 UTC by Praveen Khurjek
Modified: 2023-06-19 10:53 UTC (History)
2 users (show)

See Also:


Attachments
Libc.so.6 relocations (64.48 KB, text/plain)
2023-06-05 19:04 UTC, Praveen Khurjek
no flags Details
libc.so.6 (929.71 KB, application/x-troff-man)
2023-06-07 20:38 UTC, Praveen Khurjek
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Praveen Khurjek 2023-06-05 19:04:17 UTC
Created attachment 242623 [details]
Libc.so.6 relocations

Binary ldd

atest.noprelink:
	ld-linux-armhf.so.3 (0x20129000)
	libfwlib32.so.1 => /usr/lib/libfwlib32.so.1 (0x20153000)
	libthr.so.3 => /lib/libthr.so.3 (0x20236000)
	libc.so.7 => /lib/libc.so.7 (0x2028e000)
	libstdc++.so.6 => /usr/local/lib/gcc11/libstdc++.so.6 (0x20500000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x20461000)
	libc.so.6 => /usr/local/lib/libc.so.6 (0x206ad000)
	libm.so.5 => /lib/libm.so.5 (0x20498000)

Attached is relocations of libc.so.6. possibly due to R_ARM_TLS_TPOFF32 errno relocation in libc.so.6
Comment 1 Praveen Khurjek 2023-06-06 03:52:52 UTC
FreeBSD Clang version 13.0.0

Cannot attach binary due to file size restriction.
Comment 2 Ed Maste freebsd_committer freebsd_triage 2023-06-06 18:44:56 UTC
/usr/local/lib/libc.so.6 is not provided by FreeBSD 12.4; I assume it is from a compat package. Can you add details of what provided it?
Comment 3 Praveen Khurjek 2023-06-07 20:38:17 UTC
Created attachment 242668 [details]
libc.so.6

have used the libc.so.6 from the Linux Beaglebone Black Rev C board. For Freebsd only 12xcompat library compiles and it does not provide libc.so.6 for the same.

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 03 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            GNU
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x17679
  Start of program headers:          52 (bytes into file)
  Start of section headers:          949188 (bytes into file)
  Flags:                             0x5000400, Version5 EABI, VFP
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         10
  Size of section headers:           40 (bytes)
  Number of section headers:         71
  Section header string table index: 70
Comment 4 Praveen Khurjek 2023-06-10 22:56:17 UTC
the libfwlib32.so.1 is also a  linux shared lib. Though the ABI is NONE for the armv7 linux shared lib.

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            NONE
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0xc390
  Start of program headers:          52 (bytes into file)
  Start of section headers:          895124 (bytes into file)
  Flags:                             0x5000002, Version5 EABI, has entry point
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         7
  Size of section headers:           40 (bytes)
  Number of section headers:         30
  Section header string table index: 27


though not running a linux binary , but using a linux shared lib libc.so.6 with GNU ABI, have not taken the below steps.

https://docs.freebsd.org/en/books/handbook/linuxemu/
Comment 5 Andrew Turner freebsd_committer freebsd_triage 2023-06-14 14:49:03 UTC
Are you trying to use both Linux and FreeBSD libraries with the same program? If so that is unlikely to work as they may not share a common ABI, e.g. structures may be different, function arguments may not be shared on all functions, and system call numbers are different.
Comment 6 Praveen Khurjek 2023-06-17 09:22:08 UTC
I used the same library for Linux and FreeBSD , and the ABI for the library is NONE if you check comment 4. 

I will have to use linux emulation for linux library on FreeBSD. I don't have the hardware with me right now , will report back in few days.
Comment 7 Praveen Khurjek 2023-06-17 09:33:43 UTC
does NONE equate to Intel Binary Compatibility Standard (iBCS). is iBCS supported by FreeBSD ?
Comment 8 Andrew Turner freebsd_committer freebsd_triage 2023-06-19 10:53:19 UTC
NONE means it follows the appropriate ABI as defined in https://github.com/ARM-software/abi-aa/. Cross-OS libraries are likely to be difficult to get working as there are too many things outside the ABI document that need to be handled.

On 32-bit arm FreeBSD doesn't support ifuncs that the R_ARM_IRELATIVE (=160) relocation is for.

It looks like FreeBSD doesn't have 32-bit arm Linux compat on either arm or arm64.