This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Does ld linker generate VER_FLG_WEAK?


I am learning about symbol versioning in ELF and came across this post
http://www.lightofdawn.org/wiki/wiki.cgi/NewAppsOnOldGlibc where WEAK
flag is added to a library dependency:

  0x00c0:   Name: GLIBC_2.14  Flags: WEAK   Version: 12

I am trying to simulate this with my own small library and program
using it.  Does ld linker generate VER_FLG_WEAK or is my thinking
incorrect?  I have this in lib.c:

void foo(void)
{
    puts("Hello, I'm a shared library");
}

and this in main.c

extern void foo(void)  __attribute__((weak)) ;

void foo1(void)
{
    puts("In program");
}

int main(void)
{
    puts("This is a shared library test...");

    foo ? foo() : foo1();
    return 0;
}

I saw other people doing this.  Basically I want to run my program
even when foo() is not defined in the library. I have a simple
mapfile:

LIB11 {
      global:
                foo;

};

LIB12 {
      global:
            foo;

} LIB11;

LIB13 { } LIB12;

However, after compiling and linking readelf -V still not shows WEAK
flag next to my library dependency. I may be completely wrong about
what I'm doing but I haven't even found a mention of VER_FLG_WEAK in
ld source code and here
http://binutils.sourceware.narkive.com/vvMgfurp/setting-the-ver-flg-weak-bit-on-an-elf-version-dependency
they say that it's not supported. How is it?

-- 
<wempwer@gmail.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]