diff options
| author | dianqk <dianqk@dianqk.net> | 2025-06-30 19:23:21 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-30 19:23:21 +0800 |
| commit | 7760cd61540a53f2d96c1c951d81435aacb5317e (patch) | |
| tree | 1e9f9faa572cf57c3875bc9334b78dbce1ccfaca /compiler/rustc_codegen_ssa/src | |
| parent | 327fe35db3b4e6783a1e21f6e191800efed6fe59 (diff) | |
| parent | 54cec0cf5a1f03e295f483d047a0feae203e715b (diff) | |
| download | rust-7760cd61540a53f2d96c1c951d81435aacb5317e.tar.gz rust-7760cd61540a53f2d96c1c951d81435aacb5317e.zip | |
Rollup merge of #143196 - Periodic1911:link_section, r=oli-obk
Port #[link_section] to the new attribute parsing infrastructure Ports link_section to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@oli-obk` cc `@JonathanBrouwer` `@jdonszelmann`
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/codegen_attrs.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index 7680f8e1074..a87c26f43f9 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -124,6 +124,9 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { AttributeKind::Naked(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::NAKED, AttributeKind::Align { align, .. } => codegen_fn_attrs.alignment = Some(*align), AttributeKind::LinkName { name, .. } => codegen_fn_attrs.link_name = Some(*name), + AttributeKind::LinkSection { name, .. } => { + codegen_fn_attrs.link_section = Some(*name) + } AttributeKind::NoMangle(attr_span) => { if tcx.opt_item_name(did.to_def_id()).is_some() { codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE; @@ -253,16 +256,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { } } } - sym::link_section => { - if let Some(val) = attr.value_str() { - if val.as_str().bytes().any(|b| b == 0) { - let msg = format!("illegal null byte in link_section value: `{val}`"); - tcx.dcx().span_err(attr.span(), msg); - } else { - codegen_fn_attrs.link_section = Some(val); - } - } - } sym::link_ordinal => { link_ordinal_span = Some(attr.span()); if let ordinal @ Some(_) = check_link_ordinal(tcx, attr) { |
