Bug 82092 - [8/9 regression] gcc fails to link genmodes on darwin (cfiStartsArray[i] != cfiStartsArray[i-1])
Summary: [8/9 regression] gcc fails to link genmodes on darwin (cfiStartsArray[i] != c...
Status: RESOLVED DUPLICATE of bug 81033
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 8.0
: P2 normal
Target Milestone: 8.3
Assignee: Not yet assigned to anyone
URL:
Keywords: build
: 82315 86639 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-09-03 20:01 UTC by Jeremy Huddleston Sequoia
Modified: 2018-07-26 19:14 UTC (History)
7 users (show)

See Also:
Host:
Target: *-*-darwin
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-09-24 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Huddleston Sequoia 2017-09-03 20:01:32 UTC
Snapshot 8-20170604 (trunk r248863) builds fine on darwin.
Snapshot 8-20170611 (trunk r249106) and later (through at least 8-20170827, r251369) fail to build on darwin.

The build fails with the linker failing an assert due to invalid output produced by the compiler when building genmodes:

make[3]: Entering directory `/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/build/gcc'
/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/build/./prev-gcc/xg++ -B/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/build/./prev-gcc/ -B/opt/local/x86_64-apple-darwin17/bin/ -nostdinc++ -B/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/build/prev-x86_64-apple-darwin17/libstdc++-v3/src/.libs -B/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/build/prev-x86_64-apple-darwin17/libstdc++-v3/libsupc++/.libs  -isystem /opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/build/prev-x86_64-apple-darwin17/libstdc++-v3/include/x86_64-apple-darwin17  -isystem /opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/build/prev-x86_64-apple-darwin17/libstdc++-v3/include  -isystem /opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/gcc-8-20170827/libstdc++-v3/libsupc++ -L/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/build/prev-x86_64-apple-darwin17/libstdc++-v3/src/.libs -L/opt/local/var/macports/build/_Users_jeremy_src_macports_macports-ports_lang_gcc8/libgcc-devel/work/build/prev-x86_64-apple-darwin17/libstdc++-v3/libsupc++/.libs   -g -O2   -gtoggle -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE -fno-PIE -static-libstdc++ -static-libgcc -Wl,-no_pie  -o build/genmodes \
	    build/genmodes.o build/errors.o .././libiberty/libiberty.a
0  0x101edfb1b  __assert_rtn + 129
1  0x101ef323a  mach_o::relocatable::Parser<x86_64>::parse(mach_o::relocatable::ParserOptions const&) + 3030
2  0x101eeabcc  mach_o::relocatable::Parser<x86_64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 282
3  0x101f2fae4  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 830
4  0x101f3246d  ld::tool::InputFiles::parseWorkerThread() + 497
5  0x7fff7ec806c1  _pthread_body + 340
6  0x7fff7ec8056d  _pthread_body + 0
A linker snapshot was created at:
	/tmp/genmodes-2017-08-03-125525.ld-snapshot
ld: Assertion failed: (cfiStartsArray[i] != cfiStartsArray[i-1]), function parse, file /Library/Caches/com.apple.xbs/Sources/ld64/ld64-302.4/src/ld/parsers/macho_relocatable_file.cpp, line 1898.
collect2: error: ld returned 1 exit status

This happens with all versions of macOS that I’ve tried (El Capitan through High Sierra).

See also bug #57438
Comment 1 Eric Gallager 2017-09-24 18:27:24 UTC
*** Bug 82315 has been marked as a duplicate of this bug. ***
Comment 2 Eric Gallager 2017-09-24 18:28:00 UTC
I'll take the dup as confirmation.
Comment 3 Dominique d'Humieres 2017-09-24 18:46:28 UTC
On darwin10, starting at revision r249105, bootstrap fails with

Undefined symbols:
  "CIE.eh", referenced from:
      CIE in _negvdi2_s.o

unless I use

--- ../_clean/gcc/config/darwin.c	2017-09-18 15:49:48.000000000 +0200
+++ gcc/config/darwin.c	2017-09-23 21:00:41.000000000 +0200
@@ -3201,6 +3201,10 @@ darwin_override_options (void)
       flag_reorder_blocks = 1;
     }
 
+    // FIXME ; Jam this off until we figure out what codegen issues are caused
+    flag_reorder_blocks_and_partition = 0;
+    flag_reorder_blocks = 1;
+
     /* FIXME: flag_objc_sjlj_exceptions is no longer needed since there is only
        one valid choice of exception scheme for each runtime.  */
     if (!global_options_set.x_flag_objc_sjlj_exceptions)

Could you please test this patch?
Comment 4 Iain Sandoe 2017-09-24 20:52:38 UTC
(I don't see the reported problem on Darwin15 with any assembler/linker pair I have)

However,we're certain there's an underlying issue.

We're seeing a variety of problems which are all pointing some difficulty introduced by reorder and partition.  My current suspicion is that some code fragment isn't a legal atom.

With current trunk I'm seeing repeatable dwarf verify errors for eh sections in some of the libgcc objects - will be debugging these.

Most likely this is also a dup of 81733.

So - Dominique's comment #3 is worth testing to determine if the issue you see is another in this series.

I don't think it's the same underlying cause as 57438 (that was caused by function bodies being elided when the function contained an inline __builtin_unreachable()).

Arguably, 0-sized FDEs could be dropped by ld64 (I have a patch that does this), since an exception cannot originate from a 0-sized region.  However, it would still be worth warning even so since it probably indicates a code-gen issue earlier in the toolchain (as we suspect here).
Comment 5 Jürgen Reuter 2017-09-29 07:13:46 UTC
Interestingly, I get the problem only with Xcode 9.0 and MAC OS X Sierra Darwin 16.6, but not with Xcode 9.0 and Mac OS X High Sierra Darwin 16.7.
Comment 6 Ryan Schmidt 2017-12-20 10:50:23 UTC
(In reply to Dominique d'Humieres from comment #3)
> --- ../_clean/gcc/config/darwin.c	2017-09-18 15:49:48.000000000 +0200
> +++ gcc/config/darwin.c	2017-09-23 21:00:41.000000000 +0200
> @@ -3201,6 +3201,10 @@ darwin_override_options (void)
>        flag_reorder_blocks = 1;
>      }
>  
> +    // FIXME ; Jam this off until we figure out what codegen issues are
> caused
> +    flag_reorder_blocks_and_partition = 0;
> +    flag_reorder_blocks = 1;
> +
>      /* FIXME: flag_objc_sjlj_exceptions is no longer needed since there is
> only
>         one valid choice of exception scheme for each runtime.  */
>      if (!global_options_set.x_flag_objc_sjlj_exceptions)
> 
> Could you please test this patch?

Yes, this patch does allow gcc 8-20171217 to build for me on macOS Sierra with Xcode 9.2.

Is this patch safe for us to commit to MacPorts to be able to update our gcc8 port?
Comment 7 Jürgen Reuter 2017-12-21 16:16:49 UTC
I can confirm that the patch above indeed does work. Interestingly, I don't see the bootstrap on all combinations of Apple Hardware and MAC OS X versions. Apparently, the problem (for me) only shows up on an 2011 Apple i5 with both Sierra and High Sierra and XCode 9.X. AFAI can say, the problem doesn't arise for a 2015 i7 with the same combinations of OSX and XCode versions. 
Back to the fix by Dominique: yes, it works for the problematic combination I checked.
Comment 8 Jürgen Reuter 2017-12-21 16:45:45 UTC
Another thing I observed: one difference between the laptop where the bootstrap worked and the one where it didn't work (besides the different chipsets i5 vs. i7) is that on the one where the bootstrap doesn't work, the MAC OS X Security Integrity Protocol (SIP) is activated, while on the one where the bootstrap worked it is deactivated. Could it be that during the bootstrap procedure the SIP causes some trouble in that some of the settings of the gcc to be bootstrapped are being blocked?
Comment 9 Ryan Schmidt 2017-12-29 01:34:05 UTC
Is it safe to use the patch? Will a gcc built with the patch produce correct code?

If so, I would like to include it in MacPorts so that I can update our gcc8 port to a newer version. Because of this problem, we have not been able to do so since June 2017.
Comment 10 Ryan Schmidt 2018-05-09 18:49:46 UTC
Is gcc8 ever going to be buildable on macOS again? It's been unbuildable for 11 months now.
Comment 11 Eric Gallager 2018-05-10 00:29:36 UTC
(In reply to Ryan Schmidt from comment #10)
> Is gcc8 ever going to be buildable on macOS again? It's been unbuildable for
> 11 months now.

Maybe adding a regression marker will get people to notice...
Comment 12 Claus-Justus Heine 2018-06-03 16:18:32 UTC
Still no go, even with that patch:

./auto-host.h:2396:16: error: declaration does not declare anything [-fpermissive]
 #define rlim_t long

And:

In file included from /Users/heinecj/Software/src/gcc-8.1.0/build/prev-x86_64-apple-darwin16.7.0/libstdc++-v3/include/cstring:42,
                 from ../../gcc/system.h:235,
                 from ../../gcc/genmodes.c:21:
/usr/include/string.h:134:7: note: previous declaration 'char* strsignal(int)'
 char *strsignal(int __sig);

This is OSX Yosemite with that patch mentioned above applied, enable-languages=c,c++,fortran and latest mpc, gmp, mpfr, isl.

Cheers
Comment 13 Eric Gallager 2018-06-03 18:54:09 UTC
(In reply to Claus-Justus Heine from comment #12)
> Still no go, even with that patch:
> 
> ./auto-host.h:2396:16: error: declaration does not declare anything
> [-fpermissive]
>  #define rlim_t long
> 
> And:
> 
> In file included from
> /Users/heinecj/Software/src/gcc-8.1.0/build/prev-x86_64-apple-darwin16.7.0/
> libstdc++-v3/include/cstring:42,
>                  from ../../gcc/system.h:235,
>                  from ../../gcc/genmodes.c:21:
> /usr/include/string.h:134:7: note: previous declaration 'char*
> strsignal(int)'
>  char *strsignal(int __sig);
> 
> This is OSX Yosemite with that patch mentioned above applied,
> enable-languages=c,c++,fortran and latest mpc, gmp, mpfr, isl.
> 
> Cheers

That might be a different issue...
Comment 14 Francois-Xavier Coudert 2018-06-08 08:16:20 UTC
Homebrew has been shipping GCC 8.1.0 (unmatched) since release: it builds fine on our CI machines, and we haven't had a user bug report since then. I wasn't even aware that there was a potential issue.
Comment 15 Ryan Schmidt 2018-06-08 19:59:24 UTC
Yes, I noticed Homebrew had the update, and I didn't understand why it worked there. But now I do.

Some more information has turned up in a new MacPorts ticket:

https://trac.macports.org/ticket/56521

In MacPorts gcc ports, we use --with-as=/opt/local/bin/as (this assembler is provided by our cctools port). This change was made in MacPorts 6 years ago by Jeremy who reported this bug, though I'm not entirely sure why.

I suspect the problem is that our cctools port is currently at version 895, which corresponds to what's in Xcode 8.1, and that's apparently too old to work properly in this case. I am able to get a more recent snapshot to build if I instead use --with-as=/usr/bin/as, so perhaps we either need to do that in MacPorts or we need to update our cctools port to a more recent version.
Comment 16 Eric Gallager 2018-06-21 10:26:58 UTC
(In reply to Ryan Schmidt from comment #15)
> Yes, I noticed Homebrew had the update, and I didn't understand why it
> worked there. But now I do.
> 
> Some more information has turned up in a new MacPorts ticket:
> 
> https://trac.macports.org/ticket/56521
> 
> In MacPorts gcc ports, we use --with-as=/opt/local/bin/as (this assembler is
> provided by our cctools port). This change was made in MacPorts 6 years ago
> by Jeremy who reported this bug, though I'm not entirely sure why.
> 
> I suspect the problem is that our cctools port is currently at version 895,
> which corresponds to what's in Xcode 8.1, and that's apparently too old to
> work properly in this case. I am able to get a more recent snapshot to build
> if I instead use --with-as=/usr/bin/as, so perhaps we either need to do that
> in MacPorts or we need to update our cctools port to a more recent version.

Please let us know how your update goes!
Comment 17 Eric Gallager 2018-07-23 11:44:09 UTC
*** Bug 86639 has been marked as a duplicate of this bug. ***
Comment 18 Jakub Jelinek 2018-07-26 11:01:48 UTC
GCC 8.2 has been released.
Comment 19 zf 2018-07-26 12:54:14 UTC
With OS 10.9.5 I run in the very same error with gcc 8.2.0 as with 8.1.0:

/bin/sh ../../../libgcc/../mkinstalldirs .
/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/xgcc -B/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/bin/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/lib/ -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/include -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=10.5 -pipe -fno-common -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -mmacosx-version-min=10.5 -pipe -fno-common -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../include  -DHAVE_CC_TLS -DUSE_EMUTLS -o _udiv_w_sdiv.o -MT _udiv_w_sdiv.o -MD -MP -MF _udiv_w_sdiv.dep -DL_udiv_w_sdiv -c ../../../../libgcc/libgcc2.c \
	  -fexceptions -fnon-call-exceptions -fvisibility=hidden -DHIDE_EXPORTS
/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/xgcc -B/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/bin/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/lib/ -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/include -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/sys-include    -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=10.5 -pipe -fno-common -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -dynamiclib -nodefaultlibs -install_name /usr/local/gcc-8.2/lib/libgcc_s.1.dylib -single_module -o ./libgcc_s.dylib -Wl,-exported_symbols_list,libgcc.map -compatibility_version 1 -current_version 1.0 -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulhc3_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divhc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _fixsfti_s.o _fixdfti_s.o _fixxfti_s.o _fixtfti_s.o _fixunssfti_s.o _fixunsdfti_s.o _fixunsxfti_s.o _fixunstfti_s.o _floattisf_s.o _floattidf_s.o _floattixf_s.o _floattitf_s.o _floatuntisf_s.o _floatuntidf_s.o _floatuntixf_s.o _floatuntitf_s.o _divdi3_s.o _moddi3_s.o _divmoddi4_s.o _udivdi3_s.o _umoddi3_s.o _udivmoddi4_s.o _udiv_w_sdiv_s.o darwin-64_s.o cpuinfo_s.o sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o floatunditf_s.o fixtfti_s.o fixunstfti_s.o floattitf_s.o floatuntitf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde-darwin_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc
/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/xgcc -B/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/bin/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/lib/ -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/include -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=10.5 -pipe -fno-common -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -mmacosx-version-min=10.5 -pipe -fno-common -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../include  -DHAVE_CC_TLS -DUSE_EMUTLS -o darwin-64.o -MT darwin-64.o -MD -MP -MF darwin-64.dep  -c ../../../../libgcc/config/darwin-64.c -fvisibility=hidden -DHIDE_EXPORTS
/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/xgcc -B/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/bin/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/lib/ -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/include -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=10.5 -pipe -fno-common -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -mmacosx-version-min=10.5 -pipe -fno-common -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../include  -DHAVE_CC_TLS -DUSE_EMUTLS -o cpuinfo.o -MT cpuinfo.o -MD -MP -MF cpuinfo.dep  -c ../../../../libgcc/config/i386/cpuinfo.c -fvisibility=hidden -DHIDE_EXPORTS
/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/xgcc -B/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/bin/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/lib/ -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/include -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=10.5 -pipe -fno-common -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -mmacosx-version-min=10.5 -pipe -fno-common -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../include  -DHAVE_CC_TLS -DUSE_EMUTLS -o tf-signs.o -MT tf-signs.o -MD -MP -MF tf-signs.dep  -c ../../../../libgcc/config/i386/32/tf-signs.c -fvisibility=hidden -DHIDE_EXPORTS
/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/xgcc -B/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/bin/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/lib/ -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/include -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=10.5 -pipe -fno-common -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -mmacosx-version-min=10.5 -pipe -fno-common -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../include  -DHAVE_CC_TLS -DUSE_EMUTLS -o sfp-exceptions.o -MT sfp-exceptions.o -MD -MP -MF sfp-exceptions.dep  -c ../../../../libgcc/config/i386/sfp-exceptions.c -fvisibility=hidden -DHIDE_EXPORTS
/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/xgcc -B/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/bin/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/lib/ -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/include -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=10.5 -pipe -fno-common -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -mmacosx-version-min=10.5 -pipe -fno-common -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../include  -DHAVE_CC_TLS -DUSE_EMUTLS -Wno-missing-prototypes -Wno-type-limits -o addtf3.o -MT addtf3.o -MD -MP -MF addtf3.dep  -c ../../../../libgcc/soft-fp/addtf3.c -fvisibility=hidden -DHIDE_EXPORTS
/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/xgcc -B/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/bin/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/lib/ -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/include -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=10.5 -pipe -fno-common -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -mmacosx-version-min=10.5 -pipe -fno-common -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../include  -DHAVE_CC_TLS -DUSE_EMUTLS -Wno-missing-prototypes -Wno-type-limits -o divtf3.o -MT divtf3.o -MD -MP -MF divtf3.dep  -c ../../../../libgcc/soft-fp/divtf3.c -fvisibility=hidden -DHIDE_EXPORTS
0  0x10e44e0e7  __assert_rtn + 144
1  0x10e473759  mach_o::relocatable::Parser<x86_64>::parse(mach_o::relocatable::ParserOptions const&) + 3213
2  0x10e4589e2  mach_o::relocatable::Parser<x86_64>::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 374
3  0x10e498303  ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 651
4  0x10e499ff9  ld::tool::InputFiles::parseWorkerThread() + 271
5  0x7fff8df5d899  _pthread_body + 138
6  0x7fff8df5d72a  _pthread_struct_init + 0
A linker snapshot was created at:
	/tmp/libgcc_s.dylib-2018-06-26-145212.ld-snapshot
ld: Assertion failed: (cfiStartsArray[i] != cfiStartsArray[i-1]), function parse, file /SourceCache/ld64/ld64-236.4/src/ld/parsers/macho_relocatable_file.cpp, line 1685.
collect2: error: ld returned 1 exit status
/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/xgcc -B/Volumes/Platte/yves/Desktop/gcc-8.2.0/build/./gcc/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/bin/ -B/usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/lib/ -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/include -isystem /usr/local/gcc-8.2/x86_64-apple-darwin13.4.0/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -mmacosx-version-min=10.5 -pipe -fno-common -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -mmacosx-version-min=10.5 -pipe -fno-common -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../include  -DHAVE_CC_TLS -DUSE_EMUTLS -Wno-missing-prototypes -Wno-type-limits -o eqtf2.o -MT eqtf2.o -MD -MP -MF eqtf2.dep  -c ../../../../libgcc/soft-fp/eqtf2.c -fvisibility=hidden -DHIDE_EXPORTS
make[3]: *** [libgcc_s.dylib] Error 1
Comment 20 Iain Sandoe 2018-07-26 15:29:31 UTC
(In reply to zf from comment #19)
> With OS 10.9.5 I run in the very same error with gcc 8.2.0 as with 8.1.0:

I think this is a duplicate of pr81033 (please try the patch for 8.2 there and if that resolves this, we will point this pr to 81033)
Comment 21 zf 2018-07-26 17:59:28 UTC
With the patch, make of gcc8.2.0 runs without errors on OS 10.9.5.

The produced compiler builds .o files of a test program, but I have a problem with linking. This could be my fault, I am not that familiar with the needed paths. I Installed gcc the new recommended way, in a own folder and might have missed setting some paths.


yves$ echo $PATH
/usr/local/gcc-8.2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local
yves$ echo $DYLD_LIBRARY_PATH
/usr/local/gcc-8.2/lib
yves$ gcc-8.2 hello-world.cpp 
Undefined symbols for architecture x86_64:
  "std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))", referenced from:
      _main in cc3Uycyg.o
  "std::ios_base::Init::Init()", referenced from:
      __static_initialization_and_destruction_0(int, int) in cc3Uycyg.o
  "std::ios_base::Init::~Init()", referenced from:
      __static_initialization_and_destruction_0(int, int) in cc3Uycyg.o
  "std::cout", referenced from:
      _main in cc3Uycyg.o
  "std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)", referenced from:
      _main in cc3Uycyg.o
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
      _main in cc3Uycyg.o
ld: symbol(s) not found for architecture x86_64
collect2: Fehler: ld gab 1 als Ende-Status zurück
Comment 22 Iain Sandoe 2018-07-26 19:14:37 UTC
(In reply to zf from comment #21)
> With the patch, make of gcc8.2.0 runs without errors on OS 10.9.5.
> 
> The produced compiler builds .o files of a test program, but I have a
> problem with linking. 


> yves$ echo $PATH
> /usr/local/gcc-8.2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/
> local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local
> yves$ echo $DYLD_LIBRARY_PATH
> /usr/local/gcc-8.2/lib
> yves$ gcc-8.2 hello-world.cpp 

if you want the driver to add the c++ library etc. then you should be using g++-8.2?

closing this as a duplicate of 81033
 * if you need more general help on running the compiler, there are manuals on-line https://gcc.gnu.org/onlinedocs/
 and a help channel on freenode irc

*** This bug has been marked as a duplicate of bug 81033 ***