For KVM AMD SEV-SNP virtualization we're trying to get SVSM guest firmware built on Fedora. https://github.com/svsm-vtpm/linux-svsm It builds successfully on Ubuntu 22.04 (gcc 11.3.0) which is what upstream uses as their primary dev platform. On Fedora 37 (gcc 12.2.1) though, we're getting errors at the final link stage. To eliminate version as a factor, I also tried Fedora 35 with gcc 11.3.1 and got the same errors: gcc -m64 -nostdlib -Wl,-Tsrc/start/svsm.lds -Wl,--build-id=none -o svsm.bin.elf src/start/start.o target/x86_64-unknown-none/debug/liblinux_svsm.a -Wl,--start-group ./external/build/lib/libtpm.a ./external/build/lib/libplatform.a ./external/build/lib/libwolfssl.a ./external/build/lib/libcrt.a ./external/build/lib/libm.a -Wl,--end-group ./external/build/lib/libwolfssl.a(src_libwolfssl_la-sha256.o): in function `Transform_Sha256': sha256.c:(.text+0xba): relocation truncated to fit: R_X86_64_32 against `.rodata' ./external/build/lib/libwolfssl.a(src_libwolfssl_la-aes.o): in function `wc_AesEncrypt': aes.c:(.text+0x50): relocation truncated to fit: R_X86_64_32S against `.rodata' aes.c:(.text+0x68): relocation truncated to fit: R_X86_64_32S against `.rodata' aes.c:(.text+0x7e): relocation truncated to fit: R_X86_64_32S against `.rodata' aes.c:(.text+0x8c): relocation truncated to fit: R_X86_64_32S against `.rodata' aes.c:(.text+0x9e): relocation truncated to fit: R_X86_64_32S against `.rodata' aes.c:(.text+0xa9): relocation truncated to fit: R_X86_64_32S against `.rodata' aes.c:(.text+0xc5): relocation truncated to fit: R_X86_64_32S against `.rodata' aes.c:(.text+0xd3): relocation truncated to fit: R_X86_64_32S against `.rodata' aes.c:(.text+0xe9): relocation truncated to fit: R_X86_64_32S against `.rodata' aes.c:(.text+0xf8): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status make: *** [Makefile:54: svsm.bin.elf] Error 1 I'm guessing there must be some difference in GCC defaults that is affecting things The Ubuntu build specs are # gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) While Fedora build specs are $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/12/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-12.2.1-20221121/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.1 20221121 (Red Hat 12.2.1-4) (GCC) One notable thing is Ubuntu's use of --enable-default-pie. Some Google links also suggested -fPIC as a possible solution to my error, so I tried modifying the build system to add -fPIC to CFLAGS/LDFLAGS, but that merely gave me a differrent set of errors :-( gcc -m64 -nostdlib -Wl,-Tsrc/start/svsm.lds -Wl,--build-id=none -o svsm.bin.elf src/start/start.o target/x86_64-unknown-none/debug/liblinux_svsm.a -Wl,--start-group ./external/build/lib/libtpm.a ./external/build/lib/libplatform.a ./external/build/lib/libwolfssl.a ./external/build/lib/libcrt.a ./external/build/lib/libm.a -Wl,--end-group ./external/build/lib/libwolfssl.a(libwolfssl_la-ssl.o): in function `wolfSSL_sk_pop_free': ssl.c:(.text+0x10dd4): failed to convert GOTPCREL relocation against 'wolfSSL_X509_NAME_ENTRY_free'; relink with --no-relax ssl.c:(.text+0x10ddd): failed to convert GOTPCREL relocation against 'wolfSSL_DIST_POINT_free'; relink with --no-relax ssl.c:(.text+0x10de6): failed to convert GOTPCREL relocation against 'wolfSSL_X509_NAME_free'; relink with --no-relax ssl.c:(.text+0x10def): failed to convert GOTPCREL relocation against 'wolfSSL_WOLFSSL_STRING_free'; relink with --no-relax ssl.c:(.text+0x10df8): failed to convert GOTPCREL relocation against 'wolfSSL_ASN1_OBJECT_free'; relink with --no-relax ssl.c:(.text+0x10e04): failed to convert GOTPCREL relocation against 'wolfSSL_GENERAL_NAME_free'; relink with --no-relax ssl.c:(.text+0x10e10): failed to convert GOTPCREL relocation against 'wolfSSL_X509_free'; relink with --no-relax collect2: error: ld returned 1 exit status make: *** [Makefile:54: svsm.bin.elf] Error 1 And I'm stuck on ideas of what other relevant differences there could be between Ubuntu and Fedora GCC toolchains that are causing these problems. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue