ios: Use compat to provide items missing from the iOS SDK

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 <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Mark Mentovai 2020-04-22 10:44:15 -04:00 committed by Commit Bot
parent 64b8791f45
commit adfd94a357
7 changed files with 123 additions and 7 deletions

View File

@ -17,12 +17,16 @@ import("../build/crashpad_buildconfig.gni")
config("compat_config") { config("compat_config") {
include_dirs = [] include_dirs = []
if (crashpad_is_mac) { if (crashpad_is_mac || crashpad_is_ios) {
include_dirs += [ "mac" ] include_dirs += [ "mac" ]
} else if (!crashpad_is_ios) { } else {
include_dirs += [ "non_mac" ] include_dirs += [ "non_mac" ]
} }
if (crashpad_is_ios) {
include_dirs += [ "ios" ]
}
if (crashpad_is_linux || crashpad_is_android) { if (crashpad_is_linux || crashpad_is_android) {
include_dirs += [ "linux" ] include_dirs += [ "linux" ]
} }
@ -59,15 +63,16 @@ template("compat_target") {
compat_target("compat") { compat_target("compat") {
sources = [] sources = []
if (crashpad_is_mac) { if (crashpad_is_mac || crashpad_is_ios) {
sources += [ sources += [
"mac/AvailabilityMacros.h", "mac/AvailabilityMacros.h",
"mac/kern/exc_resource.h", "mac/kern/exc_resource.h",
"mac/mach-o/loader.h", "mac/mach-o/loader.h",
"mac/mach/i386/thread_state.h",
"mac/mach/mach.h", "mac/mach/mach.h",
"mac/sys/resource.h", "mac/sys/resource.h",
] ]
} else if (!crashpad_is_ios) { } else {
sources += [ sources += [
"non_mac/mach-o/loader.h", "non_mac/mach-o/loader.h",
"non_mac/mach/mach.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) { if (crashpad_is_linux || crashpad_is_android) {
sources += [ sources += [
"linux/signal.h", "linux/signal.h",

20
compat/ios/mach/exc.defs Normal file
View File

@ -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_

View File

@ -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_

View File

@ -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_

View File

@ -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_

View File

@ -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_

View File

@ -86,14 +86,15 @@ if (crashpad_is_mac || crashpad_is_ios) {
] ]
} }
args += [ args += [
"--include",
rebase_path("..", root_build_dir),
"--include", "--include",
rebase_path("../compat/mac", root_build_dir), rebase_path("../compat/mac", root_build_dir),
] ]
if (crashpad_is_ios) { if (crashpad_is_ios) {
args += [ args += [
# The iOS SDK doesnt have any .defs files. Get them directly from xnu.
"--include", "--include",
rebase_path("../third_party/xnu/osfmk", root_build_dir), rebase_path("../compat/ios", root_build_dir),
] ]
} }
if (current_cpu == "x86") { 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" ] deps = [ ":mig" ]
sources = get_target_outputs(":mig") sources = get_target_outputs(":mig")
if (crashpad_is_in_chromium) { if (crashpad_is_in_chromium) {