Package: abi-compliance-checker
Version: 2.3-0.1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu cosmic ubuntu-patch

Hi Mathieu,

In updating a-c-c in Ubuntu, I also found that it now fails its autopkgtests
on arm64, due to toolchain updates which now require use of PIC for some of
the relocations present in the C++ test code:

[...]
Total binary compatibility problems: 81, warnings: 57
Total source compatibility problems: 38, warnings: 57
Report: compat_reports/libsample_c/1.0_to_2.0/compat_report.html
Test result: SUCCESS (119 problems found)

Verifying detectable C++ library changes
ERROR: can't compile libsample_cpp v.1: 
'libsample_cpp/libsample.v1/build-log.txt'
autopkgtest [05:12:02]: test self-test: -----------------------]
[...]

  
https://objectstorage.prodstack4-5.canonical.com/v1/AUTH_77e2ada1e7a84929a74ba3b87153c0ac/autopkgtest-cosmic/cosmic/arm64/a/abi-compliance-checker/20180830_051216_f4bd1@/log.gz

After reproducing interactively:

$ cat libsample_cpp/libsample.v1/build-log.txt 
/usr/bin/ld: /tmp/ccEHuofR.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against 
symbol `_ZTVN6TestNS21UnsafeVirtualOverrideE' which may bind externally can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/ccEHuofR.o: in function 
`TestNS::UnsafeVirtualOverride::~UnsafeVirtualOverride()':
/home/vorlon/abi-compliance-checker-2.3/libsample_cpp/libsample.v1/libsample.cpp:43:(.text+0x20):
 dangerous relocation: unsupported relocation
/usr/bin/ld: /tmp/ccEHuofR.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against 
symbol `_ZTVN6TestNS21UnsafeVirtualOverrideE' which may bind externally can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/home/vorlon/abi-compliance-checker-2.3/libsample_cpp/libsample.v1/libsample.cpp:43:(.text+0x2c):
 dangerous relocation: unsupported relocation
/usr/bin/ld: /tmp/ccEHuofR.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against 
symbol `_ZTVN6TestNS21UnsafeVirtualOverrideE' which may bind externally can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/ccEHuofR.o: in function 
`TestNS::UnsafeVirtualOverride::UnsafeVirtualOverride()':
/home/vorlon/abi-compliance-checker-2.3/libsample_cpp/libsample.v1/libsample.cpp:42:(.text+0x2bc):
 dangerous relocation: unsupported relocation
/usr/bin/ld: /tmp/ccEHuofR.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against 
symbol `_ZTVN6TestNS21UnsafeVirtualOverrideE' which may bind externally can not 
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 
/home/vorlon/abi-compliance-checker-2.3/libsample_cpp/libsample.v1/libsample.cpp:42:(.text+0x2c8):
 dangerous relocation: unsupported relocation
/usr/bin/ld: /tmp/ccEHuofR.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against 
symbol `_ZTVN6TestNS28RemovedInlineVirtualFunctionE' which may bind externally 
can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/ccEHuofR.o: in function 
`TestNS::RemovedInlineVirtualFunction::RemovedInlineVirtualFunction()':
/home/vorlon/abi-compliance-checker-2.3/libsample_cpp/libsample.v1/libsample.cpp:54:(.text+0x308):
 dangerous relocation: unsupported relocation
/usr/bin/ld: /tmp/ccEHuofR.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against 
symbol `_ZTVN6TestNS23AddedVirtualMethodAtEndE' which may bind externally can 
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/ccEHuofR.o: in function 
`TestNS::AddedVirtualMethodAtEnd::AddedVirtualMethodAtEnd()':
/home/vorlon/abi-compliance-checker-2.3/libsample_cpp/libsample.v1/libsample.cpp:69:(.text+0x35c):
 dangerous relocation: unsupported relocation
/usr/bin/ld: /tmp/ccEHuofR.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against 
symbol `_ZTVN6TestNS25AddedPrivateVirtualSymbolE' which may bind externally can 
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/ccEHuofR.o: in function 
`TestNS::AddedPrivateVirtualSymbol::AddedPrivateVirtualSymbol()':
/home/vorlon/abi-compliance-checker-2.3/libsample_cpp/libsample.v1/libsample.cpp:87:(.text+0x394):
 dangerous relocation: unsupported relocation
/usr/bin/ld: /tmp/ccEHuofR.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against 
symbol `_ZTVN6TestNS23OverriddenVirtualMethodE' which may bind externally can 
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/ccEHuofR.o: in function 
`TestNS::OverriddenVirtualMethod::OverriddenVirtualMethod()':
/home/vorlon/abi-compliance-checker-2.3/libsample_cpp/libsample.v1/libsample.cpp:110:(.text+0x3fc):
 dangerous relocation: unsupported relocation
/usr/bin/ld: /tmp/ccEHuofR.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against 
symbol `_ZTVN6TestNS24OverriddenVirtualMethodBE' which may bind externally can 
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/ccEHuofR.o: in function 
`TestNS::OverriddenVirtualMethodB::OverriddenVirtualMethodB()':
/home/vorlon/abi-compliance-checker-2.3/libsample_cpp/libsample.v1/libsample.cpp:112:(.text+0x40c):
 dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
$

The attached patch fixes the issue and will make a-c-c future-proof on arm64
when these toolchain changes land in Debian as well.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru abi-compliance-checker-2.3/debian/patches/fpic-for-arm64.patch 
abi-compliance-checker-2.3/debian/patches/fpic-for-arm64.patch
--- abi-compliance-checker-2.3/debian/patches/fpic-for-arm64.patch      
1969-12-31 16:00:00.000000000 -0800
+++ abi-compliance-checker-2.3/debian/patches/fpic-for-arm64.patch      
2018-08-29 22:36:36.000000000 -0700
@@ -0,0 +1,19 @@
+Description: require -fPIC on arm64 in addition to x86_64 and arm
+ With gcc-8, a-c-c now fails to build its test cases with a relocation error
+ on arm64.  Add arm64 to the list of archs where we require -fPIC.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Modified: 2018-08-29
+
+Index: abi-compliance-checker-2.3/modules/Internals/RegTests.pm
+===================================================================
+--- abi-compliance-checker-2.3.orig/modules/Internals/RegTests.pm
++++ abi-compliance-checker-2.3/modules/Internals/RegTests.pm
+@@ -4954,7 +4954,7 @@
+             $BuildCmd = $GccPath." -shared -x c++ $ObjName.$SrcE -lstdc++ -o 
$ObjName.$LExt -g -Og";
+             $BuildCmd_Test = $GccPath." -x c++ test.$SrcE -lstdc++ 
-Wl,$ObjName.$LExt -o test";
+         }
+-        if(getArch_GCC(1)=~/\A(arm|x86_64)\Z/i)
++        if(getArch_GCC(1)=~/\A(arm|aarch64|x86_64)\Z/i)
+         { # relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be 
used when making a shared object; recompile with -fPIC
+             $BuildCmd .= " -fPIC -DPIC";
+             $BuildCmd_Test .= " -fPIC -DPIC";
diff -Nru abi-compliance-checker-2.3/debian/patches/series 
abi-compliance-checker-2.3/debian/patches/series
--- abi-compliance-checker-2.3/debian/patches/series    2018-08-29 
16:17:20.000000000 -0700
+++ abi-compliance-checker-2.3/debian/patches/series    2018-08-29 
22:34:22.000000000 -0700
@@ -1,3 +1,4 @@
 bug798481.patch
 typos.patch
 oom-exec-helper.patch
+fpic-for-arm64.patch

Reply via email to