Sync GCC 4.7 branch with latest master #37

merged 118 commits into from Dec 9, 2012

7 participants


I merged the latest master branch into gcc-4.7 so we'll have the new frontend and the ARM fixes in the gcc-4.7 branch. Among other things this means that we could build and ship binary cross compilers for ARM with crosstool-NG.

I assume we'll use a merge workflow to get the commits from master into gcc-4.7 (as opposed to a rebase / cherry pick workflow).

Merging was actually easier than I though: There were only two merge conflicts, was removed, but the new works fine for gcc 4.7. Then there was a small 2line merge conflict in some file.
GCC version specific changes were easy to fix as well.

The biggest problem is the GCC 4.8 is now compiled as c++ code and 4.7 is compiled as C. For now I backported the GCC 4.8 changes to keep the C / C++ mix we had used before in 4.7. But if we want to support the gcc-4.7 branch it's probably best to change the build scripts to compile all GDC/D FE code as C++ and make sure all GCC imports are extern(C)?

The test suite doesn't show any regressions. gcc 4.7 actually passes 2 more tests than gcc-4.8. I guess that's a bug in the gcc backend?

        === gdc Summary ===

# of expected passes        2478
# of unexpected failures    10
# of unresolved testcases   26
/home/jpf/gdc/objdir/gcc/testsuite/gdc/../../gdc  version 4.7.1 (GCC) 
        === gdc Summary ===

# of expected passes        2476
# of unexpected failures    12
# of unresolved testcases   26
/home/jpf/gdc/objdir2/gcc/testsuite/gdc/../../gdc  version 4.8.0 20121021 (experimental) (GCC) 

The gcc-4.7 patches weren't updated as there were no significant changes in the 4.8 patches. I'll compare the 4.7 and 4.8 patches soon anyway, to make sure those are really synced.

D-Programming-GDC member

Oh noes, looks like I forgot to set-up git username on my server. :o)

ibuclaw and others added some commits Jul 9, 2012
@ibuclaw ibuclaw Remove -fd-inline-asm switch. Add new switch -fsplit-dynamic-arrays w…
…hich turns on passing dynamic arrays as separate (.length, .ptr) parameters. Make use of -fbuiltin switch (builtin functions will not be built when -fno-builtin is in effect, but builtin types will be).
@alexrp alexrp Fix casImpl() logic. 678e41e
@ibuclaw ibuclaw Merge pull request #21 from alexrp/master
Fix casImpl() logic.
@ibuclaw ibuclaw Thunks in GDC now not necessarily private. Handle contracts that can …
…be marked as weak.
@ibuclaw ibuclaw Fix signature for ExtAsmStatement::toCBuffer. 42894d3
@ibuclaw ibuclaw Drop use of client dependent format specifiers. fb972ee
@ibuclaw ibuclaw Remove dependency on html.c, remove html testcases from testsuite. 01211a1
@ibuclaw ibuclaw Merge branch 'master' of ed2ca89
@jkrempus jkrempus Added aliases for 256 and 64 bit vectors to core.simd. 3d447d9
@ibuclaw ibuclaw Merge pull request #23 from jerro/master
Aliases for 64 bit and 256 bit vectors in core.simd
@ibuclaw ibuclaw Remove va_arg template in core.vararg. 6c48bb6
@ibuclaw ibuclaw Remove extern forward declarations fron d-bi-attrs - fix header inclu…
…des in d-builtins.
@ibuclaw ibuclaw Some more coding convention fixes... get started on code documentatio…
…n for each function.
@ibuclaw ibuclaw Carefully add overload for 'double' types to real_t implementation. S…
…hould be enough to allow the removal of all these isConstX functions.
@ibuclaw ibuclaw Remove special casing around DotTypeExp::toElem - implement the funct…
…ion in glue.
@s-ludwig s-ludwig Compile fix 0c11da7
@ibuclaw ibuclaw Merge pull request #24 from s-ludwig/patch-1
Compile fix
@ibuclaw ibuclaw Fix ICE in hwi2toli 79cb463
@ibuclaw ibuclaw Implement longdouble in GDC, merge D frontend code affected. d3dc166
@ibuclaw ibuclaw More documentation, removal of some dead code. f69f282
@ibuclaw ibuclaw Move 'convert' into IRState. 16181d7
@ibuclaw ibuclaw Remove 'needs_temp' - cleaner implementation in isFreeOfSideEffects. c9c62de
@ibuclaw ibuclaw Rename D RT libraries to match DMD ABI, move generation of internal l…
…ibrary symbols from frontend to glue.
@ibuclaw ibuclaw Pass stack frame between functions in the same way closures are passed. 1b68b2b
@ibuclaw ibuclaw Built-in GCC library functions now recognised by keyword unless -fno-…
…builtin, remove aliases from libdruntime. Rename __builtin_Clong to __builtin_clong.
@ibuclaw ibuclaw Call _adEq2 for array equality comparisons, convert static arrays to …
…dynamic in identity comparisons.
@ibuclaw ibuclaw Clean-up va_start/va_arg implementation. Implement two new va_arg fun…
…ctions (one compiler, one runtime).
@ibuclaw ibuclaw Update D Frontend to 2.060 458d3e6
@ibuclaw ibuclaw Sync implementations of doFormat with upstream phobos. 185320f
@ibuclaw ibuclaw Support formatting on architectures that use the standard va_list type. 9ca0475
@ibuclaw ibuclaw Testsuite fix for testformat.d bafd00c
@ibuclaw ibuclaw Update patches for latest GCC 4.8 snapshot. e52bcc0
@ibuclaw ibuclaw Remove extra path level from gcc patch. b2a24f2
@alexrp alexrp Implement atomicFence() (part of 2.060 druntime) for GDC. 283ead5
@ibuclaw ibuclaw Merge pull request #27 from alexrp/master
Implement atomicFence() (part of 2.060 druntime) for GDC.
@ibuclaw ibuclaw Update GDC for latest GCC snapshot, add new documentation page. a73f8e1
@ibuclaw ibuclaw Merge branch 'master' of 31d3032
@ibuclaw ibuclaw Define markAddressable, markRead, markUsed in IRState. Remove old com…
…patibility macros.
@ibuclaw ibuclaw Remove special build rule for gcc.o 7298098
@ibuclaw ibuclaw Clean-up makefile a little more. eefb408
@ibuclaw ibuclaw Remove gcc.config, std.c.unix, x3 configuration files. ffed7d6
@ibuclaw ibuclaw Rebuild configure with autoconf 2.64, Makefile with automake 1.11 52061db
@ibuclaw ibuclaw Be smarter with marking declarations as comdat/extern/static/public. 496b782
@ibuclaw ibuclaw Implement runtime va_arg implementation for ARM/ARM_EABI platforms. 03e34f8
@ibuclaw ibuclaw Remove need for ARM EABI/OABI difference in va_list handling. fc61260
@ibuclaw ibuclaw Clean-up usage of IRState::var. 801d63a
@ibuclaw ibuclaw Remove va_arg declaration. 00bd268
@ibuclaw ibuclaw Some fixes to undefined references for deeply nested template instant…
@ibuclaw ibuclaw Harmonise implementations between IRState::buildChain and FuncDeclara…
…tion::buildClosure to allow a function's frame/closure record to be generated even if function is not compiled into the current module.
@ibuclaw ibuclaw Clean-up nested levels and loops in FuncDeclaration::toObjFile. a7e719a
@ibuclaw ibuclaw Call type_for_size, type_for_mode, type_promotes_to through function …
@ibuclaw ibuclaw Move off conversions of imaginary/real, imaginary/complex, complex/im…
…aginary conversions into backend convert code.
@ibuclaw ibuclaw Add Wcast-result, use build_loc in headers. 947bf99
@ibuclaw ibuclaw Remove _adCmpChar from codegen. bc0e578
@ibuclaw ibuclaw Refactor build_bool_binop, build_math_op, build_assign_math_op into I…
@ibuclaw ibuclaw Fix issue with vector.array not working. Ensure classes are always pa…
…ssed in memory.
@ibuclaw ibuclaw Fix-up whitespace 32791ea
@ibuclaw ibuclaw Code clean-ups. e947206
@ibuclaw ibuclaw Propagate volatile out of type to the field/var decl. ce3e42c
@Poita Poita Added for GitHub ff5f9b8
@ibuclaw ibuclaw Merge pull request #28 from Poita/readme
Added for GitHub
@ibuclaw ibuclaw Remove I/O intrinsics from GDC. 995268e
@ibuclaw ibuclaw Fix spelling of command option -static-libphobos. 87e5466
@ibuclaw ibuclaw Fix link issue with dirEntries() 6df38fb
@ibuclaw ibuclaw Merge branch 'master' of 255685e
@ibuclaw ibuclaw Update for latest GCC snapshot. 7720f6e
@ibuclaw ibuclaw Turn off useless diagnostic options, remove dead compiler options (st…
…ill handled in dmd-script).
@jpf91 jpf91 Fix static array initializers
partial fix for issue #120 (fsection-anchors)

Pad out the rest of static arrays with single elements.
Issue #120 - breaks -fsection-anchors on ARM when
backend calculates field positions for array members.
@jpf91 jpf91 Set correct DECL_SIZE for TypeInfoDeclaration
partial fix for issue #120 (fsection-anchors)
@jpf91 jpf91 Set correct DECL_SIZE for ModuleInfo and ClassInfo
partial fix for issue #120 (fsection-anchors)
@jpf91 jpf91 Fix TypeInfoStruct initializer
partial fix for issue #120 (fsection-anchors)
@jpf91 jpf91 Fix TypeInfo_Function and TypeInfo_Delegate declarations
partial fix for issue #120 (fsection-anchors)
@jpf91 jpf91 ICE on all issue #120 bugs
The problems in issue #120 are caused by an initializer
for a variable with a bigger size than the variables
DECL_SIZE. Detect all those cases and ICE.
@ibuclaw ibuclaw Add new testsuite option EXTRA_FILES. 5f298cb
@ibuclaw ibuclaw Some GDC testsuite fixes relating to LTR evaluation; contacts in pure…
…/nothrow functions; using -J.
@jpf91 jpf91 Update libphobos/libdruntime/
Must include version for ARM EABI Unwinder
@ibuclaw ibuclaw Merge pull request #31 from jpf91/patch-2
Update libphobos/libdruntime/
@ibuclaw ibuclaw Fix alignment issues on x86. cc2366b
@ibuclaw ibuclaw Add support for vector = [array,literal] expressions. 7ada3d9
@ibuclaw ibuclaw Fix VectorExp to handle non-const array literals. 9402516
@ibuclaw ibuclaw Remove useless function attributes. 2b4dc1a
@ibuclaw ibuclaw Set proper size_t type on compiler init. 5a36502
@ibuclaw ibuclaw Remove d-bi-attrs.h - move common frontend attributes to d-builtins.c a9bf567
@ibuclaw ibuclaw Update patches for gcc-4.8.x, re-merge patch scripts back into one se…
@ibuclaw ibuclaw Add missing script 5e24c52
@ibuclaw ibuclaw Remove broken weakref attribute. cd8bb6d
@ibuclaw ibuclaw Sync unwind implementation with gcc. 3292afb
@ibuclaw ibuclaw Bug #15 - ICE in expand_expr_real_1, at expr.c 20c0b77
@ibuclaw ibuclaw Remove redundant gdc.1 d253e49
@ibuclaw ibuclaw Merge pull request #30 from jpf91/fix120
Fix issue 120
@ibuclaw ibuclaw Fixup merge for ARM fsection-anchors fix. 237023b
@ibuclaw ibuclaw Add in basic support for EXECUTE_ARGS in testsuite. a431443
@ibuclaw ibuclaw Fixes Bug #19 - error: non-trivial conversion. bab24a8
@ibuclaw ibuclaw ARM EH fixes. 79ac75c
@ibuclaw ibuclaw More ARM EH fixes. 695629c
@jpf91 jpf91 Rename TARGET_ANDROID macro
GCC sometimes defines it's own TARGET_ANDROID macro which
evaluates to a runtime expression so we can't use it.
Rename our TARGET_ANDROID TARGET_ANDROID_D to avoid clashes
@ibuclaw ibuclaw Merge pull request #36 from jpf91/fixAndroid
@jpf91 jpf91 Merge branch 'master' into gdc-4.7
	gcc/d/ (now
@jpf91 jpf91 Fixes for GCC 4.7
   d_initialize_diagnostics: context->show_caret is not supported
   on gcc 4.7

The GCC 4.8 branch assumes GCC, GDC and the D FE are built as c++
code. For GCC 4.7 GCC is built as C code. For now keep
the separation between D FE (C++), GDC (C/C++) and GCC(C).

To make it easier to keep this branch in sync with the 4.8
branch we should build all GDC / D FE code as C++ code in
the future, but we have to make sure to guard all GCC imports
with extern(C).

BTW: I think this should probably be $(CC_FOR_BUILD) in master as well

(Or rather CXX_FOR_BUILD or COMPILER_FOR_BUILD, whathever the correct name is)

D-Programming-GDC member


D-Programming-GDC member

Do you have any more penned changes to this pull?

D-Programming-GDC member

I don't recall extern "C" being needed here. So long as it's in the header d-lang.h (and this file includes d-lang.h), then it should be ok to be without this.

D-Programming-GDC member

Similarly, here too. I'd instead check gdc_alloca.h first to make sure it is correct.


I'll have a look at those extern(C) blocks, but I think they were necessary for some reason.

The best long term solution is probably to compile gdc as c++ and make all gcc includes extern(C), but it'll take some time to do that.

@ibuclaw ibuclaw commented on the diff Dec 3, 2012
@@ -165,84 +170,79 @@ enum d_tree_index
#define null_node d_global_trees[DTI_NULL]
-#ifdef __cplusplus
ibuclaw Dec 3, 2012 D-Programming-GDC member

See here. If you undo this deletion I'd expect most of your problems will go away. :-)

D-Programming-GDC member

By the way, I'm currently doing a shuffle round that will see similar functions moved into individual files, eg:, This is mostly to remove the need to comment on each function, instead have a single generalised comment at the top saying what these functions do (also going to somewhat merge d-builtins.c /, but you can ignore that as is not compatible with each other in gcc-4.7).

lomereiter and others added some commits Dec 7, 2012
@lomereiter lomereiter update to new vector API in GCC cd3e24b
@ibuclaw ibuclaw Merge pull request #40 from lomereiter/new_gcc_vec_api
update to new vector API in GCC
@jpf91 jpf91 Rework "Fixes for GCC 4.7"
This partially reverts commit 106c26d.

Instead of compiling some parts of the D frontend
with gcc and some with g++ we now compile and link
the complete frontend with g++.

The extern "C" blocks added in 106c26d
were removed, but all gcc includes have to be guarded
with extern "C" now.

Other gcc-4.7 related changes in
were kept.
@jpf91 jpf91 Update gcc 4.7 patch
Include the changes from master branch.
Basically only added documentation.
@jpf91 jpf91 Merge remote-tracking branch 'origin/master' into gdc-4.7
@jpf91 jpf91 Fix some gcc warnings
In gcc4.7 ALL_COMPILERFLAGS includes c specific
flags which are not valid for c++ (-Wstrict-prototypes...)

Using those with c++ generates warnings, so filter
those out.

I changed the build system to built the complete D frontend as C++ just as in GCC-4.8. As expected I had to make sure all gcc imports are marked as extern "C", but that seems to work fine. I think with this approach it should be easier to keep the gcc-4.7 branch up to date if c++ code is being used in future commits.

I also updated the gcc patches (some additional documentation was added) and fixed some gcc warnings which were caused by C-only flags being used with c++ code.

Are d-builtins.c / not compatible because of C vs C++ (so it should work with my latest changes) or are there other differences which prevent them from being merged for gcc-4.7?

D-Programming-GDC member

If i recall correctly, it's more to do with headers that it pulls from gcc aren't extern "C" aware, so will fail to compile if built with a C++ compiler. But if you're happy about the pull, I'm fine with it. Merge Ho!

@ibuclaw ibuclaw merged commit fe65cfe into D-Programming-GDC:gdc-4.7 Dec 9, 2012

@ibuclaw I think I saw some cases of that kind but those were fixable. For example tree.h includes gmp.h, but gmp.h can't be included in extern "C" blocks. So including tree.h in extern "C" fails. This issue can be solved by manually includung gmp.h before including the tree.h file though. I hope it's similar with d-builtins.c / ;-)

D-Programming-GDC member

Only one way to find out. :)

They did introduce Wc++-compat in gcc-4.7, but I don't think it covered all incompatibilities between C/C++. The way some declarations are in some headers C++ may reject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment