I have a problem I need help with. I am currently trying to write a program to read out the address of a section I created.
add.c:
#include <stdio.h>
extern unsigned char arduino_handler_size[];
int main(){
printf("section `.arduino_handler` starts at %p and the 1st byte is %x\n",
arduino_handler_size, (unsigned int)arduino_handler_size[0]);
return 0;
}
arduino_handler.ld:
OUTPUT_FORMAT(elf64-x86-64)
ENTRY(main)
OUTPUT(Test)
SECTIONS
{
.text : { *(.text) }
. = ALIGN(0x1000);
.data : { *(.data) }
. = ALIGN(0x10000);
.bss : { *(.bss)}
. = ALIGN(0X10000);
.arduino_handler :
{
arduino_handler_size = 0x10;
arduino_handler_start = .;
. = . + arduino_handler_size;
arduino_handler_end = .;
}
}
When I run gcc -T arduino_handler.ld -N add.c
I get the error:
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
I am working on: Ubuntu 18.04.3 LTS Kernel: 5.0.0-37-generic x86_64 bits: 64
I have tried changing the gcc version from 7 to 4.8 and back to 8. That sadly doesn't help. The symbolic link for libgcc_s is not broken, but it still gives me an error.
How can I fix this?