Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Tornax O7
relibc
Commits
0c5abf03
Verified
Commit
0c5abf03
authored
6 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Combine all libraries into libc.a, call pthread_init and pthread_terminate in libc
parent
aefb4fb1
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Cargo.toml
+1
-1
1 addition, 1 deletion
Cargo.toml
Makefile
+19
-2
19 additions, 2 deletions
Makefile
pthreads-emb
+1
-1
1 addition, 1 deletion
pthreads-emb
src/header/stdlib/mod.rs
+3
-0
3 additions, 0 deletions
src/header/stdlib/mod.rs
src/start.rs
+3
-0
3 additions, 0 deletions
src/start.rs
with
27 additions
and
4 deletions
Cargo.toml
+
1
−
1
View file @
0c5abf03
...
...
@@ -4,7 +4,7 @@ version = "0.1.0"
authors
=
[
"Jeremy Soller <jackpot51@gmail.com>"
]
[lib]
name
=
"c"
name
=
"
relib
c"
crate-type
=
[
"staticlib"
]
[workspace]
...
...
This diff is collapsed.
Click to expand it.
Makefile
+
19
−
2
View file @
0c5abf03
...
...
@@ -76,7 +76,16 @@ sysroot: all
test
:
sysroot
make
-C
tests run
$(BUILD)/debug/libc.a
:
$(SRC)
$(BUILD)/release/libc.a
:
$(BUILD)/release/librelibc.a $(BUILD)/pthreads-emb/libpthread.a $(BUILD)/openlibm/libopenlibm.a
echo
"create
$@
"
>
"
$@
.mri"
for
lib
in
$^
;
do
\
echo
"addlib
$$
lib"
>>
"
$@
.mri"
;
\
done
echo
"save"
>>
"
$@
.mri"
echo
"end"
>>
"
$@
.mri"
ar
-M
<
"
$@
.mri"
$(BUILD)/debug/librelibc.a
:
$(SRC)
$(
CARGO
)
rustc
$(
CARGOFLAGS
)
--
$(
RUSTCFLAGS
)
touch
$@
...
...
@@ -84,7 +93,15 @@ $(BUILD)/debug/crt0.o: $(SRC)
CARGO_INCREMENTAL
=
0
$(
CARGO
)
rustc
--manifest-path
src/crt0/Cargo.toml
$(
CARGOFLAGS
)
--
--emit
obj
=
$@
$(
RUSTCFLAGS
)
touch
$@
$(BUILD)/release/libc.a
:
$(SRC)
$(BUILD)/debug/crti.o
:
$(SRC)
CARGO_INCREMENTAL
=
0
$(
CARGO
)
rustc
--manifest-path
src/crti/Cargo.toml
$(
CARGOFLAGS
)
--
--emit
obj
=
$@
$(
RUSTCFLAGS
)
touch
$@
$(BUILD)/debug/crtn.o
:
$(SRC)
CARGO_INCREMENTAL
=
0
$(
CARGO
)
rustc
--manifest-path
src/crtn/Cargo.toml
$(
CARGOFLAGS
)
--
--emit
obj
=
$@
$(
RUSTCFLAGS
)
touch
$@
$(BUILD)/release/librelibc.a
:
$(SRC)
$(
CARGO
)
rustc
--release
$(
CARGOFLAGS
)
--
$(
RUSTCFLAGS
)
touch
$@
...
...
This diff is collapsed.
Click to expand it.
pthreads-emb
@
91f0dd6e
Compare
a12978cc
...
91f0dd6e
Subproject commit
a12978ccca4c576f02971f5cfc2cbefe23e4daba
Subproject commit
91f0dd6e3f9c8ee81508f3a32e1d6f3e97e35726
This diff is collapsed.
Click to expand it.
src/header/stdlib/mod.rs
+
3
−
0
View file @
0c5abf03
...
...
@@ -233,6 +233,7 @@ pub unsafe extern "C" fn exit(status: c_int) {
static
__fini_array_start
:
extern
"C"
fn
();
static
__fini_array_end
:
extern
"C"
fn
();
fn
pthread_terminate
();
fn
_fini
();
}
...
...
@@ -251,6 +252,8 @@ pub unsafe extern "C" fn exit(status: c_int) {
_fini
();
pthread_terminate
();
Sys
::
exit
(
status
);
}
...
...
This diff is collapsed.
Click to expand it.
src/start.rs
+
3
−
0
View file @
0c5abf03
...
...
@@ -53,6 +53,7 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
static
__init_array_start
:
extern
"C"
fn
();
static
__init_array_end
:
extern
"C"
fn
();
fn
pthread_init
();
fn
_init
();
fn
main
(
argc
:
isize
,
argv
:
*
mut
*
mut
c_char
,
envp
:
*
mut
*
mut
c_char
)
->
c_int
;
}
...
...
@@ -77,6 +78,8 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
stdio
::
stdout
=
stdio
::
default_stdout
.get
();
stdio
::
stderr
=
stdio
::
default_stderr
.get
();
pthread_init
();
// Run preinit array
{
let
mut
f
=
&
__preinit_array_start
as
*
const
_
;
...
...
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