【问题标题】:Compiling GCC from source down to .s assembly file将 GCC 从源代码编译为 .s 汇编文件
【发布时间】:2018-01-23 16:50:11
【问题描述】:

我正在重写二进制代码。我这样做的原因是在不访问其源代码的情况下强化二进制代码。所以我打算做的是在汇编级别重写,因为在反汇编上重写要困难得多。

我想要的是我想要健壮的程序的.s 汇编文件。海合会就是其中之一。我试图破解 GCC Makefile 并将 -save-temps 添加到其中的每个 CFLAGSCXXFLAGS 中。我在编译 coreutils 时做了同样的事情,我成功地为 coreutils 中的任何程序获取了.s 文件,例如lscat 等。但是,在 GCC Makefile 中做同样的事情我得到了错误.这是我使用的配置命令:

../gcc-svn/configure --prefix=/opt/mygcc

这是我得到的部分错误(其中大部分是有意义的重新定义错误):

In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:73:10: error: redefinition of ‘struct std::__true_type’
   struct __true_type { };
          ^~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:73:10: note: previous definition of ‘struct std::__true_type’
   struct __true_type { };
          ^~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:74:10: error: redefinition of ‘struct std::__false_type’
   struct __false_type { };
          ^~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:74:10: note: previous definition of ‘struct std::__false_type’
   struct __false_type { };
          ^~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:77:12: error: redefinition of ‘struct std::__truth_type<<anonymous> >’
     struct __truth_type
            ^~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:77:12: note: previous definition of ‘struct std::__truth_type<<anonymous> >’
     struct __truth_type
            ^~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:81:12: error: redefinition of ‘struct std::__truth_type<true>’
     struct __truth_type<true>
            ^~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:81:12: note: previous definition of ‘struct std::__truth_type<true>’
     struct __truth_type<true>
            ^~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:87:12: error: redefinition of ‘struct std::__traitor<_Sp, _Tp>’
     struct __traitor
            ^~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:87:12: note: previous definition of ‘struct std::__traitor<_Sp, _Tp>’
     struct __traitor
            ^~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:95:12: error: redefinition of ‘struct std::__are_same< <template-parameter-1-1>, <template-parameter-1-2> >’
     struct __are_same
            ^~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:95:12: note: previous definition of ‘struct std::__are_same< <template-parameter-1-1>, <template-parameter-1-2> >’
     struct __are_same
            ^~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:102:12: error: redefinition of ‘struct std::__are_same<_Tp, _Tp>’
     struct __are_same<_Tp, _Tp>
            ^~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:102:12: note: previous definition of ‘struct std::__are_same<_Tp, _Tp>’
     struct __are_same<_Tp, _Tp>
            ^~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:110:12: error: redefinition of ‘struct std::__is_void<_Tp>’
     struct __is_void
            ^~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:110:12: note: previous definition of ‘struct std::__is_void<_Tp>’
     struct __is_void
            ^~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:117:12: error: redefinition of ‘struct std::__is_void<void>’
     struct __is_void<void>
            ^~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:117:12: note: previous definition of ‘struct std::__is_void<void>’
     struct __is_void<void>
            ^~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:127:12: error: redefinition of ‘struct std::__is_integer<_Tp>’
     struct __is_integer
            ^~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:127:12: note: previous definition of ‘struct std::__is_integer<_Tp>’
     struct __is_integer
            ^~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:138:12: error: redefinition of ‘struct std::__is_integer<bool>’
     struct __is_integer<bool>
            ^~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:138:12: note: previous definition of ‘struct std::__is_integer<bool>’
     struct __is_integer<bool>
            ^~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:145:12: error: redefinition of ‘struct std::__is_integer<char>’
     struct __is_integer<char>
            ^~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:145:12: note: previous definition of ‘struct std::__is_integer<char>’
     struct __is_integer<char>
            ^~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:152:12: error: redefinition of ‘struct std::__is_integer<signed char>’
     struct __is_integer<signed char>
            ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:152:12: note: previous definition of ‘struct std::__is_integer<signed char>’
     struct __is_integer<signed char>
            ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:159:12: error: redefinition of ‘struct std::__is_integer<unsigned char>’
     struct __is_integer<unsigned char>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:159:12: note: previous definition of ‘struct std::__is_integer<unsigned char>’
     struct __is_integer<unsigned char>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:167:12: error: redefinition of ‘struct std::__is_integer<wchar_t>’
     struct __is_integer<wchar_t>
            ^~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:167:12: note: previous definition of ‘struct std::__is_integer<wchar_t>’
     struct __is_integer<wchar_t>
            ^~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:176:12: error: redefinition of ‘struct std::__is_integer<char16_t>’
     struct __is_integer<char16_t>
            ^~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:176:12: note: previous definition of ‘struct std::__is_integer<char16_t>’
     struct __is_integer<char16_t>
            ^~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:183:12: error: redefinition of ‘struct std::__is_integer<char32_t>’
     struct __is_integer<char32_t>
            ^~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:183:12: note: previous definition of ‘struct std::__is_integer<char32_t>’
     struct __is_integer<char32_t>
            ^~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:191:12: error: redefinition of ‘struct std::__is_integer<short int>’
     struct __is_integer<short>
            ^~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:191:12: note: previous definition of ‘struct std::__is_integer<short int>’
     struct __is_integer<short>
            ^~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:198:12: error: redefinition of ‘struct std::__is_integer<short unsigned int>’
     struct __is_integer<unsigned short>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:198:12: note: previous definition of ‘struct std::__is_integer<short unsigned int>’
     struct __is_integer<unsigned short>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:205:12: error: redefinition of ‘struct std::__is_integer<int>’
     struct __is_integer<int>
            ^~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:205:12: note: previous definition of ‘struct std::__is_integer<int>’
     struct __is_integer<int>
            ^~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:212:12: error: redefinition of ‘struct std::__is_integer<unsigned int>’
     struct __is_integer<unsigned int>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:212:12: note: previous definition of ‘struct std::__is_integer<unsigned int>’
     struct __is_integer<unsigned int>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:219:12: error: redefinition of ‘struct std::__is_integer<long int>’
     struct __is_integer<long>
            ^~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:219:12: note: previous definition of ‘struct std::__is_integer<long int>’
     struct __is_integer<long>
            ^~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:226:12: error: redefinition of ‘struct std::__is_integer<long unsigned int>’
     struct __is_integer<unsigned long>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:226:12: note: previous definition of ‘struct std::__is_integer<long unsigned int>’
     struct __is_integer<unsigned long>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:233:12: error: redefinition of ‘struct std::__is_integer<long long int>’
     struct __is_integer<long long>
            ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:233:12: note: previous definition of ‘struct std::__is_integer<long long int>’
     struct __is_integer<long long>
            ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:240:12: error: redefinition of ‘struct std::__is_integer<long long unsigned int>’
     struct __is_integer<unsigned long long>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:240:12: note: previous definition of ‘struct std::__is_integer<long long unsigned int>’
     struct __is_integer<unsigned long long>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:261:19: error: redefinition of ‘struct std::__is_integer<__int128>’
 __INT_N(__GLIBCXX_TYPE_INT_N_0)
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:261:19: note: previous definition of ‘struct std::__is_integer<__int128>’
 __INT_N(__GLIBCXX_TYPE_INT_N_0)
                   ^~~~~~~~~~~~~         
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:261:76: error: redefinition of ‘struct std::__is_integer<__int128 unsigned>’
 __INT_N(__GLIBCXX_TYPE_INT_N_0)
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:261:115: note: previous definition of ‘struct std::__is_integer<__int128 unsigned>’
 __INT_N(__GLIBCXX_TYPE_INT_N_0)
                                                                                                                   ^                              
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:61,
                 from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/tr1/array:34,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdtr1c++.h:31:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:279:12: error: redefinition of ‘struct std::__is_floating<_Tp>’
     struct __is_floating
            ^~~~~~~~~~~~~
In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/cmath:42,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:41:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/cpp_type_traits.h:279:12: note: previous definition of ‘struct std::__is_floating<_Tp>’
     struct __is_floating
            ^~~~~~~~~~~~~

<AND THERE ARE MORE ERRORS IN BETWEEN BUT IT TAKES LOTS OF SPACE.>

In file included from ~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/algorithm:60,
                 from ~/gcc/gcc-svn/libstdc++-v3/include/precompiled/stdc++.h:65:
~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include/utility:321:12: note: previous definition of ‘struct std::integer_sequence<_Tp, _Idx>’
     struct integer_sequence
            ^~~~~~~~~~~~~~~~
Makefile:1752: recipe for target 'x86_64-pc-linux-gnu/bits/stdtr1c++.h.gch/O2g.gch' failed
make[5]: *** [x86_64-pc-linux-gnu/bits/stdtr1c++.h.gch/O2g.gch] Error 1
make[5]: Leaving directory '~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3/include'
Makefile:511: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3'
Makefile:418: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '~/gcc/objdir-makehack/x86_64-pc-linux-gnu/libstdc++-v3'
Makefile:15895: recipe for target 'all-stage1-target-libstdc++-v3' failed
make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
make[2]: Leaving directory '~/gcc/objdir-makehack'
Makefile:24352: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '~/gcc/objdir-makehack'
Makefile:944: recipe for target 'all' failed
make: *** [all] Error 2

知道如何获取 GCC .s 文件或消除这些错误的系统方法是什么?

【问题讨论】:

  • 你为什么要汇编文件?请编辑您的问题以激发它。它闻起来强烈有点像XY problem。你不会得到一个单个汇编文件,而是成千上万个。
  • 您应该在问题中提及您的研究项目。可能还有其他一些方法(我正在考虑编写自己的 GCC 插件)。我可能会对你的研究项目本身感兴趣....
  • 如果发现大端 x86-{32,64} CPU,请报警。
  • 开关不是我的问题,现在对我来说也没什么大不了的。所以我把它们从我的问题中删除了。
  • 我为我的问题增加了更多动力。请问我为什么得到-1?我是社区的新手,如果您让我知道我的错误,我将不胜感激。谢谢。

标签: linux gcc makefile configure autoconf


【解决方案1】:

出于某些原因,我想要 gcc 的 .S 程序集文件

您无法获得单个.S 文件(大写S)。顺便说一句,.S 文件通常是手写的可预处理汇编代码(旨在首先由预处理器处理)。它们被cpp预处理器转换成一些普通的.s汇编文件,结果由as处理

你可以获得一个.s文件(小写.scc1cc1plus的汇编代码输出,并输入到as)对于GCC编译器的每个翻译单元(所以数以千计的此类文件,与您获得.o 文件一样多)。而且您需要很多磁盘空间。

我的建议是:

首先,配置您的 GCC 以使其能够正确编译。也许

 ../gcc-svn/configure --with-multilib-list=m32,m64 \
    --with-endian=big,little --prefix=/opt/mygcc  --program-suffix=-my

可能在你的系统上工作(我很惊讶:你为什么要--with-multilib-list=m32,m64 --with-endian=big,little?我不会使用它)。你应该试试。然后运行make -j

当(几个小时后)完全工作时,删除构建树中的所有文件,然后重试,方法是将 CFLAGS=-save-temps(参见 this)附加到您之前的(并且成功的)configure 命令。另请参阅this 关于defining variablesconfigure

但是,如果您真的想更改从 GCC 编译的二进制文件,更改编译器本身可能会更简单,也许通过写您的 GCC compiler plugin。当然,这仍然需要几个月的工作(困难的部分是理解 GCC 及其内部表示)。

【讨论】:

  • 请问--program-suffix=-my是什么?
  • 您确定CFLAGS+=-save-temps 吗?它给了我一个错误:configure: error: invalid variable name: CFLAGS+
  • 对不起,应该试试CFLAGS=-save-temps
  • 对不起,我的意思是.s 不是.S。你是对的。
  • 但你不会得到一个。但是成千上万。我不知道你在做什么样的静态分析,但你需要进行某种“符号链接”,这可能很困难。这就是为什么我建议激发您的问题并提供更多背景信息。顺便说一句,我对你的研究项目非常好奇和感兴趣。如果你能解释更多,请给我发电子邮件!
【解决方案2】:

“-save-temps”开关只需要添加到Makefile中的一个CFLAGS。该标志的名称是BOOT_CFLAGS,其中有一条评论说“标志传递到stage2 并稍后制作”。在我的例子中,我使用了 gcc 7.3 和一个带有 --prefix 的简单配置命令,该标志位于 Makefile 的第 351 行。通过该更改,我能够在我的构建目录的“./gcc”子目录中获取 gcc 的“.s”文件。

顺便感谢提供帮助的 cmets。

【讨论】:

    猜你喜欢
    • 2023-01-31
    • 2013-01-22
    • 1970-01-01
    • 1970-01-01
    • 2016-05-05
    • 1970-01-01
    • 1970-01-01
    • 2011-06-14
    • 2012-02-12
    相关资源
    最近更新 更多