Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge ObjWriter into dotnet/main and update to LLVM 14 API #287

Merged
merged 45 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
94a87f8
Apply llvm.patch
MichalStrehovsky Dec 27, 2021
0aefd32
Add objwriter library
MichalStrehovsky Dec 27, 2021
1d4cb63
Build the ObjWriter package
MichalStrehovsky Dec 28, 2021
0f42ef5
Add ObjWriter API to set DWARF version (#161)
MichalStrehovsky Jan 19, 2022
1a27b31
Add `.note.GNU-stack` section to produced executables (#162)
MichalStrehovsky Jan 20, 2022
109f825
Remove Darwin workaround (#163)
MichalStrehovsky Jan 20, 2022
a49ffee
Fix llvm-dwarfdump warnings (#164)
MichalStrehovsky Jan 24, 2022
e44545d
Revert "Fix llvm-dwarfdump warnings (#164)" (#218)
agocke Jul 3, 2022
884ec17
Add new NuGet package, `Microsoft.NETCore.Runtime.JIT.Tools`, include…
TIHan Aug 26, 2022
9c1e92b
[ObjWriter] Enable DWARF debug information emitting for Mach-O (#269)
filipnavara Sep 8, 2022
6111e56
Account for GOT VariantKind on osx-arm64 (#185)
am11 Sep 9, 2022
2390ca0
Add API for emitting compact unwind encoding, enforce DWARF encoding …
filipnavara Sep 17, 2022
8346c28
Add comment
filipnavara Sep 22, 2022
34463af
Update ObjWriter to LLVM 14 API
filipnavara Sep 30, 2022
0643adf
Add support for generating uninitialized sections (#306)
MichalStrehovsky Nov 8, 2022
e3457ac
Do not indiscriminately create text section (#312)
MichalStrehovsky Nov 12, 2022
b6d50c7
Fix off-by-one error in DWARF reg-reg location (#317)
agocke Nov 15, 2022
509a016
Setting context object file info
BrianBohe Jan 2, 2023
5c4636e
Add verbosity to linux x64 pipeline
BrianBohe Jan 3, 2023
f1874e1
Revert "Add verbosity to linux x64 pipeline"
BrianBohe Jan 4, 2023
6c3b36f
Upgrading linux build image
BrianBohe Jan 4, 2023
9d76b36
[Temporary] Adding verbosity to get more pipeline error info
BrianBohe Jan 4, 2023
b270d3a
Update image name for linux x64
BrianBohe Jan 5, 2023
6396d3c
Fix Linux x64 build
filipnavara Jan 11, 2023
ec23a5e
Revert "[Temporary] Adding verbosity to get more pipeline error info"
BrianBohe Jan 13, 2023
63f8765
Updating Build_Linux_musl timeout
BrianBohe Jan 13, 2023
f9aebd3
Update linux-musl Docker images
filipnavara Jan 28, 2023
490b66c
Fix linux-musl-x64 build
filipnavara Jan 30, 2023
5c7ee7a
Setting clang/++ version 15 for linux musl
BrianBohe Feb 1, 2023
e4791a4
Copying clang/clan++ vars to unix-like OS
BrianBohe Feb 1, 2023
20d55f1
Fix cut & paste error
filipnavara Feb 2, 2023
2b93dd9
Fix objcopy and strip path in cross-compilation
filipnavara Feb 2, 2023
9b1312e
Merge branch 'objwriter/main' of https://github.com/filipnavara/llvm-…
filipnavara Feb 2, 2023
229bf06
Update azure-pipelines.yml
BrianBohe Feb 3, 2023
d098d57
Bump timeout for Linux musl build
akoeplinger Feb 3, 2023
e9f62f9
Clean up .gitignore
filipnavara Feb 4, 2023
e7e0e01
Consolidate Clang[Plus]Version into ClangVersionArg
filipnavara Feb 4, 2023
cfe6983
Move CLANG_TARGET from environment into build parameter
filipnavara Feb 4, 2023
adf6ca2
Update URL in cordebuginfo.h to point to dotnet/runtime
filipnavara Feb 4, 2023
2cfdeb2
Bump Windows build timeout to 210
filipnavara Feb 4, 2023
74fa15a
Fix a typo in compiler name
filipnavara Feb 4, 2023
07f26e9
Revert $(_BuildConfig) -> "$(_BuildConfig)" change
filipnavara Feb 4, 2023
2a00d23
Change ClangTarget to ClangTargetArg since apparently it gets propaga…
filipnavara Feb 4, 2023
a32f444
Fix inadvertent change
akoeplinger Feb 6, 2023
c4ad99f
Bump timeout everywhere
akoeplinger Feb 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ pythonenv*
/lldb/docs/python_api/

/artifacts
/.dotnet
/.packages
79 changes: 72 additions & 7 deletions eng/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,44 @@ stages:
############ LINUX BUILD ############
- job: Build_Linux
displayName: Linux
timeoutInMinutes: 180
timeoutInMinutes: 210
variables:
- _BuildConfig: Release
strategy:
matrix:
x64:
assetManifestOS: linux
assetManifestPlatform: x64
imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-20220716123527-d0bc8ed
imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7
rootfs:
ClangTargetArg:
archflag: --arch x64
LLVMTableGenArg:
ClangTableGenArg:
Devtoolset7Arg: /p:ForceDevtoolset7=true
ClangVersionArg: /p:ClangVersion=clang-9 /p:ClangPlusVersion=clang++-9
arm64:
assetManifestOS: linux
assetManifestPlatform: arm64
imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-arm64-cfdd435-20200121150126
rootfs: /crossrootfs/arm64
ClangTargetArg: /p:ClangTarget=aarch64-linux-gnu
archflag: --arch arm64
LLVMTableGenArg: /p:LLVMTableGenPath=$(Build.SourcesDirectory)/artifacts/obj/BuildRoot-x64/bin/llvm-tblgen
ClangTableGenArg: /p:ClangTableGenPath=$(Build.SourcesDirectory)/artifacts/obj/BuildRoot-x64/bin/clang-tblgen
Devtoolset7Arg:
ClangVersionArg: /p:ClangVersion=clang-9 /p:ClangPlusVersion=clang++-9
arm:
assetManifestOS: linux
assetManifestPlatform: arm
imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-09ec757-20200320131433
rootfs: /crossrootfs/arm
ClangTargetArg: /p:ClangTarget=arm-linux-gnueabihf
archflag: --arch arm
LLVMTableGenArg: /p:LLVMTableGenPath=$(Build.SourcesDirectory)/artifacts/obj/BuildRoot-x64/bin/llvm-tblgen
ClangTableGenArg: /p:ClangTableGenPath=$(Build.SourcesDirectory)/artifacts/obj/BuildRoot-x64/bin/clang-tblgen
Devtoolset7Arg:
ClangVersionArg: /p:ClangVersion=clang-9 /p:ClangPlusVersion=clang++-9
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
vmImage: ubuntu-20.04
Expand All @@ -76,25 +82,84 @@ stages:
displayName: 'Clean up working directory'

- bash: |
./build.sh --ci --restore --build --arch x64 -configuration $(_BuildConfig) $(_InternalBuildArgs) /p:BuildLLVMTableGenOnly=true
./build.sh --ci --restore --build --arch x64 -configuration $(_BuildConfig) $(_InternalBuildArgs) /p:BuildLLVMTableGenOnly=true $(ClangVersionArg)
displayName: 'Build host llvm-tblgen for cross-compiling'
condition: and(succeeded(), ne(variables['assetManifestPlatform'], 'x64'))

- bash: |
./build.sh --ci --restore --build --pack $(archflag) --configuration $(_BuildConfig) $(_InternalBuildArgs) $(LLVMTableGenArg) $(ClangTableGenArg) $(Devtoolset7Arg)
./build.sh --ci --restore --build --pack $(archflag) --configuration $(_BuildConfig) $(_InternalBuildArgs) $(LLVMTableGenArg) $(ClangTableGenArg) $(Devtoolset7Arg) $(ClangVersionArg) $(ClangTargetArg)
displayName: 'Build and package'
env:
ROOTFS_DIR: $(rootfs)

- bash: |
./eng/common/build.sh --ci --restore --publish --configuration $(_BuildConfig) $(_InternalBuildArgs) /p:AssetManifestOS=$(assetManifestOS) /p:PlatformName=$(assetManifestPlatform) --projects $(Build.SourcesDirectory)/llvm.proj
./eng/common/build.sh --ci --restore --publish --configuration $(_BuildConfig) $(_InternalBuildArgs) /p:AssetManifestOS=$(assetManifestOS) /p:PlatformName=$(assetManifestPlatform) $(ClangVersionArg) --projects $(Build.SourcesDirectory)/llvm.proj
displayName: Publish packages
condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))

############ LINUX MUSL BUILD ############
- job: Build_Linux_musl
displayName: Linux_musl
timeoutInMinutes: 210
filipnavara marked this conversation as resolved.
Show resolved Hide resolved
variables:
- _BuildConfig: Release
strategy:
matrix:
x64:
assetManifestOS: linux-musl
assetManifestPlatform: x64
imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.13-WithNode
rootfs:
ClangTargetArg:
archflag: --arch x64
LLVMTableGenArg:
ClangTableGenArg:
ClangVersionArg: /p:ClangVersion=clang-9 /p:ClangPlusVersion=clang++-9
arm64:
assetManifestOS: linux-musl
assetManifestPlatform: arm64
imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-cross-arm64-alpine
rootfs: /crossrootfs/arm64
ClangTargetArg: /p:ClangTarget=aarch64-alpine-linux-musl
archflag: --arch arm64
LLVMTableGenArg: /p:LLVMTableGenPath=$(Build.SourcesDirectory)/artifacts/obj/BuildRoot-x64/bin/llvm-tblgen
ClangTableGenArg: /p:ClangTableGenPath=$(Build.SourcesDirectory)/artifacts/obj/BuildRoot-x64/bin/clang-tblgen
filipnavara marked this conversation as resolved.
Show resolved Hide resolved
ClangVersionArg: /p:ClangVersion=clang-15 /p:ClangPlusVersion=clang++-15
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
vmImage: ubuntu-20.04
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
container:
image: $(imagename)
steps:
- bash: |
set -ex
git clean -ffdx
git reset --hard HEAD
displayName: 'Clean up working directory'

- bash: |
./build.sh --ci --restore --build --arch x64 -configuration $(_BuildConfig) $(_InternalBuildArgs) /p:BuildLLVMTableGenOnly=true $(ClangVersionArg)
displayName: 'Build host llvm-tblgen for cross-compiling'
condition: and(succeeded(), ne(variables['assetManifestPlatform'], 'x64'))

- bash: |
./build.sh --ci --restore --build --pack $(archflag) --configuration $(_BuildConfig) $(_InternalBuildArgs) $(LLVMTableGenArg) $(ClangTableGenArg) /p:OutputRid=linux-musl-$(assetManifestPlatform) $(ClangVersionArg) $(ClangTargetArg)
displayName: 'Build and package'
env:
ROOTFS_DIR: $(rootfs)

- bash: |
./eng/common/build.sh --ci --restore --publish --configuration $(_BuildConfig) $(_InternalBuildArgs) /p:AssetManifestOS=$(assetManifestOS) /p:PlatformName=$(assetManifestPlatform) $(ClangVersionArg) --projects $(Build.SourcesDirectory)/llvm.proj
displayName: Publish packages
condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))

############ MACOS BUILD ############
- job: Build_macOS
displayName: macOS
timeoutInMinutes: 180
timeoutInMinutes: 210
variables:
- _BuildConfig: Release
strategy:
Expand Down Expand Up @@ -137,7 +202,7 @@ stages:
############ WINDOWS BUILD ############
- job: Build_Windows
displayName: Windows
timeoutInMinutes: 180
timeoutInMinutes: 210
strategy:
matrix:
# Release
Expand Down
35 changes: 22 additions & 13 deletions llvm.proj
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@
</_SetupEnvironment>
<_CMakeConfigureCommand>$(_SetupEnvironment) cmake $(_LLVMSourceDir) -G "$(CMakeGenerator)" @(_LLVMBuildArgs->'%(Identity)',' ')</_CMakeConfigureCommand>
<_BuildSubset Condition="'$(BuildLLVMTableGenOnly)' == 'true'">llvm-tblgen clang-tblgen</_BuildSubset>
<_BuildSubset Condition="'$(BuildObjWriterOnly)' == 'true'">objwriter llvm-mca FileCheck</_BuildSubset>
<_BuildCommand Condition="'$(CMakeGenerator)' == 'Unix Makefiles'">$(_SetupEnvironment) make $(_BuildSubset) -j$([System.Environment]::ProcessorCount)</_BuildCommand>
<_BuildCommand Condition="'$(CMakeGenerator)' == 'Ninja'">$(_SetupEnvironment) ninja $(_BuildSubset)</_BuildCommand>
<_CMakeInstallCommand>$(_SetupEnvironment) cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -P cmake_install.cmake</_CMakeInstallCommand>
<_CMakeInstallCommand Condition="'$(BuildObjWriterOnly)' == 'true'">
$(_SetupEnvironment)

cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -DCMAKE_INSTALL_COMPONENT=objwriter -P cmake_install.cmake
cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -DCMAKE_INSTALL_COMPONENT=llvm-mca -P cmake_install.cmake
cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -DCMAKE_INSTALL_COMPONENT=FileCheck -P cmake_install.cmake
</_CMakeInstallCommand>
<_CMakeInstallCommand Condition="'$(BuildObjWriterOnly)' != 'true'">$(_SetupEnvironment) cmake -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_PREFIX=$(_LLVMInstallDir) -P cmake_install.cmake</_CMakeInstallCommand>
</PropertyGroup>

<PropertyGroup Condition="'$(ForceDevtoolset7)' == 'true'">
Expand All @@ -44,12 +52,9 @@
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm'" Include="-DLLVM_TARGET_ARCH=ARM" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'Windows_NT'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-windows-msvc" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildOS)' == 'Windows_NT'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=arm-windows-msvc" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'Linux'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-gnu" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'Linux'" Include="-DCMAKE_OBJCOPY=/usr/bin/aarch64-linux-gnu-objcopy" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'Linux'" Include="-DCMAKE_STRIP=/usr/bin/aarch64-linux-gnu-strip" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildOS)' == 'Linux'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildOS)' == 'Linux'" Include="-DCMAKE_OBJCOPY=/usr/bin/arm-linux-gnueabihf-objcopy" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm' and '$(BuildOS)' == 'Linux'" Include="-DCMAKE_STRIP=/usr/bin/arm-linux-gnueabihf-strip" />
<_LLVMBuildArgs Condition="'$(ClangTarget)' != '' and '$(BuildOS)' == 'Linux'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=$(ClangTarget)" />
<_LLVMBuildArgs Condition="'$(ClangTarget)' != '' and '$(BuildOS)' == 'Linux'" Include="-DCMAKE_OBJCOPY=/usr/bin/$(ClangTarget)-objcopy" />
<_LLVMBuildArgs Condition="'$(ClangTarget)' != '' and '$(BuildOS)' == 'Linux'" Include="-DCMAKE_STRIP=/usr/bin/$(ClangTarget)-strip" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'OSX'" Include="-DLLVM_DEFAULT_TARGET_TRIPLE=arm64-apple-darwin" />
<_LLVMBuildArgs Condition="'$(TargetArchitecture)' == 'arm64' and '$(BuildOS)' == 'OSX'" Include="-DCMAKE_OSX_ARCHITECTURES=arm64"/>
<!-- Enable CMake cross-compilation support by setting CMAKE_SYSTEM_NAME manually, see https://github.com/llvm/llvm-project/issues/52819 -->
Expand All @@ -66,7 +71,7 @@
<_LLVMBuildArgs Include='-DLLVM_BUILD_TESTS=OFF' />
<_LLVMBuildArgs Include='-DLLVM_BUILD_EXAMPLES=OFF' />
<_LLVMBuildArgs Include='-DLLVM_INCLUDE_EXAMPLES=OFF' />
<_LLVMBuildArgs Include='-DLLVM_TOOLS_TO_BUILD="opt%3Bllc%3Bllvm-config%3Bllvm-dis%3Bllvm-mc%3Bllvm-as"' />
<_LLVMBuildArgs Include='-DLLVM_TOOLS_TO_BUILD="opt%3Bllc%3Bllvm-config%3Bllvm-dis%3Bllvm-mc%3Bllvm-as%3Bobjwriter%3Bllvm-mca%3BFileCheck"' />
<_LLVMBuildArgs Include='-DLLVM_ENABLE_LIBXML2=OFF' />
<_LLVMBuildArgs Include='-DLLVM_ENABLE_TERMINFO=OFF' />
<_LLVMBuildArgs Include='-DLLVM_EXTERNALIZE_DEBUGINFO=ON' />
Expand All @@ -82,6 +87,9 @@

<ItemGroup>
<_LLVMBuildArgs Include='-DLLVM_ENABLE_PROJECTS=clang' />
<_LLVMBuildArgs Include='-DLLVM_BUILD_TOOLS:BOOL=ON' />
<_LLVMBuildArgs Include='-DLLVM_INSTALL_UTILS:BOOL=ON' />
<_LLVMBuildArgs Include="-DLLVM_INCLUDE_UTILS:BOOL=ON" />
<_LLVMBuildArgs Include='-DCLANG_BUILD_TOOLS=OFF' />
<_LLVMBuildArgs Include='-DCLANG_INCLUDE_TESTS=OFF' />
<_LLVMBuildArgs Include='-DCLANG_ENABLE_ARCMT=OFF' />
Expand All @@ -91,24 +99,25 @@
</ItemGroup>

<PropertyGroup Condition="'$(BuildOS)' != 'Windows_NT'">
<_CrossCFlags Condition="'$(BuildOS)' == 'Linux' and '$(TargetArchitecture)' == 'arm64'">--target=aarch64-linux-gnu --sysroot=$(ROOTFS_DIR)</_CrossCFlags>
<_CrossCFlags Condition="'$(BuildOS)' == 'Linux' and '$(TargetArchitecture)' == 'arm'">--target=arm-linux-gnueabihf --sysroot=$(ROOTFS_DIR)</_CrossCFlags>
<_CrossCFlags Condition="'$(BuildOS)' == 'Linux' and '$(ClangTarget)' != ''">--target=$(ClangTarget) --sysroot=$(ROOTFS_DIR)</_CrossCFlags>
<_CrossCFlags Condition="'$(BuildOS)' == 'OSX' and '$(TargetArchitecture)' == 'arm64'">--target=aarch64-apple-darwin</_CrossCFlags>
<_ExeLinkerFlags>$(_CrossCFlags)</_ExeLinkerFlags>
<_ExeLinkerFlags Condition="'$(BuildOS)' == 'Linux'">-Wl,--build-id $(_ExeLinkerFlags)</_ExeLinkerFlags>
<_SharedLinkerFlags>$(_CrossCFlags)</_SharedLinkerFlags>
<_SharedLinkerFlags Condition="'$(BuildOS)' == 'Linux'">-Wl,--build-id $(_SharedLinkerFlags)</_SharedLinkerFlags>
</PropertyGroup>

<ItemGroup Condition="'$(BuildOS)' != 'Windows_NT' and ('$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'arm64')">
<_LLVMBuildArgs Include='-DCMAKE_MODULE_LINKER_FLAGS="$(_CrossCFlags)"' />
<_LLVMBuildArgs Include='-DCMAKE_SHARED_LINKER_FLAGS="$(_CrossCFlags)"' />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include="-DCMAKE_C_COMPILER=clang-9" />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include="-DCMAKE_CXX_COMPILER=clang++-9" />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include="-DCMAKE_C_COMPILER=$(ClangVersion)" />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'Linux'" Include="-DCMAKE_CXX_COMPILER=$(ClangPlusVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(BuildOS)' != 'Windows_NT'">
<_LLVMBuildArgs Include='-DCMAKE_C_FLAGS="-I../llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CrossCFlags)"' />
<_LLVMBuildArgs Include='-DCMAKE_CXX_FLAGS="-I../llvm/include $(Devtoolset7CompileFlag) -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS $(_CrossCFlags) "' />
<_LLVMBuildArgs Include='-DCMAKE_EXE_LINKER_FLAGS="$(Devtoolset7LinkFlag) $(_ExeLinkerFlags)"' />
<_LLVMBuildArgs Include='-DCMAKE_SHARED_LINKER_FLAGS="$(Devtoolset7LinkFlag) $(_SharedLinkerFlags)"' />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'OSX' and '$(TargetArchitecture)' == 'arm64'" Include='-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0' />
<_LLVMBuildArgs Condition="'$(BuildOS)' == 'OSX' and '$(TargetArchitecture)' == 'x64'" Include='-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13' />
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions llvm/include/llvm/MC/MCObjectStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ class MCObjectStreamer : public MCStreamer {
const MCExpr *Value) override;
void emitValueImpl(const MCExpr *Value, unsigned Size,
SMLoc Loc = SMLoc()) override;
/// \brief EmitValueImpl with additional param, that allows to emit PCRelative
/// MCFixup.
void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc,
bool isPCRelative);

void emitULEB128Value(const MCExpr *Value) override;
void emitSLEB128Value(const MCExpr *Value) override;
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
Expand Down
5 changes: 5 additions & 0 deletions llvm/include/llvm/MC/MCStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class ARMTargetStreamer : public MCTargetStreamer {
virtual void emitPad(int64_t Offset);
virtual void emitRegSave(const SmallVectorImpl<unsigned> &RegList,
bool isVector);
virtual void emitLsda(const MCSymbol *Symbol);
virtual void emitUnwindRaw(int64_t StackOffset,
const SmallVectorImpl<uint8_t> &Opcodes);

Expand Down Expand Up @@ -683,6 +684,9 @@ class MCStreamer {
/// etc.
virtual void emitBytes(StringRef Data);

/// \brief Emit the given \p Instruction data into the current section.
virtual void emitInstructionBytes(StringRef Data);

/// Functionally identical to EmitBytes. When emitting textual assembly, this
/// method uses .byte directives instead of .ascii or .asciz for readability.
virtual void emitBinaryData(StringRef Data);
Expand Down Expand Up @@ -1024,6 +1028,7 @@ class MCStreamer {
virtual void emitCFIRegister(int64_t Register1, int64_t Register2);
virtual void emitCFIWindowSave();
virtual void emitCFINegateRAState();
virtual void emitCFICompactUnwindEncoding(unsigned Encoding);

virtual void EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc = SMLoc());
virtual void EmitWinCFIEndProc(SMLoc Loc = SMLoc());
Expand Down
9 changes: 7 additions & 2 deletions llvm/lib/MC/MCObjectStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void MCObjectStreamer::emitCFISections(bool EH, bool Debug) {
}

void MCObjectStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
SMLoc Loc) {
SMLoc Loc, bool isPCRelative) {
MCStreamer::emitValueImpl(Value, Size, Loc);
MCDataFragment *DF = getOrCreateDataFragment();
flushPendingLabels(DF, DF->getContents().size());
Expand All @@ -263,10 +263,15 @@ void MCObjectStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
}
DF->getFixups().push_back(
MCFixup::create(DF->getContents().size(), Value,
MCFixup::getKindForSize(Size, false), Loc));
MCFixup::getKindForSize(Size, isPCRelative), Loc));
DF->getContents().resize(DF->getContents().size() + Size, 0);
}

void MCObjectStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
SMLoc Loc) {
emitValueImpl(Value, Size, Loc, false);
}

MCSymbol *MCObjectStreamer::emitCFILabel() {
MCSymbol *Label = getContext().createTempSymbol("cfi");
emitLabel(Label);
Expand Down
18 changes: 15 additions & 3 deletions llvm/lib/MC/MCStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@ void MCStreamer::addExplicitComment(const Twine &T) {}
void MCStreamer::emitExplicitComments() {}

void MCStreamer::generateCompactUnwindEncodings(MCAsmBackend *MAB) {
for (auto &FI : DwarfFrameInfos)
FI.CompactUnwindEncoding =
(MAB ? MAB->generateCompactUnwindEncoding(FI.Instructions) : 0);
for (auto &FI : DwarfFrameInfos) {
if (FI.CompactUnwindEncoding == 0) {
FI.CompactUnwindEncoding =
(MAB ? MAB->generateCompactUnwindEncoding(FI.Instructions) : 0);
}
}
}

/// EmitIntValue - Special case of EmitValue that avoids the client having to
Expand Down Expand Up @@ -676,6 +679,14 @@ void MCStreamer::emitCFINegateRAState() {
CurFrame->Instructions.push_back(Instruction);
}

void MCStreamer::emitCFICompactUnwindEncoding(unsigned Encoding)
{
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
return;
CurFrame->CompactUnwindEncoding = Encoding;
}

void MCStreamer::emitCFIReturnColumn(int64_t Register) {
MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
if (!CurFrame)
Expand Down Expand Up @@ -1190,6 +1201,7 @@ void MCStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
void MCStreamer::changeSection(MCSection *, const MCExpr *) {}
void MCStreamer::emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
void MCStreamer::emitBytes(StringRef Data) {}
void MCStreamer::emitInstructionBytes(StringRef Data) { emitBytes(Data); }
void MCStreamer::emitBinaryData(StringRef Data) { emitBytes(Data); }
void MCStreamer::emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) {
visitUsedExpr(*Value);
Expand Down
Loading