Rollup merge of #131651 - Patryk27:avr-unknown-unknown, r=tgross35
Create a generic AVR target: avr-none This commit removes the `avr-unknown-gnu-atmega328` target and replaces it with a more generic `avr-none` variant that must be specialized using `-C target-cpu` (e.g. `-C target-cpu=atmega328p`). Seizing the day, I'm adding myself as the maintainer of this target - I've been already fixing the bugs anyway, might as well make it official 🙂 Related discussions: - https://github.com/rust-lang/rust/pull/131171 - https://github.com/rust-lang/compiler-team/issues/800 try-job: x86_64-gnu-debug
This commit is contained in:
commit
9de94b4f8f
19 changed files with 160 additions and 60 deletions
|
@ -1990,6 +1990,7 @@ fn add_pre_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor)
|
|||
if let Some(args) = sess.target.pre_link_args.get(&flavor) {
|
||||
cmd.verbatim_args(args.iter().map(Deref::deref));
|
||||
}
|
||||
|
||||
cmd.verbatim_args(&sess.opts.unstable_opts.pre_link_args);
|
||||
}
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ pub(crate) fn get_linker<'a>(
|
|||
hinted_static: None,
|
||||
is_ld: cc == Cc::No,
|
||||
is_gnu: flavor.is_gnu(),
|
||||
uses_lld: flavor.uses_lld(),
|
||||
}) as Box<dyn Linker>,
|
||||
LinkerFlavor::Msvc(..) => Box::new(MsvcLinker { cmd, sess }) as Box<dyn Linker>,
|
||||
LinkerFlavor::EmCc => Box::new(EmLinker { cmd, sess }) as Box<dyn Linker>,
|
||||
|
@ -361,6 +362,7 @@ struct GccLinker<'a> {
|
|||
// Link as ld
|
||||
is_ld: bool,
|
||||
is_gnu: bool,
|
||||
uses_lld: bool,
|
||||
}
|
||||
|
||||
impl<'a> GccLinker<'a> {
|
||||
|
@ -552,6 +554,7 @@ impl<'a> Linker for GccLinker<'a> {
|
|||
self.link_args(&["--entry", "_initialize"]);
|
||||
}
|
||||
}
|
||||
|
||||
// VxWorks compiler driver introduced `--static-crt` flag specifically for rustc,
|
||||
// it switches linking for libc and similar system libraries to static without using
|
||||
// any `#[link]` attributes in the `libc` crate, see #72782 for details.
|
||||
|
@ -567,6 +570,15 @@ impl<'a> Linker for GccLinker<'a> {
|
|||
{
|
||||
self.cc_arg("--static-crt");
|
||||
}
|
||||
|
||||
// avr-none doesn't have default ISA, users must specify which specific
|
||||
// CPU (well, microcontroller) they are targetting using `-Ctarget-cpu`.
|
||||
//
|
||||
// Currently this makes sense only when using avr-gcc as a linker, since
|
||||
// it brings a couple of hand-written important intrinsics from libgcc.
|
||||
if self.sess.target.arch == "avr" && !self.uses_lld {
|
||||
self.verbatim_arg(format!("-mmcu={}", self.target_cpu));
|
||||
}
|
||||
}
|
||||
|
||||
fn link_dylib_by_name(&mut self, name: &str, verbatim: bool, as_needed: bool) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue