Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Android/build/build/soong/cc/config/   (Android Betriebssystem Version 17©)  Datei vom 26.5.2026 mit Größe 8 kB image not shown  

Quelle  x86_windows_host.go   Sprache: Unknown

 

Spracherkennung für: .go vermutete Sprache: C {C[31] Corba[31] CS[31]} [Methode: maximale Elemente, drei Dimensionen]

// Copyright 2015 Google Inc. 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.

package config

import (
 "path/filepath"
 "strings"

 "android/soong/android"
)

const (
 windowsGccTriple  = "x86_64-w64-mingw32"
 windowsGccVersion = "4.8"
)

var (
 windowsCflags = []string{
  "-DUSE_MINGW",
  "-DWIN32_LEAN_AND_MEAN",
  "-Wno-unused-parameter",

  // Workaround differences in <stdint.h> between host and target.
  // Context: http://b/12708004
  "-D__STDC_CONSTANT_MACROS",

  // Use C99-compliant printf functions (%zd).
  "-D__USE_MINGW_ANSI_STDIO=1",
  // Admit to using >= Windows 10.
  // Both #defines are needed: https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
  "-D_WIN32_WINNT=0x0A00",
  "-DWINVER=0x0A00",
  // Get 64-bit off_t and related functions.
  "-D_FILE_OFFSET_BITS=64",

  // Don't adjust the layout of bitfields like msvc does.
  "-mno-ms-bitfields",

  "--sysroot ${WindowsGccRoot}/${WindowsGccTriple}",

  // Windows flags to generate PDB
  "-g",
  "-gcodeview",

  "-fno-omit-frame-pointer",
 }

 windowsIncludeFlags = []string{
  "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include",
 }

 windowsCppflags = []string{}

 windowsX86Cppflags = []string{
  // Use SjLj exceptions for 32-bit.  libgcc_eh implements SjLj
  // exception model for 32-bit.
  "-fsjlj-exceptions",
 }

 windowsX8664Cppflags = []string{}

 windowsLdflags = []string{
  "-Wl,--dynamicbase",
  "-Wl,--nxcompat",

  "-Wl,--Xlink=-Brepro", // Enable deterministic build

  // ntdll has a broken implementation of wcstombs that causes b/439152273.
  // ucrt provides an implementation of wcstombs that is not broken,
  // make sure to include ucrt before ntdll.
  "-lucrt",
  // Additional libraries required for generated static rustlibs
  "-lssp",
  "-ladvapi32",
  "-lntdll",
 }

 windowsX86Cflags = []string{
  "-m32",
 }

 windowsX8664Cflags = []string{
  "-m64",
 }

 windowsAvailableLibraries = addPrefix([]string{
  "bcrypt",
  "dbghelp",
  "gdi32",
  "imagehlp",
  "iphlpapi",
  "netapi32",
  "ntdll",
  "oleaut32",
  "ole32",
  "opengl32",
  "powrprof",
  "psapi",
  "pthread",
  "ucrt",
  "userenv",
  "uuid",
  "version",
  "ws2_32",
  "windowscodecs",
 }, "-l")
)

func WindowsX86Ldflags(ctx ToolchainFlagsContext) FlagsWithDeps {
 windowsGccRoot := WindowsGccRoot(ctx.Config())
 depsPhony := ctx.CreateNinjaPhonyOnce("windowsX86LdFlagsDeps", []string{
  filepath.Join(windowsGccRoot, windowsGccTriple, "bin", "*"),
  filepath.Join(windowsGccRoot, "lib/gcc", windowsGccTriple, "4.8.3", "32", "*"),
  filepath.Join(windowsGccRoot, windowsGccTriple, "lib32", "*"),
 })
 return FlagsWithDeps{
  Flags: strings.Join([]string{
   "-m32",
   "-Wl,--large-address-aware",
   "-L${config.WindowsGccRoot}/${config.WindowsGccTriple}/lib32",
   "-static-libgcc",

   "-B${config.WindowsGccRoot}/${config.WindowsGccTriple}/bin",
   "-B${config.WindowsGccRoot}/lib/gcc/${config.WindowsGccTriple}/4.8.3/32",
   "-L${config.WindowsGccRoot}/lib/gcc/${config.WindowsGccTriple}/4.8.3/32",
   "-B${config.WindowsGccRoot}/${config.WindowsGccTriple}/lib32",
  }, " "),
  Deps: android.Paths{depsPhony},
 }
}

func WindowsX8664Ldflags(ctx ToolchainFlagsContext) FlagsWithDeps {
 windowsGccRoot := WindowsGccRoot(ctx.Config())
 depsPhony := ctx.CreateNinjaPhonyOnce("windowsX8664LdFlagsDeps", []string{
  filepath.Join(windowsGccRoot, windowsGccTriple, "bin", "*"),
  filepath.Join(windowsGccRoot, "lib/gcc", windowsGccTriple, "4.8.3", "*"),
  filepath.Join(windowsGccRoot, windowsGccTriple, "lib64", "*"),
 })
 return FlagsWithDeps{
  Flags: strings.Join([]string{
   "-m64",
   "-L${config.WindowsGccRoot}/${config.WindowsGccTriple}/lib64",
   "-Wl,--high-entropy-va",
   "-static-libgcc",

   "-B${config.WindowsGccRoot}/${config.WindowsGccTriple}/bin",
   "-B${config.WindowsGccRoot}/lib/gcc/${config.WindowsGccTriple}/4.8.3",
   "-L${config.WindowsGccRoot}/lib/gcc/${config.WindowsGccTriple}/4.8.3",
   "-B${config.WindowsGccRoot}/${config.WindowsGccTriple}/lib64",
  }, " "),
  Deps: android.Paths{depsPhony},
 }
}

func init() {
 pctx.StaticVariable("WindowsGccVersion", windowsGccVersion)

 pctx.SourcePathVariable("WindowsGccRoot",
  "prebuilts/gcc/${HostPrebuiltTag}/host/x86_64-w64-mingw32-${WindowsGccVersion}")

 pctx.StaticVariable("WindowsGccTriple", "x86_64-w64-mingw32")

 pctx.StaticVariable("WindowsCflags", strings.Join(windowsCflags, " "))
 pctx.StaticVariable("WindowsLdflags", strings.Join(windowsLdflags, " "))
 pctx.StaticVariable("WindowsCppflags", strings.Join(windowsCppflags, " "))

 pctx.StaticVariable("WindowsX86Cflags", strings.Join(windowsX86Cflags, " "))
 pctx.StaticVariable("WindowsX8664Cflags", strings.Join(windowsX8664Cflags, " "))
 pctx.StaticVariable("WindowsX86Cppflags", strings.Join(windowsX86Cppflags, " "))
 pctx.StaticVariable("WindowsX8664Cppflags", strings.Join(windowsX8664Cppflags, " "))

 pctx.StaticVariable("WindowsIncludeFlags", strings.Join(windowsIncludeFlags, " "))
 // Yasm flags
 pctx.StaticVariable("WindowsX86YasmFlags", "-f win32 -m x86")
 pctx.StaticVariable("WindowsX8664YasmFlags", "-f win64 -m amd64")
}

type toolchainWindows struct {
 cFlags, ldFlags string
 toolchainBase
 toolchainNoCrt
}

type toolchainWindowsX86 struct {
 toolchain32Bit
 toolchainWindows
}

type toolchainWindowsX8664 struct {
 toolchain64Bit
 toolchainWindows
}

func (t *toolchainWindowsX86) Name() string {
 return "x86"
}

func (t *toolchainWindowsX8664) Name() string {
 return "x86_64"
}

func (t *toolchainWindows) ToolchainCflags() string {
 return "-B" + filepath.Join("${config.WindowsGccRoot}", "${config.WindowsGccTriple}", "bin")
}

func (t *toolchainWindows) ToolchainLdflags() FlagsWithDeps {
 return FlagsWithDeps{
  Flags: "-B" + filepath.Join("${config.WindowsGccRoot}", "${config.WindowsGccTriple}", "bin"),
 }
}

func (t *toolchainWindows) IncludeFlags() string {
 return "${config.WindowsIncludeFlags}"
}

func (t *toolchainWindowsX86) ClangTriple() string {
 return "i686-windows-gnu"
}

func (t *toolchainWindowsX8664) ClangTriple() string {
 return "x86_64-pc-windows-gnu"
}

func (t *toolchainWindowsX86) Cflags() string {
 return "${config.WindowsCflags} ${config.WindowsX86Cflags}"
}

func (t *toolchainWindowsX8664) Cflags() string {
 return "${config.WindowsCflags} ${config.WindowsX8664Cflags}"
}

func (t *toolchainWindowsX86) Cppflags() string {
 return "${config.WindowsCppflags} ${config.WindowsX86Cppflags}"
}

func (t *toolchainWindowsX8664) Cppflags() string {
 return "${config.WindowsCppflags} ${config.WindowsX8664Cppflags}"
}

func (t *toolchainWindowsX86) Ldflags(ctx ToolchainFlagsContext) FlagsWithDeps {
 preflags := FlagsWithDeps{
  Flags: "${config.WindowsLdflags}",
 }
 return preflags.Append(WindowsX86Ldflags(ctx))
}

func (t *toolchainWindowsX8664) Ldflags(ctx ToolchainFlagsContext) FlagsWithDeps {
 preflags := FlagsWithDeps{
  Flags: "${config.WindowsLdflags}",
 }
 return preflags.Append(WindowsX8664Ldflags(ctx))
}

func (t *toolchainWindowsX86) YasmFlags() string {
 return "${config.WindowsX86YasmFlags}"
}

func (t *toolchainWindowsX8664) YasmFlags() string {
 return "${config.WindowsX8664YasmFlags}"
}

func (t *toolchainWindows) ShlibSuffix() string {
 return ".dll"
}

func (t *toolchainWindows) ExecutableSuffix() string {
 return ".exe"
}

func (t *toolchainWindows) AvailableLibraries() []string {
 return windowsAvailableLibraries
}

func (t *toolchainWindows) Bionic() bool {
 return false
}

var toolchainWindowsX86Singleton Toolchain = &toolchainWindowsX86{}
var toolchainWindowsX8664Singleton Toolchain = &toolchainWindowsX8664{}

func windowsX86ToolchainFactory(arch android.Arch) Toolchain {
 return toolchainWindowsX86Singleton
}

func windowsX8664ToolchainFactory(arch android.Arch) Toolchain {
 return toolchainWindowsX8664Singleton
}

func init() {
 registerToolchainFactory(android.Windows, android.X86, windowsX86ToolchainFactory)
 registerToolchainFactory(android.Windows, android.X86_64, windowsX8664ToolchainFactory)
}

func WindowsGccRoot(config android.Config) string {
 return "prebuilts/gcc/" + config.PrebuiltOS() + "/host/x86_64-w64-mingw32-" + windowsGccVersion
}

¤ Dauer der Verarbeitung: 0.2 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.