From adfd94a35798b1cfaeeac59149f7ef093f8b2ad9 Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Wed, 22 Apr 2020 10:44:15 -0400 Subject: [PATCH] ios: Use compat to provide items missing from the iOS SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This updates the way that the .defs files added in 1bfd7d06ed60 are treated, by putting them in compat/ios, using compat as intended. The .defs files in compat forward, via #include, to the ones in third_party/xnu. Additionally, compat/mac is enabled for iOS, as everything in compat/mac is sensible on iOS, and will have no effect when rendered unnecessary by the iOS SDK. This also changes util:mig_output to a static_library instead of a source_set. I don’t think there was any reason for it to have been a source_set to begin with. static_library is preferred for nearly everything. Bug: crashpad:31 Change-Id: I7c468d6d6785bf2bc825d45831ebb81e1c9ddfbc Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2160310 Reviewed-by: Justin Cohen Commit-Queue: Mark Mentovai --- compat/BUILD.gn | 23 ++++++++++++++++++---- compat/ios/mach/exc.defs | 20 +++++++++++++++++++ compat/ios/mach/mach_exc.defs | 20 +++++++++++++++++++ compat/ios/mach/mach_types.defs | 20 +++++++++++++++++++ compat/ios/mach/machine/machine_types.defs | 20 +++++++++++++++++++ compat/ios/mach/std_types.defs | 20 +++++++++++++++++++ util/BUILD.gn | 7 ++++--- 7 files changed, 123 insertions(+), 7 deletions(-) create mode 100644 compat/ios/mach/exc.defs create mode 100644 compat/ios/mach/mach_exc.defs create mode 100644 compat/ios/mach/mach_types.defs create mode 100644 compat/ios/mach/machine/machine_types.defs create mode 100644 compat/ios/mach/std_types.defs diff --git a/compat/BUILD.gn b/compat/BUILD.gn index 2f246565..9c22acfc 100644 --- a/compat/BUILD.gn +++ b/compat/BUILD.gn @@ -17,12 +17,16 @@ import("../build/crashpad_buildconfig.gni") config("compat_config") { include_dirs = [] - if (crashpad_is_mac) { + if (crashpad_is_mac || crashpad_is_ios) { include_dirs += [ "mac" ] - } else if (!crashpad_is_ios) { + } else { include_dirs += [ "non_mac" ] } + if (crashpad_is_ios) { + include_dirs += [ "ios" ] + } + if (crashpad_is_linux || crashpad_is_android) { include_dirs += [ "linux" ] } @@ -59,15 +63,16 @@ template("compat_target") { compat_target("compat") { sources = [] - if (crashpad_is_mac) { + if (crashpad_is_mac || crashpad_is_ios) { sources += [ "mac/AvailabilityMacros.h", "mac/kern/exc_resource.h", "mac/mach-o/loader.h", + "mac/mach/i386/thread_state.h", "mac/mach/mach.h", "mac/sys/resource.h", ] - } else if (!crashpad_is_ios) { + } else { sources += [ "non_mac/mach-o/loader.h", "non_mac/mach/mach.h", @@ -76,6 +81,16 @@ compat_target("compat") { ] } + if (crashpad_is_ios) { + sources += [ + "ios/mach/exc.defs", + "ios/mach/mach_exc.defs", + "ios/mach/mach_types.defs", + "ios/mach/machine/machine_types.defs", + "ios/mach/std_types.defs", + ] + } + if (crashpad_is_linux || crashpad_is_android) { sources += [ "linux/signal.h", diff --git a/compat/ios/mach/exc.defs b/compat/ios/mach/exc.defs new file mode 100644 index 00000000..d1648e97 --- /dev/null +++ b/compat/ios/mach/exc.defs @@ -0,0 +1,20 @@ +// Copyright 2020 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_COMPAT_IOS_MACH_EXC_DEFS_ +#define CRASHPAD_COMPAT_IOS_MACH_EXC_DEFS_ + +#include "third_party/xnu/osfmk/mach/exc.defs" + +#endif // CRASHPAD_COMPAT_IOS_MACH_EXC_DEFS_ diff --git a/compat/ios/mach/mach_exc.defs b/compat/ios/mach/mach_exc.defs new file mode 100644 index 00000000..c562128e --- /dev/null +++ b/compat/ios/mach/mach_exc.defs @@ -0,0 +1,20 @@ +// Copyright 2020 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_COMPAT_IOS_MACH_MACH_EXC_DEFS_ +#define CRASHPAD_COMPAT_IOS_MACH_MACH_EXC_DEFS_ + +#include "third_party/xnu/osfmk/mach/mach_exc.defs" + +#endif // CRASHPAD_COMPAT_IOS_MACH_MACH_EXC_DEFS_ diff --git a/compat/ios/mach/mach_types.defs b/compat/ios/mach/mach_types.defs new file mode 100644 index 00000000..dc18b8eb --- /dev/null +++ b/compat/ios/mach/mach_types.defs @@ -0,0 +1,20 @@ +// Copyright 2020 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_COMPAT_IOS_MACH_MACH_TYPES_DEFS_ +#define CRASHPAD_COMPAT_IOS_MACH_MACH_TYPES_DEFS_ + +#include "third_party/xnu/osfmk/mach/mach_types.defs" + +#endif // CRASHPAD_COMPAT_IOS_MACH_MACH_TYPES_DEFS_ diff --git a/compat/ios/mach/machine/machine_types.defs b/compat/ios/mach/machine/machine_types.defs new file mode 100644 index 00000000..e906466f --- /dev/null +++ b/compat/ios/mach/machine/machine_types.defs @@ -0,0 +1,20 @@ +// Copyright 2020 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_COMPAT_IOS_MACH_MACHINE_MACHINE_TYPES_DEFS_ +#define CRASHPAD_COMPAT_IOS_MACH_MACHINE_MACHINE_TYPES_DEFS_ + +#include "third_party/xnu/osfmk/mach/machine/machine_types.defs" + +#endif // CRASHPAD_COMPAT_IOS_MACH_MACHINE_MACHINE_TYPES_DEFS_ diff --git a/compat/ios/mach/std_types.defs b/compat/ios/mach/std_types.defs new file mode 100644 index 00000000..e49c6e46 --- /dev/null +++ b/compat/ios/mach/std_types.defs @@ -0,0 +1,20 @@ +// Copyright 2020 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_COMPAT_IOS_MACH_STD_TYPES_DEFS_ +#define CRASHPAD_COMPAT_IOS_MACH_STD_TYPES_DEFS_ + +#include "third_party/xnu/osfmk/mach/std_types.defs" + +#endif // CRASHPAD_COMPAT_IOS_MACH_STD_TYPES_DEFS_ diff --git a/util/BUILD.gn b/util/BUILD.gn index c924b93e..f291f5b7 100644 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -86,14 +86,15 @@ if (crashpad_is_mac || crashpad_is_ios) { ] } args += [ + "--include", + rebase_path("..", root_build_dir), "--include", rebase_path("../compat/mac", root_build_dir), ] if (crashpad_is_ios) { args += [ - # The iOS SDK doesn’t have any .defs files. Get them directly from xnu. "--include", - rebase_path("../third_party/xnu/osfmk", root_build_dir), + rebase_path("../compat/ios", root_build_dir), ] } if (current_cpu == "x86") { @@ -119,7 +120,7 @@ if (crashpad_is_mac || crashpad_is_ios) { } } - source_set("mig_output") { + static_library("mig_output") { deps = [ ":mig" ] sources = get_target_outputs(":mig") if (crashpad_is_in_chromium) {