261 questions
0
votes
2
answers
151
views
GCC Output Symbol not Relocatable with -fPIC
On an Ubuntu 24.04, using the default GCC-13.2 compiler I compiled
a source file with -fPIC option to produce relocatable binary:
/usr/bin/c++ -v -DBPFTIME_BUILD_WITH_LIBBPF=1 -DSPDLOG_COMPILED_LIB
-...
0
votes
0
answers
34
views
Cortex M4/M7 linker script section placement
i'm working with an NXP RT1052 MCU that loads code from Flash into SDRAM and executes it there.
My application uses FreeRTOS+TCP and i'd like to place the network code inside the ITC SRAM.
The kernel ...
0
votes
0
answers
44
views
How exactly do linkers find the symbol of a R_RISCV_PCREL_HI20I relocation, given a R_RISCV_PCREL_LO12 relocation?
This is a followup question to What do %pcrel_hi and %pcrel_lo actually do?. I'm writing a simple Risc-V linker, and I'm trying to understand how, given an R_RISCV_PCREL_LO12I relocation, the symbol ...
2
votes
1
answer
48
views
Use symbol address to generate page table entry
I am working on writing a static paging setup for a custom bare-metal ARM system. ARMv7a uses two-level paging, where entries in a top-level page table can point to a second-level table. I have a top-...
0
votes
0
answers
39
views
Emit static with relocation of type `R_MIPS_16`
I'm currently compiling some rust code against the mipsel-sony-psx target, which has 32-bit pointers. I have two statics that I need to emit with a specific size (4 bytes and 2 bytes, respectively):
...
0
votes
1
answer
64
views
Analyzing Relocations in ARM for cortex-m4
I'm trying to understand how to correctly read the relocation entries generated by my ARM compiler (I'm using (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408 (release)).
To my ...
0
votes
0
answers
18
views
Code addresses in DWARF v1 should be relocated but aren't
I'm looking at an ELF file built for MIPS targeting (I think) PlayStation. It has DWARFv1 debug info. The ELF type is ET_EXEC. There are two segments defined in the program header table, with p_vaddr ...
2
votes
0
answers
87
views
relative address instead of absolute address in the relocation table
In the context of compiler optimization and linker behavior, I'm trying to understand the implications of using relative addresses instead of absolute addresses in the relocation table during the ...
-1
votes
2
answers
77
views
How to str_detect a pattern in the pipe to relocate columns
I am struggling to relocate the descriptive statistics columns close to the original columns
iris2 <- iris %>% dplyr::select(c(2:4)) %>% dplyr::mutate(across(.cols = where(is.numeric), .fns = ...
0
votes
0
answers
14
views
Managing Relocation Order Dependencies in ELF Shared Libraries [duplicate]
When you link an application let's call it main_program with a shared library message_library on a Linux device, there's a scenario to consider. This shared library contains a global variable message ...
18
votes
1
answer
2k
views
Where is the order in which ELF relocations are applied specified?
Consider the following two files on a Linux system:
use_message.cpp
#include <iostream>
extern const char* message;
void print_message();
int main() {
std::cout << message << '\...
3
votes
0
answers
90
views
Different behaviour of multiple ELF relocations on i386 and x86-64
Per the System V gABI,
If multiple consecutive relocation records are applied to the same relocation location (r_offset), they are composed instead of being applied independently, as described above. ...
3
votes
1
answer
130
views
Handling DWARF-5 relocations in a custom ELF loader
I'm building a custom ELF object loader which resolves the library dependencies (DT_NEEDED) and recursively loads those, performs relocations and symbol resolution, calls preinit, etc. ld.so is ...
1
vote
0
answers
201
views
How to resolve Duplicate class error with relocation e/ou shadow?
I'm writing a react-native package. This package has two libraries added manually. As you can see from the error, both implement the package com.realsil.sdk.*
I can't contact the library developer to ...
1
vote
0
answers
89
views
Why compiler point to global variable using [rip+0x00]
I am new to compiler, and I am trying to understand why the compiler emit this code. I have this very simple C code
// main.c
int b = 7;
int main(){
int a = 5 + b;
return 0;
}
I compiled ...