Fix debugging of stripped PIE executables with padded PT_TLS
authorMichael Spang <spang@google.com>
Sun, 19 Aug 2018 14:55:58 +0000 (10:55 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sun, 19 Aug 2018 15:00:39 +0000 (11:00 -0400)
commitbe2d111a878e1422c921226bc7714131a5c470fa
tree08db3b7291d7c9cc082e387f79af5fd04bf9888a
parentd604f19adeb96f96213f4825e56053fac50723c6
Fix debugging of stripped PIE executables with padded PT_TLS

Certain PIE executables produced by gold cannot be debugged by gdb after
being stripped. GDB requires program headers of PIE executables to match,
and those checks may fail due to adjustments made during stripping.

One case of this occurs because strip recomputes the memsz of PT_TLS and
does not add alignment, while gold does. This is another variant of PR
11786, so apply the same fix of relaxing the program header matching.

gdb/ChangeLog:

PR gdb/11786
* solib-svr4.c (svr4_exec_displacement): Ignore memsz fields
for PT_TLS segments.

gdb/testsuite/ChangeLog:

PR gdb/11786
* gdb.base/gcore-tls-pie.c: New file.
* gdb.base/gcore-tls-pie.exp: New file.
gdb/ChangeLog
gdb/solib-svr4.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/gcore-tls-pie.c [new file with mode: 0644]
gdb/testsuite/gdb.base/gcore-tls-pie.exp [new file with mode: 0644]