Repository: dotnet/runtime
File: src/coreclr/tools/Common/Compiler/ObjectWriter/PEObjectWriter.cs (C#)

Code before:
        }

        public void AddExportedSymbol(string symbol)
        {
            if (!string.IsNullOrEmpty(symbol))
            {
                _exportedSymbolNames.Add(symbol);
            }
        }

        private protected override ObjectNodeSection GetEmitSection(ObjectNodeSection section)
        {
            // RISC-V and LoongArch64 have a limited addressing range (±2GB).
            // Don't merge sections to avoid relocation overflow.
            if (_nodeFactory.Target.Architecture == TargetArchitecture.RiscV64
                || _nodeFactory.Target.Architecture == TargetArchitecture.LoongArch64)
            {
                return section;
            }

            // Put executable code into .text for PE files as AV software really
            // doesn't like executable code in non-standard sections.
            if (section == ObjectNodeSection.ManagedCodeWindowsContentSection)
            {
                return ObjectNodeSection.TextSection;
            }

            // We want to reduce the number of sections in the PE files we emit,
            // so merge the read-only data section into the .text section.
            if (section == ObjectNodeSection.ReadOnlyDataSection)
            {
                return ObjectNodeSection.TextSection;
            }

            // Otherwise, use the requested section.
            return section;
        }

        private protected override void CreateSection(ObjectNodeSection section, Utf8String comdatName, Utf8String symbolName, int sectionIndex, Stream sectionStream)
        {
            // COMDAT sections are not supported in PE files
            base.CreateSection(section, comdatName: default, symbolName, sectionIndex, sectionStream);

            if (_requestedSectionAlignment != 0)
            {
                UpdateSectionAlignment(sectionIndex, _requestedSectionAlignment);
            }
        }

        private struct PEOptionalHeader
        {

Review comment (bug):
```suggestion
            // Put executable code into .text for PE files as AV software really
            // doesn't like executable code in non-standard sections.
            if (section == ObjectNodeSection.ManagedCodeWindowsContentSection)
            {
                return ObjectNodeSection.TextSection;
            }

            // RISC-V and LoongArch64 have a limited addressing range (±2GB) for relocs.
            // Don't merge rdata into text to avoid relocation overflow.
            if (_nodeFactory.Target.Architecture == TargetArchitecture.RiscV64
                || _nodeFactory.Target.Architecture == TargetArchitecture.LoongArch64)
            {
                return section;
            }
```

Code after:
            _requestedSectionAlignment = sectionAlignment;
            _coffTimestamp = coffTimestamp;
        }

        public void AddExportedSymbol(string symbol)
        {
            if (!string.IsNullOrEmpty(symbol))
            {
                _exportedSymbolNames.Add(symbol);
            }
        }

        private protected override ObjectNodeSection GetEmitSection(ObjectNodeSection section)
        {
            // Put executable code into .text for PE files as AV software really
            // doesn't like executable code in non-standard sections.
            if (section == ObjectNodeSection.ManagedCodeWindowsContentSection)
            {
                return ObjectNodeSection.TextSection;
            }

            // We want to reduce the number of sections in the PE files we emit,
            // so merge the read-only data section into the .text section.
            if (section == ObjectNodeSection.ReadOnlyDataSection)
            {
                return ObjectNodeSection.TextSection;
            }

            // Otherwise, use the requested section.
            return section;
        }

        private protected override void CreateSection(ObjectNodeSection section, Utf8String comdatName, Utf8String symbolName, int sectionIndex, Stream sectionStream)
        {
            // COMDAT sections are not supported in PE files
            base.CreateSection(section, comdatName: default, symbolName, sectionIndex, sectionStream);

            if (_requestedSectionAlignment != 0)
            {
                UpdateSectionAlignment(sectionIndex, _requestedSectionAlignment);
            }
        }

        private struct PEOptionalHeader
        {
            public bool IsPE32Plus { get; }

            // Standard fields
            public byte MajorLinkerVersion { get; set; }
            public byte MinorLinkerVersion { get; set; }
            public uint SizeOfCode { get; set; }