1 //===- MCAsmInfoCOFF.cpp - COFF asm properties ----------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file defines target asm properties related what form asm statements 10 // should take in general on COFF-based targets 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "llvm/MC/MCAsmInfoCOFF.h" 15 #include "llvm/MC/MCDirectives.h" 16 17 using namespace llvm; 18 19 void MCAsmInfoCOFF::anchor() {} 20 21 MCAsmInfoCOFF::MCAsmInfoCOFF() { 22 // MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte 23 // alignment. 24 COMMDirectiveAlignmentIsInBytes = false; 25 LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment; 26 HasDotTypeDotSizeDirective = false; 27 HasSingleParameterDotFile = true; 28 WeakRefDirective = "\t.weak\t"; 29 HasLinkOnceDirective = true; 30 31 // Doesn't support visibility: 32 HiddenVisibilityAttr = HiddenDeclarationVisibilityAttr = MCSA_Invalid; 33 ProtectedVisibilityAttr = MCSA_Invalid; 34 35 // Set up DWARF directives 36 SupportsDebugInformation = true; 37 NeedsDwarfSectionOffsetDirective = true; 38 39 UseIntegratedAssembler = true; 40 41 // At least MSVC inline-asm does AShr. 42 UseLogicalShr = false; 43 44 // If this is a COFF target, assume that it supports associative comdats. It's 45 // part of the spec. 46 HasCOFFAssociativeComdats = true; 47 48 // We can generate constants in comdat sections that can be shared, 49 // but in order not to create null typed symbols, we actually need to 50 // make them global symbols as well. 51 HasCOFFComdatConstants = true; 52 } 53 54 void MCAsmInfoMicrosoft::anchor() {} 55 56 MCAsmInfoMicrosoft::MCAsmInfoMicrosoft() = default; 57 58 void MCAsmInfoGNUCOFF::anchor() {} 59 60 MCAsmInfoGNUCOFF::MCAsmInfoGNUCOFF() { 61 // If this is a GNU environment (mingw or cygwin), don't use associative 62 // comdats for jump tables, unwind information, and other data associated with 63 // a function. 64 HasCOFFAssociativeComdats = false; 65 66 // We don't create constants in comdat sections for MinGW. 67 HasCOFFComdatConstants = false; 68 } 69