Skip to content

Commit

Permalink
Cherry pick PR #1743: Enable modular build for gcc 6.3 (#1970)
Browse files Browse the repository at this point in the history
Refer to the original PR: #1743

b/303749197

Change-Id: Ie39ad1ab0b8a61357fcff133786cc9469bbadcd4

Co-authored-by: y4vor <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and y4vor authored Jan 25, 2024
1 parent 61fe23c commit 16884d6
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .github/config/linux-gcc-6-3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"docker_service": "build-linux-gcc",
"on_host_test": true,
"on_host_test_shards": ["0", "1", "2", "3", "blackbox", "wpt"],
"platforms": [
"linux-x64x11-gcc-6-3"
],
Expand All @@ -8,7 +10,7 @@
"name":"gcc-6-3",
"platform":"linux-x64x11-gcc-6-3",
"target_platform":"linux-x64x11-gcc-6-3",
"extra_gn_arguments":"is_clang=false using_old_compiler=true"
"extra_gn_arguments":"using_old_compiler=true build_with_separate_cobalt_toolchain=true"
}
]
}
1 change: 1 addition & 0 deletions .github/workflows/linux_24.lts.1+.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
with:
platform: linux-gcc-6-3
nightly: ${{ github.event.inputs.nightly }}
modular: true
# TODO(b/285632780): Enable blackbox tests for modular linux workflows.
linux-modular:
uses: ./.github/workflows/main.yaml
Expand Down
6 changes: 6 additions & 0 deletions starboard/linux/x64x11/gcc/6.3/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ static_library("starboard_platform") {

configs += [ "//starboard/build/config:starboard_implementation" ]
}

if (build_with_separate_cobalt_toolchain) {
group("starboard_platform_with_main") {
deps = [ "//starboard/linux/x64x11:starboard_platform_with_main" ]
}
}
2 changes: 1 addition & 1 deletion starboard/linux/x64x11/gcc/6.3/args.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
target_platform = "linux-x64x11-gcc-6-3"
target_os = "linux"
target_cpu = "x64"
is_clang = false
using_old_compiler = true
build_with_separate_cobalt_toolchain = true
7 changes: 7 additions & 0 deletions starboard/linux/x64x11/gcc/6.3/cobalt/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# limitations under the License.
"""Starboard Linux x64x11 GCC 6.3 Cobalt configuration."""

import os

from starboard.linux.shared.cobalt import configuration as shared_configuration
from starboard.tools.testing import test_filter

Expand All @@ -33,3 +35,8 @@ def GetTestFilters(self):
'ZipReaderTest.ExtractToFileAsync_RegularFile',
],
}
if os.getenv('MODULAR_BUILD', '0') == '1':
# TODO: b/303845477 Re-enable.
__FILTERED_TESTS['blackbox'] = [
'wasm_basic_test',
]
23 changes: 16 additions & 7 deletions starboard/linux/x64x11/gcc/6.3/platform_configuration/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ config("compiler_flags") {
cflags = []
cflags_c = []
cflags_cc = []
ldflags = []

ldflags = [
# Cleanup unused sections
"-Wl,-gc-sections",
]

# from common_compiler_flags
cflags += [
Expand Down Expand Up @@ -99,10 +103,15 @@ config("compiler_flags") {
}

config("platform_configuration") {
configs = [
"//starboard/linux/shared/platform_configuration",
"//starboard/linux/x64x11/shared/platform_configuration:libraries",
"//starboard/build/config/sabi",
":compiler_flags",
]
if (current_toolchain == default_toolchain &&
build_with_separate_cobalt_toolchain) {
configs = [ "//starboard/evergreen/x64/platform_configuration" ]
} else {
configs = [
"//starboard/linux/shared/platform_configuration",
"//starboard/linux/x64x11/shared/platform_configuration:libraries",
"//starboard/build/config/sabi",
":compiler_flags",
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//starboard/linux/shared/platform_configuration/configuration.gni")
if (current_toolchain == default_toolchain &&
build_with_separate_cobalt_toolchain) {
import("//starboard/evergreen/x64/platform_configuration/configuration.gni")
platform_tests_path =
"//starboard/linux/shared:starboard_platform_tests($starboard_toolchain)"
cobalt_font_package = "standard"
sb_has_unused_symbol_issue = true
} else {
import("//starboard/linux/shared/platform_configuration/configuration.gni")

sabi_path = "//starboard/sabi/x64/sysv/sabi-v$sb_api_version.json"
gl_type = "angle"
sb_angle_enable_gl = true
sabi_path = "//starboard/sabi/x64/sysv/sabi-v$sb_api_version.json"
gl_type = "angle"
sb_angle_enable_gl = true

sb_enable_cpp17_audit = false
sb_enable_cpp17_audit = false
}
21 changes: 21 additions & 0 deletions starboard/linux/x64x11/gcc/6.3/starboard_loader.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2023 The Cobalt 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.

#include <stdio.h>
#include "starboard/event.h"

int main(int argc, char** argv) {
printf("starboard_loader: SbRunStarboardMain\n");
return SbRunStarboardMain(argc, argv, SbEventHandle);
}
10 changes: 7 additions & 3 deletions starboard/linux/x64x11/gcc/6.3/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build/toolchain/gcc_toolchain.gni")
import("//starboard/build/toolchain/cobalt_toolchains.gni")
import("//starboard/shared/toolchain/overridable_gcc_toolchain.gni")

# Directory for GCC 6.3 if it is installed as a system dependency.
_default_gcc_6_3_bin_dir = "/usr/bin"

overridable_gcc_toolchain("target") {
cobalt_clang_toolchain("cobalt") {
native_linker_path = "${_default_gcc_6_3_bin_dir}/clang++"
}

overridable_gcc_toolchain("starboard") {
cc = "${_default_gcc_6_3_bin_dir}/gcc-6"
cxx = "${_default_gcc_6_3_bin_dir}/g++-6"
ld = cxx

# We use whatever 'ar' resolves to.
ar = "ar"

toolchain_args = {
Expand Down

0 comments on commit 16884d6

Please sign in to comment.