-
jbkthis is a bit of an odd question... but would there be an easy way with dis(1) or such to scan an ELF object to see if it contains AVX2 or AVX512 instructions, etc?
-
denkI remember when I palyed with sun cc it added some flags to the elf object
-
denkroot@ntp:~# file /zones/news/root/usr/rusnet/sbin/ircd
-
denk/zones/news/root/usr/rusnet/sbin/ircd: ELF 64-bit LSB executable, x86-64, version 1 (Solaris), dynamically linked, interpreter /usr/lib/amd64/ld.so.1, not stripped, uses CMOV SSE SSE2
-
denkthat "uses xxx" is the flags
-
denkunfortunately, gcc does not do it
-
richlowestill a dream to patch gas to do that properly
-
richlowebut I don't know we have anything that will scan except grep and knowing which instructions do what
-
alancand of course, many programs want the information studio adds stripped out since it prevents them from running on CPUs without those features, since it doesn't detect if you're checking the CPUID and only using them on those CPUs with fallbacks for CPUs without the features
-
alancStudio assumed everyone followed the old Solaris model of having processor-specific loadable modules for such things, not statically linking them into the main program
-
alanc(Solaris ld added a "-z discap" option for the linker to disassemble & detect extension usage, but not until after the source was closed, so illumos didn't get to inherit it)
-
richlowenot hard to implement, along the lines of what I said above
-
richlowetedious though
-
richloweif you could use the dis tables in some more appropriate structure, you could probably even do it fast, except on x86
-
sommerfeldwould probably be "fast enough" on x86