On Sat, Jul 20, 2024 at 10:50:30AM +0200, Landry Breuil wrote:
> Le Fri, Jul 19, 2024 at 10:45:18AM +0200, Landry Breuil a écrit :
> > Le Fri, Jul 19, 2024 at 08:49:54AM +0200, Peter Hessler a écrit :
> > > On 2024 Jul 18 (Thu) at 21:35:47 -0600 (-0600), phess...@openbsd.org 
> > > wrote:
> > > :critical path missing pkgs:  
> > > http://build-failures.rhaalovely.net/aarch64/2024-07-16/summary.log
> > > 
> > > :http://build-failures.rhaalovely.net/aarch64/2024-07-16/mail/mozilla-thunderbird.log
> > > :http://build-failures.rhaalovely.net/aarch64/2024-07-16/www/firefox-esr.log
> > > :http://build-failures.rhaalovely.net/aarch64/2024-07-16/www/tor-browser/browser.log
> > > :http://build-failures.rhaalovely.net/aarch64/2024-07-16/x11/qt5/qtwebengine.log
> > > 
> > > the above 4 ports fail related to hwcap in the same way:
> > > 
> > > /usr/obj/ports/firefox-esr-115.13.0/firefox-115.13.0/gfx/skia/skia/src/core/SkCpu.cpp:84:27:
> > > error: use of undeclared identifier 'getauxval'
> > >         uint32_t hwcaps = getauxval(AT_HWCAP);
> > 
> > https://searchfox.org/mozilla-esr115/source/gfx/skia/skia/src/core/SkCpu.cpp#76
> > for the surrounding code, i guess it now finds a sys/auxv.h header ?

That would make sense.  Looking at the www/mozilla-firefox copy of
skia, this chunk of code appears to have disappeared from SkCpu.cpp.

  https://github.com/google/skia/commit/571b4cf2e35930f6744181b73b72939ab236f3ea

The addition of elf_aux_info(3) was intended to make it easier for
external software to use optimizations, but maybe for these ports it
would be just easier to patch out feature detection?  ;)

> the below patch goes past this build failure, but libipcclientcerts.so
> doesn't link with lld:
> 
> rm -f libipcclientcerts.so.10.0                                               
>                                                                               
>                                    /usr/obj/ports/firefox-esr-115.13.0/bin/cc 
> -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong 
> -Wno-backend-plugin -O2 -pipe -g -fPIC -ffunction-sections -fdata-sections  
> -fno-math-errno -pthread -pipe -gdwarf-4 -O2 -pipe -g -fomit-frame-pointer 
> -funwind-tables 
> -fprofile-use=/usr/obj/ports/firefox-esr-115.13.0/merged.profdata 
> -Wno-error=backend-plugin -shared -fPIC -Wl,--gc-sections 
> -Wl,-h,libipcclientcerts.so.10.0 -o libipcclientcerts.so.10.0 stub.o  
> -flto=thin -Wl,-plugin-opt=-import-instr-limit=10 
> -Wl,-plugin-opt=-import-hot-multiplier=30 -pthread -Wl,--threads=8 
> -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,-z,nocopyreloc 
> -Wl,-Bsymbolic-functions -Wl,--build-id=sha1 -fstack-protector-strong 
> -Wl,-rpath-link,/usr/obj/ports/firefox-esr-115.13.0/build-aarch64/dist/bin 
> -Wl,-rpath-link,/usr/local/lib -Wl,-rpath-link,/usr/X11R6/lib  
> /usr/obj/ports/firefox-esr-115.13.0/build-aarch64/aarch64-unknown-openbsd/release/libipcclientcerts_static.a
>   -Wl,--version-script,libipcclientcerts.so.10.0.symbols
> /usr/obj/ports/firefox-esr-115.13.0/build-aarch64/_virtualenvs/build/bin/python
>  -m mozbuild.action.check_binary --target libipcclientcerts.so.10.0 
> BUILDTASK {"argv": 
> ["/usr/obj/ports/firefox-esr-115.13.0/firefox-115.13.0/python/mozbuild/mozbuild/action/check_binary.py",
>  "--target", "libipcclientcerts.so.10.0"], "start": 12452.418140014,
>  "end": 12452.543060385, "context": null}                  
> chmod +x libipcclientcerts.so.10.0                         
> ../../../../../config/nsinstall -R -m 644 'libipcclientcerts.so.10.0' 
> '../../../../../dist/bin'        
> gmake[3]: Leaving directory 
> '/usr/obj/ports/firefox-esr-115.13.0/build-aarch64/security/manager/ssl/ipcclientcerts/dynamic-library'
>      
> ld.lld: error: undefined hidden symbol: elf_aux_info       
> >>> referenced by SkCpu.cpp:85 
> >>> (/usr/obj/ports/firefox-esr-115.13.0/firefox-115.13.0/gfx/skia/skia/src/core/SkCpu.cpp:85)
> >>>     
> >>>               lto.tmp:(SkCpu::CacheRuntimeFeatures()) 
> clang-16: error: linker command failed with exit code 1 (use -v to see 
> invocation)  i
> 
> i dunno which of the -Wl flags triggers this, but the elf_aux_info symbol is
> present as a weak symbol in libc.so.100.2, but i see that it doesnt 
> explicitely
> link with -lc - though maybe it shouldnt be required.

I think I have already seen this "global vs hidden" mismatch for weak
symbols previously, but I don't remember the specifics.  Looking at
the arm64 base sets, llvm-readelf -Wa libc.so.100.2 shows
elf_aux_info(3) as a weak symbol with default (not hidden) visibility:

  1410: 000000000008c80c   224 FUNC    WEAK   DEFAULT    12 elf_aux_info

That looks correct to me.

I suspect the error message means there's another elf_aux_info()
definition in your build, but with hidden visibility; but I couldn't
find one in the firefox-esr tarball and I could very well be mistaken.

cc'ing the usual ELFs, maybe they'll have some clues.

> $cat patches/patch-gfx_skia_skia_src_core_SkCpu_cpp
> Fix build with auxv.h addition

See below,

> Index: gfx/skia/skia/src/core/SkCpu.cpp
> --- gfx/skia/skia/src/core/SkCpu.cpp.orig
> +++ gfx/skia/skia/src/core/SkCpu.cpp
> @@ -81,7 +81,8 @@
>                         kHWCAP_ASIMDHP = (1<<10);
>  
>          uint32_t features = 0;
> -        uint32_t hwcaps = getauxval(AT_HWCAP);
> +        uint32_t hwcaps = 0;

As pointed out by naddy, 'hwcaps' should be an unsigned long.

> +        elf_aux_info(AT_HWCAP, &hwcaps, sizeof(hwcaps));

naddy also pointed out the lack of error checking; I think you can
rely on the fact that elf_aux_info(3) won't touch *hwcaps if it fails.
I doubt that you'll have to upstream that code anyway...

>          if (hwcaps & kHWCAP_CRC32  ) { features |= SkCpu::CRC32; }
>          if (hwcaps & kHWCAP_ASIMDHP) { features |= SkCpu::ASIMDHP; }
> 
> > 
> > Landry
> > 
> 

-- 
jca

Reply via email to