Bug 71940 - .rela.plt info is pointing to .got.plt while it should point .plt
Summary: .rela.plt info is pointing to .got.plt while it should point .plt
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 5.4.0
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-20 06:04 UTC by Arun Nishad
Modified: 2016-07-20 06:16 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Sample application (2.52 KB, application/x-executable)
2016-07-20 06:04 UTC, Arun Nishad
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arun Nishad 2016-07-20 06:04:30 UTC
Created attachment 38938 [details]
Sample application

In the recent version off gcc compiled application i see .rela.plt info index is [12] .plt index but in 5.4 its pointing to the  [24] .got.plt.

readelf: 
---------------------------------------------------------------------------
 Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x4004c0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          6776 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         9
  Size of section headers:           64 (bytes)
  Number of section headers:         31
  Section header string table index: 28

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .interp           PROGBITS         0000000000400238  00000238
       000000000000001c  0000000000000000   A       0     0     1
  [ 2] .note.ABI-tag     NOTE             0000000000400254  00000254
       0000000000000020  0000000000000000   A       0     0     4
  [ 3] .note.gnu.build-i NOTE             0000000000400274  00000274
       0000000000000024  0000000000000000   A       0     0     4
  [ 4] .gnu.hash         GNU_HASH         0000000000400298  00000298
       000000000000001c  0000000000000000   A       5     0     8
  [ 5] .dynsym           DYNSYM           00000000004002b8  000002b8
       0000000000000090  0000000000000018   A       6     1     8
  [ 6] .dynstr           STRTAB           0000000000400348  00000348
       0000000000000049  0000000000000000   A       0     0     1
  [ 7] .gnu.version      VERSYM           0000000000400392  00000392
       000000000000000c  0000000000000002   A       5     0     2
  [ 8] .gnu.version_r    VERNEED          00000000004003a0  000003a0
       0000000000000020  0000000000000000   A       6     1     8
  [ 9] .rela.dyn         RELA             00000000004003c0  000003c0
       0000000000000018  0000000000000018   A       5     0     8
--->  [10] .rela.plt         RELA             00000000004003d8  000003d8
       0000000000000060  0000000000000018  AI       5    24     8
  [11] .init             PROGBITS         0000000000400438  00000438
       000000000000001a  0000000000000000  AX       0     0     4
  [12] .plt              PROGBITS         0000000000400460  00000460
       0000000000000050  0000000000000010  AX       0     0     16
  [13] .plt.got          PROGBITS         00000000004004b0  000004b0
       0000000000000008  0000000000000000  AX       0     0     8
  [14] .text             PROGBITS         00000000004004c0  000004c0
       00000000000001d2  0000000000000000  AX       0     0     16
  [15] .fini             PROGBITS         0000000000400694  00000694
       0000000000000009  0000000000000000  AX       0     0     4
  [16] .rodata           PROGBITS         00000000004006a0  000006a0
       0000000000000039  0000000000000000   A       0     0     4
  [17] .eh_frame_hdr     PROGBITS         00000000004006dc  000006dc
       0000000000000044  0000000000000000   A       0     0     4
  [18] .eh_frame         PROGBITS         0000000000400720  00000720
       0000000000000134  0000000000000000   A       0     0     8
  [19] .init_array       INIT_ARRAY       0000000000600e00  00000e00
       0000000000000010  0000000000000000  WA       0     0     8
  [20] .fini_array       FINI_ARRAY       0000000000600e10  00000e10
       0000000000000010  0000000000000000  WA       0     0     8
  [21] .jcr              PROGBITS         0000000000600e20  00000e20
       0000000000000008  0000000000000000  WA       0     0     8
  [22] .dynamic          DYNAMIC          0000000000600e28  00000e28
       00000000000001d0  0000000000000010  WA       6     0     8
  [23] .got              PROGBITS         0000000000600ff8  00000ff8
       0000000000000008  0000000000000008  WA       0     0     8
--->[24] .got.plt          PROGBITS         0000000000601000  00001000
       0000000000000038  0000000000000008  WA       0     0     8
  [25] .data             PROGBITS         0000000000601038  00001038
       0000000000000010  0000000000000000  WA       0     0     8
  [26] .bss              NOBITS           0000000000601048  00001048
       0000000000000008  0000000000000000  WA       0     0     1
  [27] .comment          PROGBITS         0000000000000000  00001048
       0000000000000034  0000000000000001  MS       0     0     1
  [28] .shstrtab         STRTAB           0000000000000000  00001968
       000000000000010c  0000000000000000           0     0     1
  [29] .symtab           SYMTAB           0000000000000000  00001080
       00000000000006a8  0000000000000018          30    49     8
  [30] .strtab           STRTAB           0000000000000000  00001728
       0000000000000240  0000000000000000           0     0     1

Could you please tell us why this has been changes ?
It doesnt crash but for readelf point of view it looks buggy.
Please help.
I am attaching sample application.
Comment 1 Andrew Pinski 2016-07-20 06:16:12 UTC
.rela.plt is relocation information for the .plt section.

While .got.plt is the GOT for the .plt.got section.

Anyways this is not the right place to ask this question.  The right place is either gcc-help@ or on the binutils email list.