Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add -arch x86_64 to CXXFLAGS on macOS ARM64 to Resolve Linker Errors in Mixed C++ and D Testss #21012

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/test/compilable/issue15574.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ int main() {
}
EOF

${CC} -m${MODEL} -c -o ${C_FILE}${OBJ} $C_FILE
if [[ $OS == *"osx"* ]]; then
${CC} -m${MODEL} -arch x86_64 -c -o ${C_FILE}${OBJ} $C_FILE
else
${CC} -m${MODEL} -c -o ${C_FILE}${OBJ} $C_FILE
fi
ar rcs ${C_LIB} ${C_FILE}${OBJ}

${DMD} -m${MODEL} -lib -of${D_LIB} ${D_FILE}
Expand Down
3 changes: 2 additions & 1 deletion compiler/test/runnable_cxx/abi_tags.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* DISABLED: win32 win64
* REQUIRED_ARGS: -extern-std=c++11
* EXTRA_CPP_SOURCES: abi_tags.cpp
* CXXFLAGS: -std=c++11
* CXXFLAGS: -std=c++11
* CXXFLAGS(osx): -arch x86_64
*/

#line 100
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/cabi1.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

// EXTRA_CPP_SOURCES: cabi2.cpp
// CXXFLAGS(osx): -arch x86_64

import core.stdc.stdio;
import core.stdc.config;
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/cpp11.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// REQUIRED_ARGS: -extern-std=c++11
// EXTRA_CPP_SOURCES: cpp11.cpp
// CXXFLAGS(osx linux freebsd openbsd netbsd dragonflybsd solaris): -std=c++11
// CXXFLAGS(osx): -std=c++11 -arch x86_64

// Disabled on win32 because the compiler is too old

Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/cpp_abi_tests.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// EXTRA_CPP_SOURCES: cpp_abi_tests.cpp
// CXXFLAGS(linux freebsd osx openbsd netbsd dragonflybsd): -std=c++11
// CXXFLAGS(osx): -std=c++11 -arch x86_64

// N.B MSVC doesn't have a C++11 switch, but it defaults to the latest fully-supported standard
// N.B MSVC 2013 doesn't support char16_t/char32_t
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/cpp_stdlib.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// DISABLED: win32 win64
// EXTRA_CPP_SOURCES: cpp_stdlib.cpp
// CXXFLAGS(osx linux freebsd openbsd netbsd dragonflybsd solaris): -std=c++11
// CXXFLAGS(osx): -std=c++11 -arch x86_64
import core.stdc.stdio;

// Disabled on windows because it needs bindings
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/cppa.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// REQUIRED_ARGS: -preview=in
// PERMUTE_ARGS: -g
// EXTRA_CPP_SOURCES: cppb.cpp
// CXXFLAGS(osx): -arch x86_64
// EXTRA_FILES: extra-files/cppb.h
// CXXFLAGS(linux freebsd osx openbsd netbsd dragonflybsd): -std=c++11
// druntime isn't linked, this prevents missing symbols '_d_arraybounds_slicep':
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/externmangle.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// EXTRA_CPP_SOURCES: externmangle.cpp
// REQUIRED_ARGS: -extern-std=c++11
// CXXFLAGS(osx): -arch x86_64

import core.stdc.config;
import core.stdc.stdint;
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/externmangle2.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// EXTRA_CPP_SOURCES: externmangle2.cpp
// DISABLED: win
// CXXFLAGS(osx): -arch x86_64

extern(C++):

Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/nonpod_byval.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// EXTRA_CPP_SOURCES: cpp_nonpod_byval.cpp
// CXXFLAGS(linux osx freebsd dragonflybsd): -std=c++11
// CXXFLAGS(osx): -std=c++11 -arch x86_64

extern (C) int printf(const(char)*, ...);

Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/stdint.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// EXTRA_CPP_SOURCES: stdint.cpp
// CXXFLAGS(osx): -arch x86_64

module stdint_test;

Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test14203.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// EXTRA_CPP_SOURCES: c14203.cpp
// CXXFLAGS(osx): -arch x86_64


/************************************************/
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test19179.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// EXTRA_CPP_SOURCES: cpp19179.cpp
// CXXFLAGS(osx): -arch x86_64

// https://issues.dlang.org/show_bug.cgi?id=19179

Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test20652.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// https://issues.dlang.org/show_bug.cgi?id=20652
// EXTRA_CPP_SOURCES: test20652.cpp
// CXXFLAGS(osx): -arch x86_64

import core.simd;

Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test21515.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// https://issues.dlang.org/show_bug.cgi?id=21515
// EXTRA_CPP_SOURCES: test21515.cpp
// CXXFLAGS: -std=c++11
// CXXFLAGS(osx): -std=c++11 -arch x86_64
// DISABLED: win32 win64

// ABI layout of native complex
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test22287.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// EXTRA_CPP_SOURCES: cpp22287.cpp
// CXXFLAGS(osx): -arch x86_64

extern(C++):

Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test22351.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// EXTRA_CPP_SOURCES: test22351.cpp
// REQUIRED_ARGS: -de -extern-std=c++11
// CXXFLAGS: -std=c++11
// CXXFLAGS(osx): -std=c++11 -arch x86_64
// DISABLED: win32

extern(C++) class A22351
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test22898.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// EXTRA_CPP_SOURCES: test22898.cpp
// CXXFLAGS(osx): -arch x86_64

import core.stdc.config;

Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test23135.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// EXTRA_CPP_SOURCES: test23135.cpp
// REQUIRED_ARGS: -extern-std=c++11
// CXXFLAGS: -std=c++11
// CXXFLAGS(osx): -std=c++11 -arch x86_64
// DISABLED: win32

void main()
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test24292.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// EXTRA_CPP_SOURCES: test24292.cpp
// CXXFLAGS(osx): -arch x86_64

extern(C++) struct List(T)
{
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test6716.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// EXTRA_CPP_SOURCES: test6716.cpp
// CXXFLAGS(osx): -arch x86_64

version(Windows)
{
Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/test7925.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// EXTRA_CPP_SOURCES: cpp7925.cpp
// CXXFLAGS(osx): -arch x86_64

import core.vararg;

Expand Down
1 change: 1 addition & 0 deletions compiler/test/runnable_cxx/testbitfields.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// EXTRA_CPP_SOURCES: testbitfields_cpp.cpp
// EXTRA_SOURCES: extra-files/testbitfields_importc.c
// CXXFLAGS(linux osx freebsd dragonflybsd): -std=c++11
// CXXFLAGS(osx): -std=c++11 -arch x86_64

import core.stdc.stdio;
import core.stdc.stdlib;
Expand Down
Loading