I'd like to check the library under investigation what flags and options were built with?
I'm trying to use gcc compiler with option -frecord-gcc-switches
to understand on my simple shared library but with no luck.
The following is the piece of code that form a shared library :
#include "shared.h"
unsigned int add(unsigned int a, unsigned int b)
{
printf("\n Inside add()\n");
return (a+b);
}
shared.h looks like :
#include<stdio.h>
extern unsigned int add(unsigned int a, unsigned int b);
I run the following commands to create a shared library :
gcc -c -Wall -Werror -fPIC -frecord-gcc-switches shared.c
gcc -shared -frecord-gcc-switches -o libshared.so shared.o
The readelf -n libshared.so
gives me
Displaying notes found in: .note.gnu.build-id
Owner Data size Description
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
Build ID: 8466741f5849aac95570ec68d172f9077f175f89
How to check what options/flag or additional libraries were used to build the resulting lib?
BTW I use
$ gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.