[PATCH v1] libstdc++-v3: Update VTV vars for libtool link commands [PR99172]

Jonathan Wakely jwakely@redhat.com
Thu Mar 11 16:27:56 GMT 2021


On 11/03/21 07:31 -0800, Caroline Tice via Libstdc++ wrote:
>Adding the libstdc++ mailing list to the patch.

Thanks.

>-- Caroline
>cmtice@google.com
>
>On Wed, Mar 10, 2021 at 8:50 PM Caroline Tice <cmtice@google.com> wrote:
>>
>> This patch is to fix PR 99172.
>>
>> Currently when GCC is configured with --enable-vtable-verify, the
>> libstdc++-v3 Makefiles add "-fvtable-verify=std
>> -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" to libtool link
>> commands. The "-fvtable-verify=std" piece causes alternate versions of
>> libtool (such as slibtool) to fail, unable to find "-lvtv" (GNU
>> libtool just removes that piece).
>>
>> This patch updates the libstdc++-v3 Makefiles to not pass
>> "-fvtable-verify=std" to the libtool link commands, while continuing
>> to pass the rest of the VTV  flags (which are necessary for VTV to
>> work).
>>
>> I tested this by configuring with --enable-vtable-verify, boostrapping
>> the compiler, and running all the regression testsuites (including
>> libvtv & libstdc++) without any regressions.  I only ran it on a linux
>> system, on an x86_64 machine.
>>
>> I also gave a copy of the patch to the person who reported the bug,
>> and they verified that the patch fixes their issue.
>>
>> Is this ok to commit?

Should the same change be made to CXXLINK in src/*/Makefile.am, for
consistency if nothing else?

The patch is OK for gcc-11 now, but for stage 1 I'm wondering about
simplifying it.

Why do we ever add -Wl,-u options to CXXFLAGS when those are linker
options?

Could we move the -Wl,-u options to VTV_CXXLINKFLAGS instead, so
they're only used when actually linking?

Then VTV_CXXFLAGS would just be -fvtable-verify=std (and so
VTV_PCH_CXXFLAGS would be redundant), and instead of having
AM_CXXFLAGS and AM_CXXFLAGS_LT we could just filter out the
-fvtable-verify=std option from the CXXLINK options:

CXXLINK = \
	$(LIBTOOL) --tag CXX \
	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
	--mode=link $(CXX) \
	$(VTV_CXXLINKFLAGS) \
	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) \
	$(filter-out,-fvtable-verify=std,$(AM_CXXFLAGS)) \
	$(LTLDFLAGS) -o $@

Would that make sense?

Or just add  -fvtable-verify=none to the CXXLINK command to cancel out
the  -fvtable-verify=std option from AM_CXXFLAGS:

CXXLINK = \
	$(LIBTOOL) --tag CXX \
	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
	--mode=link $(CXX) \
	$(VTV_CXXLINKFLAGS) \
	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) \
	$(AM_CXXFLAGS) -fvtable-verify=none \
	$(LTLDFLAGS) -o $@

That seems cleaner to me, rather than adding another variable with
minor differences from the existing AM_CXXFLAGS.



More information about the Libstdc++ mailing list