Tom de Vries ab3fdfe6e4 [gdb/testsuite] Simplify gdb.arch/amd64-disp-step-avx.exp
On SLE-11, with glibc 2.11.3, I run into:
...
(gdb) PASS: gdb.arch/amd64-disp-step-avx.exp: vex3: \
  var128 has expected value after
continue^M
Continuing.^M
^M
Program received signal SIGSEGV, Segmentation fault.^M
0x0000000000400283 in _exit (status=0) at \
  ../sysdeps/unix/sysv/linux/_exit.c:33^M
33      ../sysdeps/unix/sysv/linux/_exit.c: No such file or directory.^M
(gdb) FAIL: gdb.arch/amd64-disp-step-avx.exp: \
  continue until exit at amd64-disp-step-avx
...

This is not related to gdb, we get the same result by just running the exec.

The problem is that the test-case:
- calls glibc's _exit, and
- uses -nostartfiles -static, putting the burden for any necessary
  initialization for calling glibc's _exit on the test-case itself.

So, when we get to the second insn in _exit:
...
000000000040acb0 <_exit>:
  40acb0:       48 63 d7                movslq %edi,%rdx
  40acb3:       64 4c 8b 14 25 00 00    mov    %fs:0x0,%r10
...
no glibc-related initialization is done, and we run into the segfault.

Adding this (borrowed from __libc_start_main) in _start in the .S file is
sufficient to fix it:
...
         .rept 200
         nop
+        call __pthread_initialize_minimal
         .endr
...
But that already doesn't compile with say glibc 2.31, and regardless I think
this sort of fix is too fragile.

We could of course fix this by simply not running to exit.  But ideally we'd
have an exec that doesn't segfault when you just run it.

Alternatively, we could hand-code an _exit syscall and bypass glibc
all together.  But I'd rather fix this in a way that simplifies the test-case.

Taking a step back, the -nostartfiles -static was added to address that the
xmm registers were not zero at main (which AFAICT is a valid thing to happen).

[ The change itself silently broke the test-case, needing further fixing by
commit 40310f30a51 ("gdb: make gdb.arch/amd64-disp-step-avx.exp actually test
displaced stepping"). ]

Instead, simplify things by reverting to the original situation:
- no -nostartfiles -static compilation flags,
- no _start in the .S file,
- use exit instead of _exit in the .S file,
and fix the original problem by setting the xmm registers to zero rather than
checking that they're zero.

Now that we're no longer forcing -static, add nopie to the flags to prevent
compilation failure with target board unix/-fPIE/-pie.

Tested on x86_64-linux.

PR testsuite/30132
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30132
2023-02-17 15:33:18 +01:00
2023-02-17 15:19:47 +10:30
2023-01-04 13:23:54 +10:30
2023-02-16 21:00:50 +10:30
2022-09-28 13:37:31 +09:30
2023-02-17 15:19:47 +10:30
2022-07-09 20:10:47 +09:30
2022-01-28 08:25:42 -05:00
2022-12-31 12:05:28 +00:00

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.
Description
Unofficial mirror of sourceware binutils-gdb repository. Updated daily.
Readme 780 MiB
Languages
C 51.8%
Makefile 22.4%
Assembly 12.3%
C++ 6%
Roff 1.4%
Other 5.4%