[libvirt] [PATCH 0/2] FreeBSD/gcc fixes

Due to clang problems[1] I've switched to gcc from FreeBSD ports. That involves some minor fixes provided in this series. Roman Bogorodskiy (2): bhyve: fix bhyvexml2argvtest build with gcc maint: extend PIE support check m4/virt-compile-pie.m4 | 4 ++-- tests/bhyvexml2argvtest.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) -- 2.3.7

gcc5 reports an error like this: bhyvexml2argvtest.c: In function 'testCompareXMLToArgvFiles': bhyvexml2argvtest.c:24:18: error: variable 'vm' set but not used [-Werror=unused-but-set-variable] virDomainObj vm; ^ cc1: all warnings being treated as errors Fix by dropping this variable. --- tests/bhyvexml2argvtest.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 1c7bc31..fa6f87f 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -21,7 +21,6 @@ static int testCompareXMLToArgvFiles(const char *xml, { char *actualargv = NULL, *actualld = NULL, *actualdm = NULL; virDomainDefPtr vmdef = NULL; - virDomainObj vm; virCommandPtr cmd = NULL, ldcmd = NULL; virConnectPtr conn; int ret = -1; @@ -33,7 +32,6 @@ static int testCompareXMLToArgvFiles(const char *xml, VIR_DOMAIN_DEF_PARSE_INACTIVE))) goto out; - vm.def = vmdef; conn->privateData = &driver; if (!(cmd = virBhyveProcessBuildBhyveCmd(conn, vmdef, false))) -- 2.3.7

GCC installed from FreeBSD ports doesn't support building PIE executables and fails with: /usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC /usr/lib/crt1.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status However, the configure check for '-fPIC -DPIC' doesn't catch that. In order to catch this case, add '-pie' to CFLAGS in m4/virt-compile-pie.m4 so it could detect lack of PIE support on configure time and don't fail the build. --- m4/virt-compile-pie.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/virt-compile-pie.m4 b/m4/virt-compile-pie.m4 index cceb495..c0fb346 100644 --- a/m4/virt-compile-pie.m4 +++ b/m4/virt-compile-pie.m4 @@ -25,8 +25,8 @@ AC_DEFUN([LIBVIRT_COMPILE_PIE],[ *-*-mingw* | *-*-msvc* | *-*-cygwin* ) ;; dnl All code is position independent on Win32 target *) - gl_COMPILER_OPTION_IF([-fPIE -DPIE], [ - PIE_CFLAGS="-fPIE -DPIE" + gl_COMPILER_OPTION_IF([-fPIE -DPIE -pie], [ + PIE_CFLAGS="-fPIE -DPIE -pie" PIE_LDFLAGS="-pie" ]) esac -- 2.3.7

Roman Bogorodskiy wrote:
Due to clang problems[1] I've switched to gcc from FreeBSD ports. That involves some minor fixes provided in this series.
Oops, it misses: 1: https://www.redhat.com/archives/libvir-list/2015-May/msg00011.html
Roman Bogorodskiy (2): bhyve: fix bhyvexml2argvtest build with gcc maint: extend PIE support check
m4/virt-compile-pie.m4 | 4 ++-- tests/bhyvexml2argvtest.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
-- 2.3.7
Roman Bogorodskiy

On Sat, May 09, 2015 at 07:51:55PM +0300, Roman Bogorodskiy wrote:
Due to clang problems[1] I've switched to gcc from FreeBSD ports. That involves some minor fixes provided in this series.
Roman Bogorodskiy (2): bhyve: fix bhyvexml2argvtest build with gcc maint: extend PIE support check
m4/virt-compile-pie.m4 | 4 ++-- tests/bhyvexml2argvtest.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
ACK series Jan

Ján Tomko wrote:
On Sat, May 09, 2015 at 07:51:55PM +0300, Roman Bogorodskiy wrote:
Due to clang problems[1] I've switched to gcc from FreeBSD ports. That involves some minor fixes provided in this series.
Roman Bogorodskiy (2): bhyve: fix bhyvexml2argvtest build with gcc maint: extend PIE support check
m4/virt-compile-pie.m4 | 4 ++-- tests/bhyvexml2argvtest.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
ACK series
Jan
Pushed, thanks! Roman Bogorodskiy
participants (2)
-
Ján Tomko
-
Roman Bogorodskiy