File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,3 @@ members = [
88
99[profile .release ]
1010strip = true
11-
12- [profile .dev .package .loader-shim ]
13- opt-level = 1
14-
15- [profile .release .package .loader-shim ]
16- opt-level = " s"
Original file line number Diff line number Diff line change 1717// system standard libraries.
1818// See https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
1919//
20- // Since _start is defined in the system startup files, with this option
20+ // The `-nostdlib` flag is much like a combination of `-nostartfiles` and
21+ // `-nodefaultlibs`.
22+ //
23+ // Since `_start` is defined in the system startup files, with this option
2124// we can use our own `_start` function to override the program entry point.
2225#[ link_args = "-nostdlib" ]
2326#[ link_args = "-ffreestanding" ]
2831#[ cfg_attr( target_arch = "aarch64" , link_args = "-Wl,-Ttext=0x2000000000" ) ]
2932extern "C" { }
3033
34+ // The compiler may emit a call to the `memset()` function even if there is
35+ // no such call in our code. However, since we use `-nostdlib` or
36+ // `-nodefaultlibs`, this means we will not link to libc, which provides the
37+ // implementation of `memset()`.
38+ //
39+ // In this case, we will get an `undefined reference to \`memset'` error.
40+ // Fortunately, the crate `rlibc` provides an unoptimized implementation of
41+ // `memset()`.
42+ //
43+ // See `-nodefaultlibs` at https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
44+ extern crate rlibc;
45+
3146mod script;
3247
3348use core:: { fmt:: Write , panic:: PanicInfo } ;
You can’t perform that action at this time.
0 commit comments