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

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
Ok, we have a -dumpspecs option. If I use it for x86_64 and aarch64 I get a
small difference that should be fine:

--- x86_64.spec 2019-07-16 16:48:03.923522778 +0200
+++ aarch64.spec        2019-07-16 16:47:03.380334911 +0200
@@ -1,8 +1,8 @@
 *asm:
-%{m16|m32:--32}  %{m16|m32|mx32:;:--64}  %{mx32:--x32} 
%{msse2avx:%{!mavx:-msse2avx}}
+%{mbig-endian:-EB} %{mlittle-endian:-EL} %{march=*:-march=%*}
%(asm_cpu_spec)%{mabi=*:-mabi=%*}

 *asm_debug:
-%{%:debug-level-gt(0):%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}
%{fdebug-prefix-map=*:--debug-prefix-map %*}
+%{g*:%{%:debug-level-gt(0):--gdwarf2}}
%{fdebug-prefix-map=*:--debug-prefix-map %*}

 *asm_final:
 %{gsplit-dwarf: 
@@ -17,7 +17,7 @@
  as %(asm_options) %m.s %A }  }

 *cpp:
-%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
+%{pthread:-D_REENTRANT}

 *cpp_options:
 %(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}
%{f*} %{g*:%{%:debug-level-gt(0):%{g*}
%{!fno-working-directory:-fworking-directory}}} %{O*} %{undef}
%{save-temps*:-fpch-preprocess}
@@ -32,7 +32,7 @@
 cc1 -E %{traditional|traditional-cpp:-traditional-cpp}

 *cc1:
-%{!mandroid|tno-android-cc:%(cc1_cpu) %{profile:-p};:%(cc1_cpu) %{profile:-p}
%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}}
%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}}
+%{profile:-p}%{%:sanitize(address):-funwind-tables}

 *cc1_options:
 %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}
%{!iplugindir*:%{fplugin*:%:find-plugindir()}} %1 %{!Q:-quiet}
%{!dumpbase:-dumpbase %B} %{d*} %{m*} %{aux-info*}
%{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} 
%{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase
%b}}}%{!c:%{!S:-auxbase %b}}  %{g*} %{O*} %{W*&pedantic*} %{w}
%{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef}
%{Qn:-fno-ident} %{Qy:} %{-help:--help} %{-target-help:--target-help}
%{-version:--version} %{-help=*:--help=%*} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o
%b.s}}} %{fsyntax-only:-o %j} %{-param*} %{coverage:-fprofile-arcs
-ftest-coverage} %{fprofile-arcs|fprofile-generate*|coverage:  
%{!fprofile-update=single:     %{pthread:-fprofile-update=prefer-atomic}}}
@@ -47,13 +47,13 @@

%{fstack-protector|fstack-protector-all|fstack-protector-strong|fstack-protector-explicit:}

 *endfile:
-%{!mandroid|tno-android-ld:%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}
   %{mpc32:crtprec32.o%s}    %{mpc64:crtprec64.o%s}    %{mpc80:crtprec80.o%s}
%{fvtable-verify=none:%s;      fvtable-verify=preinit:vtv_end_preinit.o%s;     
fvtable-verify=std:vtv_end.o%s}    %{static:crtend.o%s;     
shared|static-pie|pie:crtendS.o%s;      :crtend.o%s} crtn.o%s
%{fopenacc|fopenmp:crtoffloadend%O%s};:%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}
   %{mpc32:crtprec32.o%s}    %{mpc64:crtprec64.o%s}    %{mpc80:crtprec80.o%s}
%{shared: crtend_so%O%s;: crtend_android%O%s}}
+%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}
%{fvtable-verify=none:%s;      fvtable-verify=preinit:vtv_end_preinit.o%s;     
fvtable-verify=std:vtv_end.o%s}    %{static:crtend.o%s;     
shared|static-pie|pie:crtendS.o%s;      :crtend.o%s} crtn.o%s 

 *link:
-%{!r:--build-id} %{!static|static-pie:--eh-frame-hdr}
%{!mandroid|tno-android-ld:%{m16|m32|mx32:;:-m elf_x86_64}                   
%{m16|m32:-m elf_i386}                    %{mx32:-m elf32_x86_64}  
%{shared:-shared}   %{!shared:     %{!static:       %{!static-pie:    
%{rdynamic:-export-dynamic}     %{m16|m32:-dynamic-linker
%{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:%{mmusl:/lib/ld-musl-i386.so.1;:/lib/ld-linux.so.2}}}}
  %{m16|m32|mx32:;:-dynamic-linker
%{muclibc:/lib/ld64-uClibc.so.0;:%{mbionic:/system/bin/linker64;:%{mmusl:/lib/ld-musl-x86_64.so.1;:/lib64/ld-linux-x86-64.so.2}}}}
    %{mx32:-dynamic-linker
%{muclibc:/lib/ldx32-uClibc.so.0;:%{mbionic:/system/bin/linkerx32;:%{mmusl:/lib/ld-musl-x32.so.1;:/libx32/ld-linux-x32.so.2}}}}}}
    %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z
text}};:%{m16|m32|mx32:;:-m elf_x86_64}                    %{m16|m32:-m
elf_i386}                    %{mx32:-m elf32_x86_64}   %{shared:-shared}  
%{!shared:     %{!static:       %{!static-pie:      
%{rdynamic:-export-dynamic}     %{m16|m32:-dynamic-linker
%{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:%{mmusl:/lib/ld-musl-i386.so.1;:/lib/ld-linux.so.2}}}}
  %{m16|m32|mx32:;:-dynamic-linker
%{muclibc:/lib/ld64-uClibc.so.0;:%{mbionic:/system/bin/linker64;:%{mmusl:/lib/ld-musl-x86_64.so.1;:/lib64/ld-linux-x86-64.so.2}}}}
    %{mx32:-dynamic-linker
%{muclibc:/lib/ldx32-uClibc.so.0;:%{mbionic:/system/bin/linkerx32;:%{mmusl:/lib/ld-musl-x32.so.1;:/libx32/ld-linux-x32.so.2}}}}}}
    %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}
%{shared: -Bsymbolic}}
+%{!r:--build-id} %{!static|static-pie:--eh-frame-hdr} %{h*}              
%{static:-Bstatic}                              %{shared:-shared}              
                %{symbolic:-Bsymbolic}                         
%{!static:%{!static-pie:                          %{rdynamic:-export-dynamic}  
                  %{!shared:-dynamic-linker
%{muclibc:/lib/ld-uClibc.so.0;:%{mbionic:/system/bin/linker;:%{mmusl:/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1;:/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1}}}}}}
   %{static-pie:-Bstatic -pie --no-dynamic-linker -z text}    -X               
                               %{mbig-endian:-EB} %{mlittle-endian:-EL}       
-maarch64linux%{mabi=ilp32:32}%{mbig-endian:b}
%{!mno-fix-cortex-a53-835769:--fix-cortex-a53-835769}
%{!mno-fix-cortex-a53-843419:--fix-cortex-a53-843419}

 *lib:
-%{!mandroid|tno-android-ld:%{pthread:-lpthread} %{shared:-lc}   
%{!shared:%{profile:-lc_p}%{!profile:-lc}};:%{shared:-lc}   
%{!shared:%{profile:-lc_p}%{!profile:-lc}} %{!static: -ldl}}
+%{pthread:-lpthread} %{shared:-lc}   
%{!shared:%{profile:-lc_p}%{!profile:-lc}}

 *link_gomp:

@@ -62,7 +62,7 @@
 %{static|static-libgcc|static-pie:-lgcc
-lgcc_eh}%{!static:%{!static-libgcc:%{!static-pie:%{!shared-libgcc:-lgcc
--push-state --as-needed -lgcc_s --pop-state}%{shared-libgcc:-lgcc_s%{!shared:
-lgcc}}}}}

 *startfile:
-%{!mandroid|tno-android-ld:%{shared:;     
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s};      static:crt1.o%s;     
static-pie:rcrt1.o%s;      pie:Scrt1.o%s;      :crt1.o%s} crti.o%s   
%{static:crtbeginT.o%s;      shared|static-pie|pie:crtbeginS.o%s;     
:crtbegin.o%s}    %{fvtable-verify=none:%s;     
fvtable-verify=preinit:vtv_start_preinit.o%s;     
fvtable-verify=std:vtv_start.o%s}
%{fopenacc|fopenmp:crtoffloadbegin%O%s};:%{shared: crtbegin_so%O%s;:  %{static:
crtbegin_static%O%s;: crtbegin_dynamic%O%s}}}
+%{shared:;      pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s};     
static:crt1.o%s;      static-pie:rcrt1.o%s;      pie:Scrt1.o%s;      :crt1.o%s}
crti.o%s    %{static:crtbeginT.o%s;      shared|static-pie|pie:crtbeginS.o%s;  
   :crtbegin.o%s}    %{fvtable-verify=none:%s;     
fvtable-verify=preinit:vtv_start_preinit.o%s;     
fvtable-verify=std:vtv_start.o%s} 

 *cross_compile:
 0
@@ -71,22 +71,22 @@
 9.1.1

 *multilib:
-. !m64 !m32;64:../lib64 m64 !m32;32:../lib !m64 m32;
+. !mabi=lp64;lp64:../lib64 mabi=lp64;

 *multilib_defaults:
-m64
+mabi=lp64

 *multilib_extra:


 *multilib_matches:
-m64 m64;m32 m32;
+mabi=lp64 mabi=lp64;

 *multilib_exclusions:


 *multilib_options:
-m64/m32
+mabi=lp64

 *multilib_reuse:

@@ -133,8 +133,8 @@
 *self_spec:


-*cc1_cpu:
-%{march=native:%>march=native %:local_cpu_detect(arch)  
%{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}}
%{mtune=native:%>mtune=native %:local_cpu_detect(tune)}
+*asm_cpu_spec:
+ %{mcpu=*:-march=%:rewrite_mcpu(%{mcpu=*:%*})}

 *link_command:
 %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:    %(linker)
%{!fno-use-linker-plugin:%{!fno-lto:     -plugin %(linker_plugin_file)    
-plugin-opt=%(lto_wrapper)     -plugin-opt=-fresolution=%u.res    
%{flinker-output=*:-plugin-opt=-linker-output-known}    
%{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}}    
}}%{flto|flto=*:%<fcompare-debug*}     %{flto} %{fno-lto} %{flto=*} %l
%{static|shared|r:;pie:-pie} %{fuse-ld=*:-fuse-ld=%*} 
%{gz|gz=zlib:--compress-debug-sections=zlib}
%{gz=none:--compress-debug-sections=none}
%{gz=zlib-gnu:--compress-debug-sections=zlib-gnu} %X %{o*} %{e*} %{N} %{n} %{r}
   %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}}    
%{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc)
%{fvtable-verify=none:} %{fvtable-verify=std:   %e-fvtable-verify=std is not
supported in this configuration} %{fvtable-verify=preinit:  
%e-fvtable-verify=preinit is not supported in this configuration}
%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):%{!shared:libasan_preinit%O%s}
%{static-libasan:%{!shared:-Bstatic --whole-archive -lasan --no-whole-archive
-Bdynamic}}%{!static-libasan:-lasan}}    
%{%:sanitize(thread):%{!shared:libtsan_preinit%O%s}
%{static-libtsan:%{!shared:-Bstatic --whole-archive -ltsan --no-whole-archive
-Bdynamic}}%{!static-libtsan:-ltsan}}    
%{%:sanitize(leak):%{!shared:liblsan_preinit%O%s}
%{static-liblsan:%{!shared:-Bstatic --whole-archive -llsan --no-whole-archive
-Bdynamic}}%{!static-liblsan:-llsan}}}}} %o     
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):   
%:include(libgomp.spec)%(link_gomp)}   
%{fgnu-tm:%:include(libitm.spec)%(link_itm)}    %(mflib)  %{fsplit-stack:
--wrap=pthread_create}    %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}
%{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):
%{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)}   
%{static:%ecannot specify -static with -fsanitize=address}}   
%{%:sanitize(thread):
%{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)}   
%{static:%ecannot specify -static with -fsanitize=thread}}   
%{%:sanitize(undefined):%{static-libubsan:-Bstatic} -lubsan
%{static-libubsan:-Bdynamic}
%{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}}   
%{%:sanitize(leak):
%{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}}}}}    
%{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}   
%{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*}

Reply via email to