[Bug 266404] sysutils/edk2: on aarch64, edk2 fails to build for FreeBSD aarch64 libgcc_s.so.1 issues

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 28 Oct 2022 02:56:59 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266404

--- Comment #22 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
(In reply to Lorenzo Salvadore from comment #21)

> a commit that I don't fully understand

Just an FYI.

I'll note that other ports than EDK2 have had issues with
aarch64 FreeBSD's libgcc_s.so.1 being incomplete relative
to GCC aarch64 code generation and have also needed to
use a:

/usr/local/lib/gcc*/libgcc_s.so.1

instead to supply all the required things that the GCC
compiler expects to be supplied. "version GCC_4.5.0"
is not the only missing thing in the aarch64 FreeBSD
libgcc_s.so.1 . For example, in an aarch64 context,
g++ use floating point support routines can be an
issue, here code that was generated inside libstdc++.so . . .

# more trivial.cpp
// aarch64 g++12 example that shows the symbols missing for the
// /usr/local/lib/gcc12/libstdc++.so.6 build involved :
//
// # g++12 -o trivial -L/usr/lib trivial.cpp
//
// This finds /usr/lib/libgcc_s.so , which in turn is a link
// to /lib/libgcc_s.so.1 .

int main() {
}

For example, in my context:

# g++12 -o trivial -L/usr/lib trivial.cpp
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__floatunditf@GCC_4.2.0'
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__subtf3@GCC_3.0'
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__unordtf2@GCC_4.5.0'
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__getf2@GCC_3.0'
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__addtf3@GCC_3.0'
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__letf2@GCC_3.0'
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__fixunstfdi@GCC_3.0'
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__multf3@GCC_3.0'
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__eqtf2@GCC_3.0'
/usr/local/bin/ld:
/usr/local/lib/gcc12/gcc/aarch64-portbld-freebsd13.1/12.2.0/../../../libstdc++.so:
undefined reference to `__lttf2@GCC_3.0'
collect2: error: ld returned 1 exit status

If it turns out that GCC/G++ happens to not generate a reference
to something that is missing, such build errors do not happen
when /lib/libgcc_s.so.1 is being used. But if GCC/G++ generates
a reference to such, a use of a /usr/local/lib/gcc*/libgcc_s.so.1
is needed.

Some ports were likely marked broken instead of being fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.