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
Container Registry
Model registry
Operate
Environments
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
redox-os
relibc
Commits
6e67d304
Commit
6e67d304
authored
6 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into 'master'
Install openlibm from Makefile See merge request
!138
parents
8fd77a4b
829bc64a
No related branches found
No related tags found
1 merge request
!138
Install openlibm from Makefile
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+2
-0
2 additions, 0 deletions
Makefile
src/stdio/src/default.rs
+9
-22
9 additions, 22 deletions
src/stdio/src/default.rs
tests/scanf.c
+0
-1
0 additions, 1 deletion
tests/scanf.c
with
11 additions
and
23 deletions
Makefile
+
2
−
0
View file @
6e67d304
...
...
@@ -36,6 +36,8 @@ install: all
mkdir
-pv
"
$(
DESTDIR
)
/include"
cp
-rv
"include"
/
*
"
$(
DESTDIR
)
/include"
cp
-rv
"target/include"
/
*
"
$(
DESTDIR
)
/include"
cp
-rv
"target/openlibm/include"
/
*
"
$(
DESTDIR
)
/include"
cp
-rv
"target/openlibm/src"
/
*
.h
"
$(
DESTDIR
)
/include"
cp
-v
"
$(
BUILD
)
/debug/libc.a"
"
$(
DESTDIR
)
/lib"
cp
-v
"
$(
BUILD
)
/debug/crt0.o"
"
$(
DESTDIR
)
/lib"
cp
-v
"
$(
BUILD
)
/openlibm/libopenlibm.a"
"
$(
DESTDIR
)
/lib/libm.a"
...
...
This diff is collapsed.
Click to expand it.
src/stdio/src/default.rs
+
9
−
22
View file @
6e67d304
use
core
::
cell
::
UnsafeCell
;
use
core
::
sync
::
atomic
::
AtomicBool
;
use
core
::
ptr
;
use
super
::{
constants
,
internal
,
BUFSIZ
,
FILE
,
UNGET
};
struct
GlobalFile
(
UnsafeCell
<
FILE
>
);
impl
GlobalFile
{
const
fn
new
(
file
:
FILE
)
->
Self
{
GlobalFile
(
UnsafeCell
::
new
(
file
))
}
fn
get
(
&
self
)
->
*
mut
FILE
{
self
.0
.get
()
}
}
// statics need to be Sync
unsafe
impl
Sync
for
GlobalFile
{}
#[allow(non_upper_case_globals)]
static
mut
default_stdin_buf
:
[
u8
;
BUFSIZ
as
usize
+
UNGET
]
=
[
0
;
BUFSIZ
as
usize
+
UNGET
];
#[allow(non_upper_case_globals)]
static
mut
default_stdin
:
GlobalFile
=
GlobalFile
::
new
(
FILE
{
static
mut
default_stdin
:
FILE
=
FILE
{
flags
:
constants
::
F_PERM
|
constants
::
F_NOWR
|
constants
::
F_BADJ
,
rpos
:
ptr
::
null_mut
(),
rend
:
ptr
::
null_mut
(),
...
...
@@ -32,13 +19,13 @@ static mut default_stdin: GlobalFile = GlobalFile::new(FILE {
buf_char
:
-
1
,
unget
:
UNGET
,
lock
:
AtomicBool
::
new
(
false
),
}
)
;
};
#[allow(non_upper_case_globals)]
static
mut
default_stdout_buf
:
[
u8
;
BUFSIZ
as
usize
]
=
[
0
;
BUFSIZ
as
usize
];
#[allow(non_upper_case_globals)]
static
mut
default_stdout
:
GlobalFile
=
GlobalFile
::
new
(
FILE
{
static
mut
default_stdout
:
FILE
=
FILE
{
flags
:
constants
::
F_PERM
|
constants
::
F_NORD
|
constants
::
F_BADJ
,
rpos
:
ptr
::
null_mut
(),
rend
:
ptr
::
null_mut
(),
...
...
@@ -51,13 +38,13 @@ static mut default_stdout: GlobalFile = GlobalFile::new(FILE {
buf_char
:
b'\n'
as
i8
,
unget
:
0
,
lock
:
AtomicBool
::
new
(
false
),
}
)
;
};
#[allow(non_upper_case_globals)]
static
mut
default_stderr_buf
:
[
u8
;
BUFSIZ
as
usize
]
=
[
0
;
BUFSIZ
as
usize
];
#[allow(non_upper_case_globals)]
static
mut
default_stderr
:
GlobalFile
=
GlobalFile
::
new
(
FILE
{
static
mut
default_stderr
:
FILE
=
FILE
{
flags
:
constants
::
F_PERM
|
constants
::
F_NORD
|
constants
::
F_BADJ
,
rpos
:
ptr
::
null_mut
(),
rend
:
ptr
::
null_mut
(),
...
...
@@ -70,19 +57,19 @@ static mut default_stderr: GlobalFile = GlobalFile::new(FILE {
buf_char
:
-
1
,
unget
:
0
,
lock
:
AtomicBool
::
new
(
false
),
}
)
;
};
#[no_mangle]
pub
extern
"C"
fn
__stdin
()
->
*
mut
FILE
{
unsafe
{
default_stdin
.get
()
}
unsafe
{
&
mut
default_stdin
}
}
#[no_mangle]
pub
extern
"C"
fn
__stdout
()
->
*
mut
FILE
{
unsafe
{
default_stdout
.get
()
}
unsafe
{
&
mut
default_stdout
}
}
#[no_mangle]
pub
extern
"C"
fn
__stderr
()
->
*
mut
FILE
{
unsafe
{
default_stderr
.get
()
}
unsafe
{
&
mut
default_stderr
}
}
This diff is collapsed.
Click to expand it.
tests/scanf.c
+
0
−
1
View file @
6e67d304
#include
<stdio.h>
#include
<malloc.h>
int
main
(
int
argc
,
char
**
argv
)
{
int
a
=
0
;
...
...
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