http://sourceware.org/bugzilla/show_bug.cgi?id=14493

             Bug #: 14493
           Summary: "strip" breaks .SUNW_ldynsym section on illumos
           Product: binutils
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassig...@sourceware.org
        ReportedBy: pashev.i...@gmail.com
    Classification: Unclassified


Created attachment 6586
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6586
test_ldynsym-nonstripped-elfdump-s.txt

"strip" damages ELF section ".SUNW_ldynsym" on illumos.

As a result elfdump reports, for example, "libavl.so.1: .SUNW_ldynsym: invalid
sh_link: 0"

And linker cannot link with the resulting library:
"ld: fatal: file libc.so: section [4279087549](null): has invalid sh_info:
-37933168108576"


Here is a minimal example from [1]:
#include <ucontext.h>

static void
static_func(void)
{
    /* Use dladdr(3C) to print a call stack */
    printstack(1);

    /*
     * Write to address 0, killing the process and
     * producing a core file.
     */
    *((char *) 0) = 1;
}


int main(int argc, char *argv[])
{
    static_func();
    return (0);
}

# cc -Wl,-znoldynsym test.c -o test_noldynsym
# cc test.c -o test_ldynsym
# elfdump -s test_ldynsym > test_ldynsym-nonstripped-elfdump-s.txt
# stript test_ldynsym
# elfdump -s test_ldynsym &>test_ldynsym-stripped-elfdump-s.txt
# elfdump -s test_noldynsym > test_noldynsym-nonstripped-elfdump-s.txt
# strip test_noldynsym
# elfdump -s test_noldynsym > test_noldynsym-stripped-elfdump-s.txt


Also, before stripping size of test_ldynsym is 10K, after - 72K(!)




[1] https://blogs.oracle.com/ali/entry/what_is_sunw_ldynsym

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to