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
Peter Limkilde Svendsen
relibc
Commits
706a8de7
"git@gitlab.redox-os.org:redox-os/redoxfs.git" did not exist on "fd4d674422c4557bc51306ee86aaee5f5f58776b"
Commit
706a8de7
authored
6 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Call _init and _fini
parent
882b86e2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/header/stdlib/mod.rs
+6
-0
6 additions, 0 deletions
src/header/stdlib/mod.rs
src/start.rs
+7
-2
7 additions, 2 deletions
src/start.rs
with
13 additions
and
2 deletions
src/header/stdlib/mod.rs
+
6
−
0
View file @
706a8de7
...
...
@@ -218,12 +218,18 @@ pub extern "C" fn erand(xsubi: [c_ushort; 3]) -> c_double {
#[no_mangle]
pub
unsafe
extern
"C"
fn
exit
(
status
:
c_int
)
{
extern
"C"
{
fn
_fini
();
}
for
i
in
(
0
..
ATEXIT_FUNCS
.len
())
.rev
()
{
if
let
Some
(
func
)
=
ATEXIT_FUNCS
[
i
]
{
(
func
)();
}
}
_fini
();
Sys
::
exit
(
status
);
}
...
...
This diff is collapsed.
Click to expand it.
src/start.rs
+
7
−
2
View file @
706a8de7
use
alloc
::
Vec
;
use
core
::
ptr
;
use
header
::
stdio
;
use
header
::
{
stdio
,
stdlib
}
;
use
platform
;
use
platform
::
types
::
*
;
use
platform
::{
Pal
,
Sys
};
...
...
@@ -30,6 +30,7 @@ impl Stack {
#[no_mangle]
pub
unsafe
extern
"C"
fn
relibc_start
(
sp
:
&
'static
Stack
)
->
!
{
extern
"C"
{
fn
_init
();
fn
main
(
argc
:
isize
,
argv
:
*
const
*
const
c_char
,
envp
:
*
const
*
const
c_char
)
->
c_int
;
}
...
...
@@ -63,11 +64,15 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
stdio
::
stdout
=
stdio
::
default_stdout
.get
();
stdio
::
stderr
=
stdio
::
default_stderr
.get
();
Sys
::
exit
(
main
(
_init
();
stdlib
::
exit
(
main
(
argc
,
argv
,
// not envp, because programs like bash try to modify this *const*
// pointer :|
platform
::
environ
as
*
const
*
const
c_char
,
));
unreachable!
();
}
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