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
2a68c68d
Verified
Commit
2a68c68d
authored
5 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Use the same Stack struct for ld_so start as for relibc start
parent
a72c5f4a
No related branches found
No related tags found
No related merge requests found
Pipeline
#4972
failed
5 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ld_so/start.rs
+2
-7
2 additions, 7 deletions
src/ld_so/start.rs
src/start.rs
+15
-9
15 additions, 9 deletions
src/start.rs
with
17 additions
and
16 deletions
src/ld_so/start.rs
+
2
−
7
View file @
2a68c68d
...
@@ -4,14 +4,9 @@ use c_str::CStr;
...
@@ -4,14 +4,9 @@ use c_str::CStr;
use
header
::
unistd
;
use
header
::
unistd
;
use
platform
::
types
::
c_char
;
use
platform
::
types
::
c_char
;
use
crate
::
start
::
Stack
;
use
super
::
linker
::
Linker
;
use
super
::
linker
::
Linker
;
#[repr(C)]
pub
struct
Stack
{
argc
:
isize
,
argv0
:
*
const
c_char
,
}
#[no_mangle]
#[no_mangle]
pub
extern
"C"
fn
relibc_ld_so_start
(
sp
:
&
'static
mut
Stack
)
->
usize
{
pub
extern
"C"
fn
relibc_ld_so_start
(
sp
:
&
'static
mut
Stack
)
->
usize
{
if
sp
.argc
<
2
{
if
sp
.argc
<
2
{
...
@@ -26,7 +21,7 @@ pub extern "C" fn relibc_ld_so_start(sp: &'static mut Stack) -> usize {
...
@@ -26,7 +21,7 @@ pub extern "C" fn relibc_ld_so_start(sp: &'static mut Stack) -> usize {
// Pop the first argument (path to ld_so), and get the path of the program
// Pop the first argument (path to ld_so), and get the path of the program
let
path_c
=
unsafe
{
let
path_c
=
unsafe
{
let
mut
argv
=
&
mut
sp
.argv
0
as
*
mut
*
const
c_char
as
*
mut
usize
;
let
mut
argv
=
sp
.argv
()
as
*
mut
usize
;
// Move arguments
// Move arguments
loop
{
loop
{
...
...
This diff is collapsed.
Click to expand it.
src/start.rs
+
15
−
9
View file @
2a68c68d
...
@@ -8,21 +8,27 @@ use platform::{Pal, Sys};
...
@@ -8,21 +8,27 @@ use platform::{Pal, Sys};
#[repr(C)]
#[repr(C)]
pub
struct
Stack
{
pub
struct
Stack
{
argc
:
isize
,
pub
argc
:
isize
,
argv0
:
*
const
c_char
,
pub
argv0
:
*
const
c_char
,
}
}
impl
Stack
{
impl
Stack
{
fn
arg
c
(
&
self
)
->
isize
{
pub
fn
arg
v
(
&
self
)
->
*
const
*
const
c_char
{
self
.arg
c
&
self
.arg
v0
as
*
const
_
}
}
fn
argv
(
&
self
)
->
*
const
*
const
c_char
{
pub
fn
envp
(
&
self
)
->
*
const
*
const
c_char
{
&
self
.argv0
as
*
const
_
unsafe
{
self
.argv
()
.offset
(
self
.argc
+
1
)
}
}
}
fn
envp
(
&
self
)
->
*
const
*
const
c_char
{
pub
fn
auxv
(
&
self
)
->
*
const
(
usize
,
usize
)
{
unsafe
{
self
.argv
()
.offset
(
self
.argc
()
+
1
)
}
unsafe
{
let
mut
envp
=
self
.envp
();
while
!
(
*
envp
)
.is_null
()
{
envp
=
envp
.add
(
1
);
}
envp
.add
(
1
)
as
*
const
(
usize
,
usize
)
}
}
}
}
}
...
@@ -72,7 +78,7 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
...
@@ -72,7 +78,7 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
relibc_verify_host
();
relibc_verify_host
();
// Set up argc and argv
// Set up argc and argv
let
argc
=
sp
.argc
()
;
let
argc
=
sp
.argc
;
let
argv
=
sp
.argv
();
let
argv
=
sp
.argv
();
platform
::
inner_argv
=
copy_string_array
(
argv
,
argc
as
usize
);
platform
::
inner_argv
=
copy_string_array
(
argv
,
argc
as
usize
);
platform
::
argv
=
platform
::
inner_argv
.as_mut_ptr
();
platform
::
argv
=
platform
::
inner_argv
.as_mut_ptr
();
...
...
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