diff mbox

Enable dual ABI for Filesystem TS

Message ID 20151002232201.GA12094@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Oct. 2, 2015, 11:22 p.m. UTC
Currently the Filesystem TS library, libstdc++fs.a, only has symbols
for one ABI, whichever is configured as the default when GCC is built.

This adds dual ABI support, by building the relevant files twice, once
with each ABI (as we do already for libstdc++.so and libstdc++.a).

Tested powerpc64le-linux (both ABIs), committed to trunk.
diff mbox

Patch

commit 6440319e03405094f8746d8dad1d2f21579e1414
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Oct 2 20:41:08 2015 +0100

    Enable dual ABI for Filesystem library
    
    	* src/filesystem/Makefile.am: Add cxx11_abi_sources.
    	* src/filesystem/Makefile.in: Regenerate.
    	* src/filesystem/cow-dir.cc: New.
    	* src/filesystem/cow-ops.cc: New.
    	* src/filesystem/cow-path.cc: New.
    	* src/filesystem/dir.cc: Define macro for new ABI.
    	* src/filesystem/ops.cc: Likewise.
    	* src/filesystem/path.cc: Likewise.

diff --git a/libstdc++-v3/src/filesystem/Makefile.am b/libstdc++-v3/src/filesystem/Makefile.am
index 128cba9..8e332ec4 100644
--- a/libstdc++-v3/src/filesystem/Makefile.am
+++ b/libstdc++-v3/src/filesystem/Makefile.am
@@ -26,10 +26,20 @@  toolexeclib_LTLIBRARIES = libstdc++fs.la
 
 headers =
 
+if ENABLE_DUAL_ABI
+cxx11_abi_sources = \
+	cow-dir.cc \
+	cow-ops.cc \
+	cow-path.cc
+else
+cxx11_abi_sources =
+endif
+
 sources = \
 	dir.cc \
 	ops.cc \
-	path.cc
+	path.cc \
+	${cxx11_abi_sources}
 
 # vpath % $(top_srcdir)/src/filesystem
 
diff --git a/libstdc++-v3/src/filesystem/Makefile.in b/libstdc++-v3/src/filesystem/Makefile.in
index a315bb6..bbc45a8 100644
--- a/libstdc++-v3/src/filesystem/Makefile.in
+++ b/libstdc++-v3/src/filesystem/Makefile.in
@@ -112,8 +112,10 @@  am__uninstall_files_from_dir = { \
 am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
 libstdc__fs_la_LIBADD =
-am__objects_1 = dir.lo ops.lo path.lo
-am_libstdc__fs_la_OBJECTS = $(am__objects_1)
+@ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-dir.lo cow-ops.lo \
+@ENABLE_DUAL_ABI_TRUE@	cow-path.lo
+am__objects_2 = dir.lo ops.lo path.lo $(am__objects_1)
+am_libstdc__fs_la_OBJECTS = $(am__objects_2)
 libstdc__fs_la_OBJECTS = $(am_libstdc__fs_la_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp =
@@ -353,10 +355,17 @@  WARN_CXXFLAGS = \
 AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS)
 toolexeclib_LTLIBRARIES = libstdc++fs.la
 headers = 
+@ENABLE_DUAL_ABI_FALSE@cxx11_abi_sources = 
+@ENABLE_DUAL_ABI_TRUE@cxx11_abi_sources = \
+@ENABLE_DUAL_ABI_TRUE@	cow-dir.cc \
+@ENABLE_DUAL_ABI_TRUE@	cow-ops.cc \
+@ENABLE_DUAL_ABI_TRUE@	cow-path.cc
+
 sources = \
 	dir.cc \
 	ops.cc \
-	path.cc
+	path.cc \
+	${cxx11_abi_sources}
 
 
 # vpath % $(top_srcdir)/src/filesystem
diff --git a/libstdc++-v3/src/filesystem/cow-dir.cc b/libstdc++-v3/src/filesystem/cow-dir.cc
new file mode 100644
index 0000000..b4175ef
--- /dev/null
+++ b/libstdc++-v3/src/filesystem/cow-dir.cc
@@ -0,0 +1,26 @@ 
+// Class filesystem::directory_entry etc. -*- C++ -*-
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+#define _GLIBCXX_USE_CXX11_ABI 0
+#include "dir.cc"
diff --git a/libstdc++-v3/src/filesystem/cow-ops.cc b/libstdc++-v3/src/filesystem/cow-ops.cc
new file mode 100644
index 0000000..6096dec
--- /dev/null
+++ b/libstdc++-v3/src/filesystem/cow-ops.cc
@@ -0,0 +1,26 @@ 
+// Filesystem operations -*- C++ -*-
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+#define _GLIBCXX_USE_CXX11_ABI 0
+#include "ops.cc"
diff --git a/libstdc++-v3/src/filesystem/cow-path.cc b/libstdc++-v3/src/filesystem/cow-path.cc
new file mode 100644
index 0000000..386df59
--- /dev/null
+++ b/libstdc++-v3/src/filesystem/cow-path.cc
@@ -0,0 +1,26 @@ 
+// Class filesystem::path -*- C++ -*-
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+#define _GLIBCXX_USE_CXX11_ABI 0
+#include "path.cc"
diff --git a/libstdc++-v3/src/filesystem/dir.cc b/libstdc++-v3/src/filesystem/dir.cc
index 33280ec..63c10e7 100644
--- a/libstdc++-v3/src/filesystem/dir.cc
+++ b/libstdc++-v3/src/filesystem/dir.cc
@@ -22,6 +22,10 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
+#ifndef _GLIBCXX_USE_CXX11_ABI
+# define _GLIBCXX_USE_CXX11_ABI 1
+#endif
+
 #include <experimental/filesystem>
 #include <utility>
 #include <stack>
diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
index 7b261fb..8152560 100644
--- a/libstdc++-v3/src/filesystem/ops.cc
+++ b/libstdc++-v3/src/filesystem/ops.cc
@@ -22,6 +22,10 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
+#ifndef _GLIBCXX_USE_CXX11_ABI
+# define _GLIBCXX_USE_CXX11_ABI 1
+#endif
+
 #include <experimental/filesystem>
 #include <functional>
 #include <stack>
diff --git a/libstdc++-v3/src/filesystem/path.cc b/libstdc++-v3/src/filesystem/path.cc
index e85c9fc..e9fe465 100644
--- a/libstdc++-v3/src/filesystem/path.cc
+++ b/libstdc++-v3/src/filesystem/path.cc
@@ -22,6 +22,10 @@ 
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
+#ifndef _GLIBCXX_USE_CXX11_ABI
+# define _GLIBCXX_USE_CXX11_ABI 1
+#endif
+
 #include <experimental/filesystem>
 
 using std::experimental::filesystem::path;