Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DIVINE
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
paradise
mirror
DIVINE
Commits
fc846b06
There was an error fetching the commit references. Please try again later.
Commit
fc846b06
authored
5 years ago
by
Zuzana Baranová
Browse files
Options
Downloads
Patches
Plain Diff
tools: Rename compile_and_link to link, move dios linking out.
parent
c9ec1e31
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/divcc.cpp
+13
-7
13 additions, 7 deletions
tools/divcc.cpp
with
13 additions
and
7 deletions
tools/divcc.cpp
+
13
−
7
View file @
fc846b06
...
@@ -46,14 +46,9 @@ using namespace brick::types;
...
@@ -46,14 +46,9 @@ using namespace brick::types;
using
FileType
=
cc
::
FileType
;
using
FileType
=
cc
::
FileType
;
auto
link_dios_native
(
std
::
vector
<
std
::
string
>
&
args
,
bool
cxx
)
{
{
using
namespace
brick
::
fs
;
using
namespace
brick
::
fs
;
int
compile_and_link
(
cc
::
ParsedOpts
&
po
,
cc
::
CC1
&
clang
,
PairedFiles
&
objFiles
,
bool
cxx
=
false
)
{
auto
diosCC
=
std
::
make_unique
<
rt
::
DiosCC
>
(
clang
.
context
()
);
std
::
vector
<
const
char
*
>
ld_args_c
;
using
namespace
brick
::
fs
;
TempDir
tmpdir
(
".divcc.XXXXXX"
,
AutoDelete
::
Yes
,
UseSystemTemp
::
Yes
);
TempDir
tmpdir
(
".divcc.XXXXXX"
,
AutoDelete
::
Yes
,
UseSystemTemp
::
Yes
);
auto
hostlib
=
tmpdir
.
path
+
"/libdios-host.a"
,
auto
hostlib
=
tmpdir
.
path
+
"/libdios-host.a"
,
cxxlib
=
tmpdir
.
path
+
"/libc++.a"
,
cxxlib
=
tmpdir
.
path
+
"/libc++.a"
,
...
@@ -71,7 +66,17 @@ int compile_and_link( cc::ParsedOpts& po, cc::CC1& clang, PairedFiles& objFiles,
...
@@ -71,7 +66,17 @@ int compile_and_link( cc::ParsedOpts& po, cc::CC1& clang, PairedFiles& objFiles,
writeFile
(
hostlib
,
rt
::
dios_host
()
);
writeFile
(
hostlib
,
rt
::
dios_host
()
);
args
.
push_back
(
hostlib
);
args
.
push_back
(
hostlib
);
return
tmpdir
;
}
int
link
(
cc
::
ParsedOpts
&
po
,
cc
::
CC1
&
clang
,
cc
::
PairedFiles
&
objFiles
,
bool
cxx
=
false
)
{
auto
diosCC
=
std
::
make_unique
<
rt
::
DiosCC
>
(
clang
.
context
()
);
std
::
vector
<
const
char
*
>
ld_args_c
;
std
::
vector
<
std
::
string
>
args
=
cc
::
ld_args
(
po
,
objFiles
);
std
::
vector
<
std
::
string
>
args
=
cc
::
ld_args
(
po
,
objFiles
);
auto
tmpdir
=
link_dios_native
(
args
,
cxx
);
ld_args_c
.
reserve
(
args
.
size
()
);
ld_args_c
.
reserve
(
args
.
size
()
);
for
(
size_t
i
=
0
;
i
<
args
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
args
.
size
();
++
i
)
ld_args_c
.
push_back
(
args
[
i
].
c_str
()
);
ld_args_c
.
push_back
(
args
[
i
].
c_str
()
);
...
@@ -96,6 +101,7 @@ int compile_and_link( cc::ParsedOpts& po, cc::CC1& clang, PairedFiles& objFiles,
...
@@ -96,6 +101,7 @@ int compile_and_link( cc::ParsedOpts& po, cc::CC1& clang, PairedFiles& objFiles,
if
(
!
linked
)
if
(
!
linked
)
throw
cc
::
CompileError
(
"lld failed, not linked"
);
throw
cc
::
CompileError
(
"lld failed, not linked"
);
}
}
std
::
unique_ptr
<
llvm
::
Module
>
mod
=
cc
::
link_bitcode
<
rt
::
DiosCC
,
true
>
(
objFiles
,
clang
,
po
.
libSearchPath
);
std
::
unique_ptr
<
llvm
::
Module
>
mod
=
cc
::
link_bitcode
<
rt
::
DiosCC
,
true
>
(
objFiles
,
clang
,
po
.
libSearchPath
);
std
::
string
file_out
=
po
.
outputFile
!=
""
?
po
.
outputFile
:
"a.out"
;
std
::
string
file_out
=
po
.
outputFile
!=
""
?
po
.
outputFile
:
"a.out"
;
...
@@ -207,7 +213,7 @@ int main( int argc, char **argv )
...
@@ -207,7 +213,7 @@ int main( int argc, char **argv )
else
else
{
{
cc
::
compileFiles
(
po
,
clang
,
objFiles
);
cc
::
compileFiles
(
po
,
clang
,
objFiles
);
return
compile_and_
link
(
po
,
clang
,
objFiles
,
brick
::
string
::
endsWith
(
argv
[
0
],
"divc++"
)
);
return
link
(
po
,
clang
,
objFiles
,
brick
::
string
::
endsWith
(
argv
[
0
],
"divc++"
)
);
}
}
}
catch
(
cc
::
CompileError
&
err
)
{
}
catch
(
cc
::
CompileError
&
err
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment