bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/19938] objcopy breaks sh_link and sh_info of SHT_SUNW_LDYN


From: cctsai57 at gmail dot com
Subject: [Bug binutils/19938] objcopy breaks sh_link and sh_info of SHT_SUNW_LDYNSYM and SHT_SUNW_symsort sections
Date: Fri, 06 May 2016 09:17:11 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=19938

cctsai57 <cctsai57 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cctsai57 at gmail dot com

--- Comment #26 from cctsai57 <cctsai57 at gmail dot com> ---
Hi,

This fix makes gcc's libstdc++ testsuite many fails for the ARM target.
I try to simplify them by the following flow:

# Two source files. The first is simplified from gcc source:
# libstdc++-v3/src/shared/hashtable-aux.cc:
$ cat -n hashtable-aux.cc 
     1  extern const unsigned long __prime_list[] = 
     2  {
     3      2ul, 3ul, 5ul, 7ul, 11ul, 13ul, 17ul, 19ul, 23ul, 29ul, 31ul,
     4      37ul, 41ul, 43ul, 47ul, 53ul, 59ul, 61ul, 67ul, 71ul, 73ul
     5  };

$ cat -n b.cc 
     1  #include <iostream>
     2  
     3  extern const unsigned long __prime_list[];
     4  
     5  int main()
     6  {
     7    std::cout << "__prime_list[]\n";
     8    for (int i = 0; i < 20; ++i)
     9      std::cout << __prime_list[i] << ", ";
    10    std::cout << "\n";
    11  
    12    return 0;
    13  }

$ arm-linux-gnueabihf-g++ -shared -fpic hashtable-aux.cc -o hashtable-aux.so
$ arm-linux-gnueabihf-g++ b.cc ./hashtable-aux.so

# Run under the QEMU
$ export QEMU_LD_PREFIX=$(arm-linux-gnueabihf-g++ -print-sysroot)
$ qemu-arm ./a.out
__prime_list[]
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 

The items in the __prime_list[] are all wrong zero!  I guess that the problem
is the lost R_ARM_COPY for __prime_list.

See a.out ELF:

$ arm-linux-gnueabihf-readelf --relocs a.out
Relocation section '.rel.dyn' at offset 0x668 contains 2 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00020d0c  00001615 R_ARM_GLOB_DAT    00000000   __gmon_start__
00020d70  00000d14 R_ARM_COPY        00020d70   address@hidden


Befor this fix, the old a.out ELF is:

$ arm-linux-gnueabihf-readelf --relocs a.out
Relocation section '.rel.dyn' at offset 0x668 contains 3 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00020d14  00001615 R_ARM_GLOB_DAT    00000000   __gmon_start__
00020d20  00000a14 R_ARM_COPY        00020d20   __prime_list
00020d78  00000d14 R_ARM_COPY        00020d78   address@hidden


The tool's version:
  gcc: 6.1.1
  binutils: 2.26.51 (master branch)
  glibc: 2.23

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]