https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113019

            Bug ID: 113019
           Summary: [NOT A BUG] Multi-architecture binaries for Linux
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aros at gmx dot com
  Target Milestone: ---

I know nothing about how libraries/binaries function in Linux or any other OS
however,

Nowadays in Linux there's seemingly a demand [1] [2] for getting more
performance out of applications/libraries by compiling them for newer x86-64
targets, e.g. x86_64_v3 however that instantly excludes a large swathe of CPUs
including very recent Intel CPUs lacking AVX2.

I wonder if GCC is capable of compiling a single library/binary object which
contains distinct code paths for different x86-64 targets. That way you could
have a single binary [object] which has the best performance and compatibility
regardless of where it's run.

I can imagine libraries having offsets for its functions and you cannot have
two offsets for different architectures, but what about 1) having two distinct
functions for different uArchs, e.g. some_routine_x86-64() and
some_routine_x86-64-v3()? or 2) every function having the most basic

if (arch=this)
    {run this}
else
    {run that}.

At the beginning of it?

I apologize if nothing above makes any sense.

https://ubuntu.com/blog/optimising-ubuntu-performance-on-amd64-architecture
https://www.phoronix.com/news/Arch-Linux-ALHP-x86-64-v4

Reply via email to