[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/28986] New: RISC-V Binutils Lacks Support for ELF symbol t
From: |
john.leidel at gmail dot com |
Subject: |
[Bug binutils/28986] New: RISC-V Binutils Lacks Support for ELF symbol table reloc info |
Date: |
Mon, 21 Mar 2022 15:50:36 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=28986
Bug ID: 28986
Summary: RISC-V Binutils Lacks Support for ELF symbol table
reloc info
Product: binutils
Version: 2.37
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: john.leidel at gmail dot com
Target Milestone: ---
Created attachment 14030
--> https://sourceware.org/bugzilla/attachment.cgi?id=14030&action=edit
driver.c, patchlib.c, makefile and run script for the bug
Tested platforms:
RISC-V RV64G Binutils 2.36.1 & 2.37; Ubuntu 21.04 & 21.10, respectively.
Platform: SiFive HiFive Unmatched
We are porting a parallel runtime library that requires us to provide support
for "patching" existing system functions such as mmap/munmap/etc with
user-defined functions. The process of which requires that we dlopen a new
library, walks its symbol table, gather info on each symbol, then reloc the new
functions into the existing runtime environment. This process requires that we
use the r_info indices into the PTR in order to lookup all the provided
functionality from a shared library. It appears that this information is not
currently implemented for the RISC-V target. RISC-V contains the necessary
macros in libdl that provide the DT_JMPREL and DT_PLTRELSZ references.
However, attempted to access the contents of each DT_PLTRELSZ index causes a
segmentation as these appear to not be implemented currently.
The attached bug and associated makefile provide two source files. The
"driver.c" is the actual code that attempts to dlopen and patch an existing
function. The patchlib.c provides a sample function (patch_calloc) that should
patch the existing `calloc` function call. The attached tgz includes both
files, a makefile and a run script. The lack of the r_info struct being
implemented induces a segmentation fault in the program as follows:
$> gdb ./a.out
(gdb) r ./libpatchlib.so patch_calloc
0x0000002aaaaaacbe in visit_symbols (inf=0x0, dlpi_addr=183251935232,
table=0x8a0, table_size=456,
strtab=0x568, symtab=0x2c8, dl_name=0x3fffffc878 "(anonymous dl @
0x2aaaaaa000)") at driver.c:87
87 elf_sym = (char*)strtab +
symtab[ELF64_R_SYM(reloc->r_info)].st_name;
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/28986] New: RISC-V Binutils Lacks Support for ELF symbol table reloc info,
john.leidel at gmail dot com <=