Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macro_rules-wrapped asm! fails on att_syntax #77584

Closed
cuviper opened this issue Oct 5, 2020 · 4 comments · Fixed by #77595
Closed

macro_rules-wrapped asm! fails on att_syntax #77584

cuviper opened this issue Oct 5, 2020 · 4 comments · Fixed by #77595
Assignees
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cuviper
Copy link
Member

cuviper commented Oct 5, 2020

The probe crate uses asm! with att_syntax, because SDT operands are written in ELF notes, to be read by third-party tools expecting that syntax. Recently this has regressed:

~/rust/probe$ cargo check --examples
    Checking probe v0.2.1 (/home/jistone/rust/probe)
error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, or `readonly`, found `att_syntax`
 --> examples/loop.rs:4:5
  |
4 |     probe!(foo, begin);
  |     ^^^^^^^^^^^^^^^^^^^ expected one of 8 possible tokens
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, or `readonly`, found `att_syntax`
 --> examples/loop.rs:8:9
  |
8 |         probe!(foo, loop, i, total);
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of 8 possible tokens
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: expected one of `)`, `att_syntax`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, or `readonly`, found `att_syntax`
  --> examples/loop.rs:11:5
   |
11 |     probe!(foo, end);
   |     ^^^^^^^^^^^^^^^^^ expected one of 8 possible tokens
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 3 previous errors

error: could not compile `probe`

To learn more, run the command again with --verbose.

cargo bisect-rustc pointed me to #77275 -- cc @petrochenkov. I see that there were regressions with asm! during that review, but not exactly like what I'm seeing here.

Meta

searched nightlies: from nightly-2020-09-28 to nightly-2020-10-04
regressed nightly: nightly-2020-09-30
searched commits: from fc2daaa to 381b445
regressed commit: 26373fb

bisected with cargo-bisect-rustc v0.5.2

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --access github -- check --examples
@cuviper cuviper added the C-bug Category: This is a bug. label Oct 5, 2020
@cuviper
Copy link
Member Author

cuviper commented Oct 5, 2020

It's probably relevant that the actual att_syntax token is passed as an arch-conditional $opt:ident parameter here:
https://github.com/cuviper/rust-libprobe/blob/ae1286b26693cc29775d71be40f09245031c8a2e/src/platform/systemtap.rs#L83

@jonas-schievink jonas-schievink added A-inline-assembly Area: Inline assembly (`asm!(…)`) A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 5, 2020
@petrochenkov
Copy link
Contributor

cargo bisect-rustc pointed me to #77275

Yes, I've missed this case, sorry.
Will fix soon.

@petrochenkov
Copy link
Contributor

Fixed in #77595.

@bors bors closed this as completed in a14bf48 Oct 7, 2020
@cuviper
Copy link
Member Author

cuviper commented Oct 7, 2020

Works for me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inline-assembly Area: Inline assembly (`asm!(…)`) A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants