On Mon, Nov 4, 2019 at 3:39 PM Wilco Dijkstra <wilco.dijks...@arm.com> wrote: > > Hi Richard, > > >> > Please don't add -fcommon in lto.exp. > >> > >> So what is the best way to add an extra option to lto.exp? > >> Note dg-lto-options completely overrides the options from lto.exp, so I > >> can't > >> use that except in tests which already use it. > > > > On what testcases do you need it at all? > > These need it in order to run over the original set of LTO options. A > possibility > would be to select one of the set of options and just run that using > dg-lto-options > (assuming it's safe to use -flto-partition and/or -flinker-plugin on all > targets). > > PASS->FAIL: g++.dg/lto/odr-6 2 (test for LTO warnings, odr-6_0.C line 3) > PASS->FAIL: g++.dg/lto/odr-6 2 (test for LTO warnings, odr-6_0.C line 3) > PASS->FAIL: g++.dg/lto/odr-6 2 (test for LTO warnings, odr-6_1.c line 1) > PASS->FAIL: g++.dg/lto/odr-6 2 (test for LTO warnings, odr-6_1.c line 1)
Please investigate those - C++ has -fno-common already so it might be a mix of C/C++ required here. Note that secondary files can use dg-options with the same behavior as dg-additional-options (they append to dg-lto-options), so here in _1.c add { dg-options "-fcommon" } > PASS->FAIL: g++.dg/lto/odr-6 cp_lto_odr-6_0.o-cp_lto_odr-6_1.o link, -O0 > -flto -flto-partition=1to1 -fno-use-linker-plugin > PASS->FAIL: g++.dg/lto/odr-6 cp_lto_odr-6_0.o-cp_lto_odr-6_1.o link, -O0 > -flto -flto-partition=none -fuse-linker-plugin > PASS->FAIL: g++.dg/lto/odr-6 cp_lto_odr-6_0.o-cp_lto_odr-6_1.o link, -O0 > -flto -fuse-linker-plugin -fno-fat-lto-objects > PASS->FAIL: g++.dg/lto/odr-6 cp_lto_odr-6_0.o-cp_lto_odr-6_1.o link, -O2 > -flto -flto-partition=1to1 -fno-use-linker-plugin > PASS->FAIL: g++.dg/lto/odr-6 cp_lto_odr-6_0.o-cp_lto_odr-6_1.o link, -O2 > -flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects > PASS->FAIL: g++.dg/lto/odr-6 cp_lto_odr-6_0.o-cp_lto_odr-6_1.o link, -O2 > -flto -fuse-linker-plugin > > > PASS->FAIL: gcc.dg/lto/pr88077 c_lto_pr88077_0.o-c_lto_pr88077_1.o link, -O0 > -flto -flto-partition=1to1 -fno-use-linker-plugin > PASS->FAIL: gcc.dg/lto/pr88077 c_lto_pr88077_0.o-c_lto_pr88077_1.o link, -O0 > -flto -flto-partition=none -fuse-linker-plugin > PASS->FAIL: gcc.dg/lto/pr88077 c_lto_pr88077_0.o-c_lto_pr88077_1.o link, -O0 > -flto -fuse-linker-plugin -fno-fat-lto-objects > PASS->FAIL: gcc.dg/lto/pr88077 c_lto_pr88077_0.o-c_lto_pr88077_1.o link, -O2 > -flto -flto-partition=1to1 -fno-use-linker-plugin > PASS->FAIL: gcc.dg/lto/pr88077 c_lto_pr88077_0.o-c_lto_pr88077_1.o link, -O2 > -flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects > PASS->FAIL: gcc.dg/lto/pr88077 c_lto_pr88077_0.o-c_lto_pr88077_1.o link, -O2 > -flto -fuse-linker-plugin This is a testcase relying on -fcommon to link (it has two definitions), I belive you can add dg-options "-fcommon" to the secondary file here as well, one COMMON is enough to make the link work. Richard. > > Wilco