[build] Fix HAVE_GAS_CFI_DIRECTIVE for x86_64-pc-solaris2.*

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Wed Jan 31 10:08:00 GMT 2018


When compiling MariaDB 10.2 (which uses cfi directives in inline asm,
but gets the conditionals wrong) on Solaris 11.4 with an
x86_64-pc-solaris2.11 gcc using gas, I noticed that this one incorrectly
doesn't use cfi directives although it could/should.

Looking closer, I noticed that the logic in gcc/configure.ac's
gcc_cv_as_cfi_directive test is not only hard to follow due to deeply
nested ifs, but plain wrong in the current case: for 64-bit Solaris/x86,
the .eh_frame section is (and should be) read-only, unlike the 32-bit
case, but is incorrectly rejected.

Unlike what we currently do, configure.ac needs to verify that both the
32 and 64-bit .eh_frame sections are as the toolchain requires them to
be, which is what the current patch does.

Since .eh_frame section test already appeared repeatedly, making the
whole code hard to read due to the redundancy, I've moved it to a shell
function.  While gcc/configure.ac itself currently doesn't use those
directly, the generated configure already does, so we should be save
here.

Tested with a standalone script with the necessary boilerplate added on
Solaris 10, 11.3 and 11.4 with /bin/as, bundled gas (2.15, 2.23.1,
2.29), and gas 2.30 on both sparc and x86.

Also bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11 (as/ld, gas/ld, both 32 and 64-bit).

While this only touches Solaris-specific code, it would be nice if one
of the build maintainers could have a look.

Ok for mainline?

	Rainer

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


2018-01-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (gcc_fn_eh_frame_ro): New function.
	(gcc_cv_as_cfi_directive): Check both 32 and 64-bit assembler for
	correct .eh_frame permissions.
	* configure: Regenerate.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: solx64-cfi_directive.patch
Type: text/x-patch
Size: 3171 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180131/b7a32609/attachment.bin>


More information about the Gcc-patches mailing list