On 1/6/22 03:26, Olivier Hainque wrote:
Hello,
commit aa2c978400f3b3ca6e9f2d18598a379589e77ba0, introduced per
https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545552.html
makes references to __cxa_pure_virtual weak and this is causing
issues on some VxWorks configurations, where weak symbols are only
supported for one of the two major operating modes, and not on all
versions.
While trying to circumvent that, I noticed that the current
code in cxx_init_decl_processing does something like:
if (flag_weak)
/* If no definition is available, resolve references to NULL. */
declare_weak (abort_fndecl);
...
if (! supports_one_only ())
flag_weak = 0;
The code possibly resetting flag_weak should presumlably execute
before the test checking the flag, or we'd need a comment explaining
why this surprising order is on purpose.
The attached patch just moves the reset above the test.
It bootstraps/regtests fine on x86_64-linux and allows better control
on vxWorks. I'm not yet clear on some of the ramifications there (tigthening
the definitions of SUPPORTS_ONE_ONLY and TARGET_SUPPORTS_WEAK yields lots of
dg test failures) but that's another story.
Ok to commit?
OK.
Thanks in advance!
2021-12-30 Olivier Hainque <hain...@adacore.com>
gcc/
* cp/decl.c (cxx_init_decl_processing): Move code possibly
altering flag_weak before code testing it.
Olivier