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

            Bug ID: 24769
           Summary: [RISCV] partial RELRO doesn't work: .got is not in
                    PT_GNU_RELRO
           Product: binutils
           Version: 2.33 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: maskray at google dot com
  Target Milestone: ---

% riscv64-linux-gnu-gcc -fuse-ld=bfd a.c -Wl,-z,relro -Wl,-Map,a.map -o a
% readelf -l a
....
   07     .preinit_array .init_array .fini_array .dynamic

Note .got is not in PT_GNU_RELRO.

In the link map, we can see that .got.plt is placed before .got, which is
unusual (likely a bug).

% cat a.map
...
.got            0x0000000000002008       0x40
 *(.got.plt)
 .got.plt       0x0000000000002008       0x18
/path/to/riscv64-linux-gnu-gcc/usr/bin/../lib/gcc-cross/riscv64-linux-gnu/8/../../../../riscv64-linux-gnu/lib/Scrt1.o
 *(.igot.plt)
 *(.got)
 .got           0x0000000000002020       0x28
/path/to/riscv64-linux-gnu-gcc/usr/bin/../lib/gcc-cross/riscv64-linux-gnu/8/../../../../riscv64-linux-gnu/lib/Scrt1.o
                0x0000000000002020                _GLOBAL_OFFSET_TABLE_
 *(.igot)

The presence of .preinit_array (from Scrt1.o) is also weird.

% readelf -x .preinit_array a

Hex dump of section '.preinit_array':
  0x00001e08 00000000 00000000                   ........

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to