A very concrete question here. I have two sample foo2d.c
files like this:
First,
#include <stdio.h>
__attribute__((visibility("default"))) void FooX(int i);
void Foo2(int i)
{
printf("Via Foo2(%d)\n", i);
FooX(i);
}
Second,
#include <stdio.h>
__attribute__((visibility("hidden"))) void FooX(int i);
void Foo2(int i)
{
printf("Via Foo2(%d)\n", i);
FooX(i);
}
The only difference is the visibility declaration of FooX
.
Given the two files the same name and compile them twice(gcc -c foo2d.c
), I got two .o files and rename them to be foo-default.o
and foo-hidden.o
respectively. I compare the two .o files and find out they differ by only one byte.
I really want to know the meaning of the difference of this byte, from a relocatable object's perspective. Can objdump or readelf, or whatever standard tools tell the difference of them?
My experiment env is openSUSE Linux 11.4, gcc 4.5.1.