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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!