Question
1. Given that : A relocation entry is {r.offset = 0xf, r.symbol = sum, r.type = R_X86_64_PC32, r.addend = -4} ADDR(s) = ADDR(.text) = 0x4004d0,
1. Given that :
A relocation entry is {r.offset = 0xf, r.symbol = sum, r.type = R_X86_64_PC32, r.addend = -4}
ADDR(s) = ADDR(.text) = 0x4004d0, and
ADDR(r.symbol) = ADDR(sum) = 0x4004e8.
a. What is the address we want to update (refptr)? b.What is the value we want to update (*refptr)?
2. Suppose that a function string_length with the signature int string_length(char *str) is defined in a shared module ./libstr.so. Write a program that can dynamically load the library during the run-time and call the function string_length with the string hello world and unload the module. Implement the program using the functions below:
void *dlopen(const char *filename, int flag /*RTLD_GLOBAL, RTLD_NOW, RTLD_LAZY*/);
void *dlsym(void *handle, char *symbol);
int dlclose(void *handle); ? const char *dlerror(void);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started