Page MenuHomePhabricator

Fix C++ support on recent DragonFly BSD releases
ClosedPublic

Authored by dim on Dec 2 2015, 4:15 PM.

Details

Summary

[ Copied from https://llvm.org/bugs/show_bug.cgi?id=25597 ]

Clang support for DragonFly BSD is lagging a bit, resulting in poor
support for c++.

DragonFlyBSD is unique in that it has two base compilers. At the time
of the last Clang update for DragonFly, these compilers were GCC 4.4 and
GCC 4.7 (default).

With DragonFly Release 4.2, GCC 4.4 was replaced with GCC 5.0, partially
because the C++11 support of GCC 4.7 was incomplete. The DragonFly
project will Release version 4.4 soon.

This patch updates the Clang driver to use libstdc++ from GCC 5.2 The
support for falling back to the alternate compiler was removed for two
reasons:

  1. The last release to use GCC 4.7 is DF 4.0 which has already reached EOL
  2. GCC 4.7 libstdc++ is insufficient for many "ports"

Therefore, I think it is reasonable that the development version of
clang expects GCC 5.2 to be in place and not try to fall back to another
compiler.

The attached patch will do this. The Tools.cpp file was signficantly
modified to fix the linking which had been changed somewhere along the
line. The rest of the changes should be self-explanatory.

Diff Detail

Event Timeline

dim updated this revision to Diff 41689.Dec 2 2015, 4:15 PM
dim retitled this revision from to Fix C++ support on recent DragonFly BSD releases.
dim updated this object.
dim added reviewers: joerg, rsmith.
dim added a subscriber: cfe-commits.
davide accepted this revision.Dec 22 2015, 3:27 AM
davide added a reviewer: davide.
davide added a subscriber: davide.

The patch looks good, and the changes are localized to the DflyBSD driver so if you tested and works, I'm fine with it. I'll comit that unless objections rise.

This revision is now accepted and ready to land.Dec 22 2015, 3:27 AM

Hi, can someone take a look at D15166?
It's a simple patch but critical for DragonFly.

Hi Davide,

Yes, the patch is tested it. We are carrying them in FreeBSD ports (which DragonFly uses), so they are being used now.

dim added a comment.Dec 27 2015, 1:55 AM

Tried this with trunk r256465, but I get the following test failure:

    FAIL: Clang :: Driver/dragonfly.c (3997 of 30174)
    ******************** TEST 'Clang :: Driver/dragonfly.c' FAILED ********************
    Script:
    --
    /home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/./bin/clang  -no-canonical-prefixes -target x86_64-pc-dragonfly /share/dim/src/llvm/trunk/tools/clang/test/Driver/dragonfly.c -### 2> /home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/tools/clang/test/Driver/Output/dragonfly.c.tmp.log
    /home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/./bin/FileCheck -input-file /home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/tools/clang/test/Driver/Output/dragonfly.c.tmp.log /share/dim/src/llvm/trunk/tools/clang/test/Driver/dragonfly.c
    --
    Exit Code: 1

    Command Output (stderr):
    --
    /share/dim/src/llvm/trunk/tools/clang/test/Driver/dragonfly.c:5:11: error: expected string not found in input
    // CHECK: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/usr/libexec/ld-elf.so.{{.*}}" "--hash-style=gnu" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-L{{.*}}gcc{{.*}}" "-rpath" "{{.*}}gcc{{.*}}" "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o"
	      ^
    /home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/tools/clang/test/Driver/Output/dragonfly.c.tmp.log:5:115: note: scanning from here
     "/home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/./bin/clang" "-cc1" "-triple" "x86_64-pc-dragonfly" "-emit-obj" "-mrelax-all" "-disable-free" "-main-file-name" "dragonfly.c" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-dwarf-column-info" "-debugger-tuning=gdb" "-resource-dir" "/home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/./bin/../lib/clang/3.8.0" "-fdebug-compilation-dir" "/home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/tools/clang/test/Driver" "-ferror-limit" "19" "-fmessage-length" "0" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-o" "/tmp/dragonfly-a045e8.o" "-x" "c" "/share/dim/src/llvm/trunk/tools/clang/test/Driver/dragonfly.c"
														      ^

@jrmarino, any idea? The actual output of the script was:

clang version 3.8.0 (trunk 256465)
Target: x86_64-pc-dragonfly
Thread model: posix
InstalledDir: /home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/./bin
 "/home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/./bin/clang" "-cc1" "-triple" "x86_64-pc-dragonfly" "-emit-obj" "-mrelax-all" "-disable-free" "-main-file-name" "dragonfly.c" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-dwarf-column-info" "-debugger-tuning=gdb" "-resource-dir" "/home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/./bin/../lib/clang/3.8.0" "-fdebug-compilation-dir" "/home/dim/obj/llvm-256465M-trunk-freebsd11-i386-ninja-rel-1/tools/clang/test/Driver" "-ferror-limit" "19" "-fmessage-length" "0" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-o" "/tmp/dragonfly-a045e8.o" "-x" "c" "/share/dim/src/llvm/trunk/tools/clang/test/Driver/dragonfly.c"
 "/usr/local/bin/ld" "--eh-frame-hdr" "-dynamic-linker" "/usr/libexec/ld-elf.so.2" "--hash-style=gnu" "--enable-new-dtags" "-o" "a.out" "/usr/lib/crt1.o" "/usr/lib/crti.o" "/usr/lib/crtbegin.o" "/tmp/dragonfly-a045e8.o" "-L/usr/lib/gcc50" "-rpath" "/usr/lib/gcc50" "-lc" "-lgcc" "--as-needed" "-lgcc_pic" "--no-as-needed" "/usr/lib/crtend.o" "/usr/lib/crtn.o"
dim updated this revision to Diff 43654.Dec 27 2015, 2:04 AM
dim edited edge metadata.

Fix the test to check for --enable-new-dtags.

dim closed this revision.Dec 27 2015, 2:05 AM