MCAsmInfoCOFF.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include "llvm/MC/MCAsmInfoCOFF.h"
  14. #include "llvm/MC/MCDirectives.h"
  15. using namespace llvm;
  16. void MCAsmInfoCOFF::anchor() {}
  17. MCAsmInfoCOFF::MCAsmInfoCOFF() {
  18. // MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte
  19. // alignment.
  20. COMMDirectiveAlignmentIsInBytes = false;
  21. LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
  22. HasDotTypeDotSizeDirective = false;
  23. HasSingleParameterDotFile = true;
  24. WeakRefDirective = "\t.weak\t";
  25. AvoidWeakIfComdat = true;
  26. // Doesn't support visibility:
  27. HiddenVisibilityAttr = HiddenDeclarationVisibilityAttr = MCSA_Invalid;
  28. ProtectedVisibilityAttr = MCSA_Invalid;
  29. // Set up DWARF directives
  30. SupportsDebugInformation = true;
  31. NeedsDwarfSectionOffsetDirective = true;
  32. // At least MSVC inline-asm does AShr.
  33. UseLogicalShr = false;
  34. // If this is a COFF target, assume that it supports associative comdats. It's
  35. // part of the spec.
  36. HasCOFFAssociativeComdats = true;
  37. // We can generate constants in comdat sections that can be shared,
  38. // but in order not to create null typed symbols, we actually need to
  39. // make them global symbols as well.
  40. HasCOFFComdatConstants = true;
  41. }
  42. void MCAsmInfoMicrosoft::anchor() {}
  43. MCAsmInfoMicrosoft::MCAsmInfoMicrosoft() = default;
  44. void MCAsmInfoGNUCOFF::anchor() {}
  45. MCAsmInfoGNUCOFF::MCAsmInfoGNUCOFF() {
  46. // If this is a GNU environment (mingw or cygwin), don't use associative
  47. // comdats for jump tables, unwind information, and other data associated with
  48. // a function.
  49. HasCOFFAssociativeComdats = false;
  50. // We don't create constants in comdat sections for MinGW.
  51. HasCOFFComdatConstants = false;
  52. }