On Sat, 21 Aug 2021 21:49:07 -0400
George Koehler <[email protected]> wrote:

> Sorry,
> 
> I probably broke lang/gcc/11 on powerpc when I changed the default
> linker to ld.lld.  I guess that it needs USE_LLD = No, like lang/gcc/8
> does.  I started a build of 11 with the below diff.  The build might
> take a few days.  If it packages, ok to commit the diff?

I edit the comments in the diff to quote the errors from lld.  I edit
the same comment in lang/gcc/8, so the diff is now in lang/gcc.  My
build of lang/gcc/11 with USE_LLD = No is continuing; if it packages,
ok to commit the diff?

Below the diff, I copy the lld errors from gcc/11 on powerpc.
--George

Index: 11/Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/11/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- 11/Makefile 17 Aug 2021 20:22:02 -0000      1.2
+++ 11/Makefile 22 Aug 2021 17:27:51 -0000
@@ -128,6 +128,10 @@ CONFIGURE_ENV += ${EXTRA_ENV}
 MAKE_ENV += ${EXTRA_ENV}
 
 .if ${MACHINE_ARCH} == "powerpc"
+# powerpc lld can't link C++ code from gcc, "ld: error: relocation
+# refers to a discarded section:" .data.rel.ro.* or
+# .sdata.DW.ref.__gxx_personality_v0
+USE_LLD = No
 CONFIGURE_ENV += LDFLAGS="-Wl,--relax"
 .endif
 
Index: 8/Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/8/Makefile,v
retrieving revision 1.45
diff -u -p -r1.45 Makefile
--- 8/Makefile  21 Aug 2021 03:25:05 -0000      1.45
+++ 8/Makefile  22 Aug 2021 17:27:51 -0000
@@ -6,7 +6,9 @@ ONLY_FOR_ARCHS = aarch64 alpha amd64 arm
 # XXX: sparc64
 ONLY_FOR_ARCHS-ada = amd64 hppa i386 mips64 powerpc
 
-# powerpc lld can't link C++ code from gcc
+# powerpc lld can't link C++ code from gcc, "ld: error: relocation
+# refers to a discarded section:" .data.rel.ro.* or
+# .sdata.DW.ref.__gxx_personality_v0
 .if ${MACHINE_ARCH:Mpowerpc}
 USE_LLD = No
 .endif

The below errors come from a build of lang/gcc/11 on a macppc where
/usr/bin/ld = lld, without the above the diff, but with the flag
-Wl,--relax deleted.  (The build of lang/gcc/8 with lld would fail
earlier, because 8's adastrap didn't pass -L/usr/lib to lld, so it
can't find libraries.   11's adastrap does pass -L/usr/lib.)

/usr/ports/pobj/gcc-11.2.0/bin/eg++ -std=c++11 -c   -g -DIN_GCC     
-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 -I. -Ibuild -I/usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc 
-I/usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/build 
-I/usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/../include  
-I/usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/../libcpp/include  \
        -o build/genpreds.o /usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/genpreds.c
/usr/ports/pobj/gcc-11.2.0/bin/eg++ -std=c++11   -g -DIN_GCC     
-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 -L/usr/ports/pobj/gcc-11.2.0/bootstrap/lib  -no-pie -o 
build/genpreds \
    build/genpreds.o build/rtl.o build/read-rtl.o build/ggc-none.o build/vec.o 
build/min-insn-modes.o build/gensupport.o build/print-rtl.o build/hash-table.o 
build/sort.o build/read-md.o build/errors.o 
../build-powerpc-unknown-openbsd7.0/libiberty/libiberty.a
ld: error: relocation refers to a discarded section: 
.data.rel.ro._ZTIN9__gnu_cxx24__concurrence_lock_errorE
>>> defined in /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a(eh_alloc.o)
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x0) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x4) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x8) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a

ld: error: relocation refers to a discarded section: 
.data.rel.ro._ZTIN9__gnu_cxx26__concurrence_unlock_errorE
>>> defined in /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a(eh_alloc.o)
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0xC) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x10) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x14) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a

ld: error: relocation refers to a discarded section: 
.data.rel.ro._ZTVN9__gnu_cxx24__concurrence_lock_errorE
>>> defined in /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a(eh_alloc.o)
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x18) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x1C) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x20) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced 1 more times

ld: error: relocation refers to a discarded section: 
.data.rel.ro._ZTVN9__gnu_cxx26__concurrence_unlock_errorE
>>> defined in /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a(eh_alloc.o)
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x28) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x2C) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x30) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
>>> referenced 1 more times

ld: error: relocation refers to a discarded section: 
.sdata.DW.ref.__gxx_personality_v0
>>> defined in /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a(eh_alloc.o)
>>> referenced by eh_alloc.cc
>>>               eh_alloc.o:(.fixup+0x38) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a

ld: error: relocation refers to a discarded section: 
.sdata.DW.ref.__gxx_personality_v0
>>> defined in 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a(eh_terminate.o)
>>> referenced by eh_terminate.cc
>>>               eh_terminate.o:(.fixup+0x0) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a

ld: error: relocation refers to a discarded section: 
.sdata.DW.ref.__gxx_personality_v0
>>> defined in 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a(eh_globals.o)
>>> referenced by eh_globals.cc
>>>               eh_globals.o:(.fixup+0x0) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a

ld: error: relocation refers to a discarded section: 
.sdata.DW.ref.__gxx_personality_v0
>>> defined in 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a(eh_personality.o)
>>> referenced by eh_personality.cc
>>>               eh_personality.o:(.fixup+0x0) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a

ld: error: relocation refers to a discarded section: 
.sdata.DW.ref.__gxx_personality_v0
>>> defined in 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a(vterminate.o)
>>> referenced by vterminate.cc
>>>               vterminate.o:(.fixup+0x4) in archive 
>>> /usr/ports/pobj/gcc-11.2.0/bootstrap/lib/libestdc++.a
collect2: error: ld returned 1 exit status
gmake[3]: *** [Makefile:3007: build/genpreds] Error 1
gmake[3]: Leaving directory '/usr/ports/pobj/gcc-11.2.0/build-powerpc/gcc'

Reply via email to