[PATCH] Remove unused ps_lgetLDT etc. on Solaris/x86 [PR25981]

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Mon May 18 11:18:07 GMT 2020


As reported in PR build/25981, a future Solaris 11.4 update will soon
remove the short i386 register names like SS etc. from <sys/regset.h>.
They could leak into user code (e.g. via <signa.h> -> <sys/signal.h> ->
<sys/ucontext.h>) and pollute the user namespace.  Affected code would
have a hard time avoiding the issue: LLVM is one of those.

While the short names are required to be present by the i386 psABI, that
document only demands that they exist in <ucontext.h>, which is what the
upcoming update assures.

With this change, in a 64-bit-default configuration, procfs.c fails to
compile on Solaris/x86:

/vol/src/gnu/gdb/hg/master/git/gdb/procfs.c: In function 'ssd* procfs_find_LDT_entry(ptid_t)':
/vol/src/gnu/gdb/hg/master/git/gdb/procfs.c:1643:18: error: 'GS' was not declared in this scope
 1643 |   key = (*gregs)[GS] & 0xffff;
      |                  ^~
make[2]: *** [Makefile:1607: procfs.o] Error 1

Initially I meant to provide a definition using the planned replacement
macro, but closer inspection revealed a better way.
procfs_find_LDT_entry and its helper proc_get_LDT_entry are only used to
implement ps_lgetLDT, one of the callback functions required by
libthread_db.so.1 (cf. <proc_service.h>).  While that function is still
documented as being required even in Solaris 11.4, I found that it had
been removed long ago in Solaris 9, so just removing the three functions
above of them is the easiest fix.

The following patch does just that.  It compiled successfully on
amd64-pc-solaris2.11, however, as reported in PR gdb/25939, master is
completely broken on Solaris since the multi-target patch.  The patch
applies cleanly to the gdb-9 branch and there I could test it
successfully.

I'm going to apply it to master soon.  Also ok for the gdb-9 branch?  It
would be nice to have a compiling and working gdb on Solaris/x86
somehow.

Thanks.
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2020-05-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR build/25981
	* procfs.c [(__i386__ || __x86_64__) && sun] (proc_get_LDT_entry,
	procfs_find_LDT_entry): Remove.
	* procfs.h [(__i386__ || __x86_64__) && sun] (struct ssd,
	procfs_find_LDT_entry): Remove.
	* sol-thread.c [(__i386__ || __x86_64__) && sun] (ps_lgetLDT):
	Remove.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: solx86-no-ps_lgetLDT.patch
Type: text/x-patch
Size: 4199 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/gdb-patches/attachments/20200518/73fbba9a/attachment.bin>


More information about the Gdb-patches mailing list