Skip to content

Commit b3cadd2

Browse files
committed
Allow multiple instrumentation attributes
Four because that's the new reasonable maximum for XRay instrumentation attributes in the following commit.
1 parent d748f08 commit b3cadd2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/rustc_codegen_llvm/src/attributes.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ pub fn frame_pointer_type_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attr
118118

119119
/// Tell LLVM what instrument function to insert.
120120
#[inline]
121-
fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
121+
fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> SmallVec<[&'ll Attribute; 4]> {
122+
let mut attrs = SmallVec::new();
122123
if cx.sess().opts.unstable_opts.instrument_mcount {
123124
// Similar to `clang -pg` behavior. Handled by the
124125
// `post-inline-ee-instrument` LLVM pass.
@@ -127,14 +128,13 @@ fn instrument_function_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribu
127128
// See test/CodeGen/mcount.c in clang.
128129
let mcount_name = cx.sess().target.mcount.as_ref();
129130

130-
Some(llvm::CreateAttrStringValue(
131+
attrs.push(llvm::CreateAttrStringValue(
131132
cx.llcx,
132133
"instrument-function-entry-inlined",
133134
&mcount_name,
134-
))
135-
} else {
136-
None
135+
));
137136
}
137+
attrs
138138
}
139139

140140
fn nojumptables_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {

0 commit comments

Comments
 (0)