[Bug 255760] lang/gcc10: Work around bootstrap issues with llvm 12

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon May 10 21:14:12 UTC 2021


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255760

            Bug ID: 255760
           Summary: lang/gcc10: Work around bootstrap issues with llvm 12
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: gerald at FreeBSD.org
          Reporter: dim at FreeBSD.org
             Flags: maintainer-feedback?(gerald at FreeBSD.org)
          Assignee: gerald at FreeBSD.org

Created attachment 224818
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=224818&action=edit
Add -O1 to configure's stage1_cflags

As show in the exp-run for llvm 12 (see bug 255570), the gcc ports which
default to a full bootstrap fail, because of some code in the generators
(gencondmd, etc) which appears to depend on references to non-existing global
variables (e.g. ix86_isa_flags and others) being optimized away:

http://package22.nyi.freebsd.org/data/mainamd64PR255570-default/2021-05-08_16h02m24s/logs/gcc10-10.3.0.log

c++ -std=gnu++98   -g -DIN_GCC    -fno-strict-aliasing -fno-exceptions
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wno-error=format-diag -Wno-format -Wmissing-format-attribute
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -fno-PIE
-fstack-protector-strong  -no-pie -o build/gencondmd \
    build/gencondmd.o build/errors.o
../build-x86_64-portbld-freebsd14.0/libiberty/libiberty.a
c++: warning: argument unused during compilation: '-no-pie'
[-Wunused-command-line-argument]
ld: error: undefined symbol: ix86_isa_flags
>>> referenced by subst.md:140 (/wrkdirs/usr/ports/lang/gcc10/work/gcc-10.3.0/gcc/config/i386/subst.md:140)
>>>               build/gencondmd.o:(__cxx_global_var_init.101)
>>> referenced by subst.md:71 (/wrkdirs/usr/ports/lang/gcc10/work/gcc-10.3.0/gcc/config/i386/subst.md:71)
>>>               build/gencondmd.o:(__cxx_global_var_init.101)
>>> referenced by sse.md:5429 (/wrkdirs/usr/ports/lang/gcc10/work/gcc-10.3.0/gcc/config/i386/sse.md:5429)
>>>               build/gencondmd.o:(__cxx_global_var_init.101)
>>> referenced 2268 more times

ld: error: undefined symbol: ix86_isa_flags2
>>> referenced by i386.md:21062 (/wrkdirs/usr/ports/lang/gcc10/work/gcc-10.3.0/gcc/config/i386/i386.md:21062)
>>>               build/gencondmd.o:(__cxx_global_var_init.101)
>>> referenced by sse.md:22985 (/wrkdirs/usr/ports/lang/gcc10/work/gcc-10.3.0/gcc/config/i386/sse.md:22985)
>>>               build/gencondmd.o:(__cxx_global_var_init.101)
>>> referenced by sse.md:23115 (/wrkdirs/usr/ports/lang/gcc10/work/gcc-10.3.0/gcc/config/i386/sse.md:23115)
>>>               build/gencondmd.o:(__cxx_global_var_init.101)
>>> referenced 26 more times

[...many more...]

While this problem is being looked at from a few angles, I did manage to come
up with a workaround, which is to add -O1 to the stage1_cflags variable in the
top-level configure script. This causes the generator programs to be compiled
with at least *some* optimization, so the non-existing references are longer a
problem.

If needed, this patch can also be be applied only in case the host compiler is
clang *and* its version is 12.0.0 or later.

Note also that this patch does nothing if the bootstrap is disabled. In that
case, gcc's build process simply uses the hosts's CFLAGS for compiling the
generator tools, and the linking issues to no occur.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list