https://sourceware.org/bugzilla/show_bug.cgi?id=30877
--- Comment #1 from Akhilesh Kumar ---
below are the test results on RISC_V target
Summary
Even we compiled this application with -z,relro,-z,now on pmap showing .got
address as RW
Test Results :-
user@starfive:~/akhilesh$ gcc -g -Wl,-z,relro,-z,now -o test test.c
user@starfive:~/akhilesh$ readelf -a test | grep RELRO
GNU_RELRO 0x0df8 0x1df8 0x1df8
user@starfive:~/akhilesh$ readelf -a test | grep NOW
0x001e (FLAGS) BIND_NOW
0x6ffb (FLAGS_1)Flags: NOW PIE
user@starfive:~/akhilesh$ gdb -q test
Reading symbols from test...
gdb-peda$ check
checkpoint checksec
gdb-peda$ checksec
Warning: 'set logging off', an alias for the command 'set logging enabled', is
deprecated.
Use 'set logging enabled off'.
Warning: 'set logging on', an alias for the command 'set logging enabled', is
deprecated.
Use 'set logging enabled on'.
CANARY: disabled
FORTIFY : disabled
NX: ENABLED
PIE : ENABLED
RELRO : FULL
gdb-peda$
gdb-peda$ b main
Breakpoint 1 at 0x6ca: file test.c, line 7.
gdb-peda$ shel objdump -R test | grep printf
Ambiguous command "shel objdump -R test | grep printf ": shell, shellcode.
gdb-peda$ shell objdump -R test | grep printf
2028 R_RISCV_JUMP_SLOT printf@GLIBC_2.27
gdb-peda$ b main
Note: breakpoint 1 also set at pc 0x6ca.
Breakpoint 2 at 0x6ca: file test.c, line 7.
gdb-peda$ r
Starting program: /home/user/akhilesh/test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/riscv64-linux-gnu/libthread_db.so.1".
Warning: 'set logging off', an alias for the command 'set logging enabled', is
deprecated.
Use 'set logging enabled off'.
Warning: 'set logging on', an alias for the command 'set logging enabled', is
deprecated.
Use 'set logging enabled on'.
Breakpoint 1, main (argc=0x1, argv=0x3ff418) at test.c:7
7 size_t *p = (size_t *) strtol(argv[1], NULL, 16);
gdb-peda$ b main
Note: breakpoints 1 and 2 also set at pc 0x2aa6ca.
Breakpoint 3 at 0x2aa6ca: file test.c, line 7.
gdb-peda$ p/x 0x2aa6ca -0x6ca + 0x002028
$1 = 0x2ac028
gdb-peda$ test 0x2ac028
Undefined command: "test". Try "help".
gdb-peda$ r 0x2ac028
Starting program: /home/user/akhilesh/test 0x2ac028
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/riscv64-linux-gnu/libthread_db.so.1".
Breakpoint 1, main (argc=0x2, argv=0x3ff408) at test.c:7
7 size_t *p = (size_t *) strtol(argv[1], NULL, 16);
gdb-peda$ shell ps -s
UID PID PENDING BLOCKED IGNORED
CAUGHT STAT TTYTIME COMMAND
1000 28404 0001 00384004
4b813efb Ss pts/1 0:02 -bash
1000 28713
Tpts/1 0:01 find / -name libFLAC*
1000 42749 01001000
0001080344e7 Sl+ pts/1 0:03 gdb -q test
1000 42773
tpts/1 0:00 /home/user/akhilesh/test 0x2ac028
1000 42774
7391fef9 R+ pts/1 0:00 ps -s
gdb-peda$ shell p
peda-session-test.txt peda-session-test_partial.txt
philwantsfish-gdb_commands-7b11f55/ philwantsfish-gdb_commands-7b11f55.zip
gdb-peda$ shell pmap 42773
42773: /home/user/akhilesh/test 0x2ac028
002aa000 4K r-x-- test
002ab000 4K r test
002ac000 4K rw--- test== Showing RW even we used
-z,relro, -z, now
003ff7e9d000 1160K r-x-- libc.so.6
003ff7fbf000 12K r libc.so.6
003ff7fc2000 8K rw--- libc.so.6
003ff7fc4000 52K rw--- [ anon ]
003ff7fdd000 8K rw--- [ anon ]
003ff7fdf000 4K r [ anon ]
003ff7fe 4K r-x-- [ anon ]
003ff7fe1000112K r-x-- ld-linux-riscv64-lp64d.so.1
003ff7ffd000 4K r ld-linux-riscv64-lp64d.so.1
003ff7ffe000 8K rw--- ld-linux-riscv64-lp64d.so.1
003df000132K rw--- [ stack ]
total 1516K
gdb-peda$ maintenance info sections
Exec file: `/home/user/akhilesh/test', file type elf64-littleriscv.
[0] 0x2aa270->0x2aa291 at 0x0270: .interp ALLOC LOAD READONLY
DATA HAS_CONTENTS
[1] 0x2aa294->0x2aa2b8 at 0x0294: .note.gnu.build-id ALLOC
LOAD READONLY DATA HAS_CONTENTS
[2] 0x2aa2b8->0x2aa2d8 at 0x02b8: .note.ABI-tag ALLOC LOAD
READONLY DATA HAS_CONTENTS
[3] 0x2aa2d8->0x2aa2fc at 0x02d8: .gnu.hash ALLOC LOAD
READONLY DATA HAS_CONTENTS
[4] 0x2aa300->0x2aa3d8 at 0x0300: .dynsym ALLOC LOAD READONLY
DATA HAS_CONTENTS
[5] 0x2aa3d8->0x2aa45e at 0x03d8: .dynstr ALLOC LOAD