profile
viewpoint
Per Larsen thedataking @immunant Irvine, CA www.immunant.com Compilers, systems programming, information security. Learning Rust.

thedataking/SublimeWritingStyle 51

Improve your writing style with this Sublime Text package

immunant/rstrace 3

Trace compiler and linker invocations

immunant/cctrace 0

Trace invocations of compiler, linker, and other build tools

thedataking/atom-latex 0

A simple utility package for Atom that invokes latexmk.

thedataking/AtomWritingStyle 0

Writing style assistant for Atom

thedataking/awesome-rust 0

A curated list of Rust code and resources.

thedataking/libxml2 0

XML parser and markup toolkit

thedataking/lua 0

The Lua repo, as seen by the Lua team. Mirrored irregularly

thedataking/package_control_channel 0

Default channel file for Package Control. Follow the directions at:

startedmakeworld-the-better-one/amfora

started time in 2 days

fork struct/mimalloc-bench

Suite for benchmarking malloc implementations.

fork in 5 days

issue openedimmunant/c2rust

rust2c?

Hi, are there any plans for a complementary Rust2C utility?

created time in 7 days

issue openedimmunant/c2rust

FTBFS on Linux (OpenSUSE/Tumbleweed)

The builds end with this:

   Compiling sequence_trie v0.3.6
error[E0433]: failed to resolve: maybe a missing crate `rustc_target`?
 --> c2rust-ast-builder/src/builder.rs:3:5
  |
3 | use rustc_target::spec::abi::{self, Abi};
  |     ^^^^^^^^^^^^ maybe a missing crate `rustc_target`?

error[E0432]: unresolved import `rustc`
 --> c2rust-ast-builder/src/builder.rs:2:5
  |
2 | use rustc::hir;
  |     ^^^^^ maybe a missing crate `rustc`?

error[E0433]: failed to resolve: use of undeclared type or module `abi`
  --> c2rust-ast-builder/src/builder.rs:71:9
   |
71 |         abi::lookup(self).expect(&format!("unrecognized string for Abi: {:?}", self))
   |         ^^^ use of undeclared type or module `abi`

error[E0412]: cannot find type `Abi` in this scope
  --> c2rust-ast-builder/src/builder.rs:69:15
   |
69 | impl<'a> Make<Abi> for &'a str {
   |               ^^^ not found in this scope

error[E0412]: cannot find type `Abi` in this scope
  --> c2rust-ast-builder/src/builder.rs:70:37
   |
70 |     fn make(self, _mk: &Builder) -> Abi {
   |                                     ^^^ not found in this scope

error[E0412]: cannot find type `Abi` in this scope
  --> c2rust-ast-builder/src/builder.rs:81:27
   |
81 | impl<'a> Make<Extern> for Abi {
   |                           ^^^ not found in this scope

   Compiling json v0.12.0
   Compiling strum v0.16.0
   Compiling fake-simd v0.1.2
   Compiling diff v0.1.12
   Compiling glob v0.2.11
   Compiling is-match v0.1.0
   Compiling strum v0.15.0
   Compiling open v1.3.2
error: aborting due to 6 previous errors

Some errors have detailed explanations: E0412, E0432, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `c2rust-ast-builder`.
warning: build failed, waiting for other jobs to finish...
error: build failed
c2rust@stitny (master *)$ 

Complete build log from building with llvm/clang 10 and running cargo +nightly-2019-12-05 build.

created time in 10 days

startedmxssl/sre-interview-prep-guide

started time in 13 days

startedubergeek42/weechat-android

started time in 16 days

Pull request review commentimmunant/c2rust

llvm 11 fixes

 static std::vector<const char *> augment_argv(int argc, const char *argv[]) {     SmallString<128> P("-extra-arg=-resource-dir=" CLANG_BIN_PATH);     llvm::sys::path::append(P, "..", Twine("lib") + CLANG_LIBDIR_SUFFIX,                             "clang", CLANG_VERSION_STRING);-    std::string resource_dir = P.str();+    std::string resource_dir = P.str().str();

I don't think an extra ifdef is necessary, but it is of course your call!

It's fine, no ifdef needed.

kaspar030

comment created time in 16 days

Pull request review commentimmunant/c2rust

llvm 11 fixes

 class TranslateConsumer : public clang::ASTConsumer {             } #else  // CLANG_VERSION_MAJOR >= 10             const FileID file = sourceMgr.getMainFileID();-            auto comments = Context.getRawCommentList().getCommentsInFile(file);+            auto comments = Context.Comments.getCommentsInFile(file);

Does that warrant an #ifdef?

No, that's fine, as long as the new code works on older versions.

kaspar030

comment created time in 16 days

pull request commentimmunant/c2rust

llvm 11 fixes

I don't think an extra ifdef is necessary, but it is of course your call!

Please advise. No ifdefs are necessary down to at least clang 6. I can add them if you'd prefer that.

kaspar030

comment created time in 16 days

Pull request review commentimmunant/c2rust

llvm 11 fixes

 static std::vector<const char *> augment_argv(int argc, const char *argv[]) {     SmallString<128> P("-extra-arg=-resource-dir=" CLANG_BIN_PATH);     llvm::sys::path::append(P, "..", Twine("lib") + CLANG_LIBDIR_SUFFIX,                             "clang", CLANG_VERSION_STRING);-    std::string resource_dir = P.str();+    std::string resource_dir = P.str().str();

I compiled this in a ubuntu bionic container with clang-6 and libclang-6:

root@71976200ca48:/src/c2rust# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
root@71976200ca48:/src/c2rust# clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
root@71976200ca48:/src/c2rust# cargo --version
cargo 1.41.0-nightly (626f0f40e 2019-12-03)
root@71976200ca48:/src/c2rust# rustc --version
rustc 1.41.0-nightly (6d77e45f0 2019-12-04)
root@71976200ca48:/src/c2rust# git describe  
0.1.0-3140-g8e7131e6

The test suite passed:

root@71976200ca48:/src/c2rust# python3 ./scripts/test_translator.py --debug ./tests
[...]
Test summary:                                                            
  unexpected failures: 0                                                 
  unexpected successes: 0                                                
  expected failures: 3                                                   
  successes: 108

I don't think an extra ifdef is necessary, but it is of course your call!

kaspar030

comment created time in 19 days

Pull request review commentimmunant/c2rust

llvm 11 fixes

 class TranslateConsumer : public clang::ASTConsumer {             } #else  // CLANG_VERSION_MAJOR >= 10             const FileID file = sourceMgr.getMainFileID();-            auto comments = Context.getRawCommentList().getCommentsInFile(file);+            auto comments = Context.Comments.getCommentsInFile(file);

New in clang 11 is the removal of the getter. The field is public since at least clang 6. Does that warrant an #ifdef?

kaspar030

comment created time in 19 days

Pull request review commentimmunant/c2rust

llvm 11 fixes

 class TranslateConsumer : public clang::ASTConsumer {             } #else  // CLANG_VERSION_MAJOR >= 10             const FileID file = sourceMgr.getMainFileID();-            auto comments = Context.getRawCommentList().getCommentsInFile(file);+            auto comments = Context.Comments.getCommentsInFile(file);

If this is new to clang 11, it should be wrapped in a version check (see CLANG_VERSION_MAJOR above).

kaspar030

comment created time in 20 days

Pull request review commentimmunant/c2rust

llvm 11 fixes

 static std::vector<const char *> augment_argv(int argc, const char *argv[]) {     SmallString<128> P("-extra-arg=-resource-dir=" CLANG_BIN_PATH);     llvm::sys::path::append(P, "..", Twine("lib") + CLANG_LIBDIR_SUFFIX,                             "clang", CLANG_VERSION_STRING);-    std::string resource_dir = P.str();+    std::string resource_dir = P.str().str();

Same as above: wrap in a check on CLANG_VERSION_MAJOR.

kaspar030

comment created time in 20 days

pull request commentimmunant/c2rust

llvm 11 fixes

LGTM but we should test this on older LLVM versions.

kaspar030

comment created time in 20 days

pull request commentimmunant/c2rust

llvm 11 fixes

I've merged this into my integration branch (for-riot, which contains all my PRs), and it's still working fine with -10.

kaspar030

comment created time in 21 days

PR opened immunant/c2rust

llvm 11 fixes

My Arch Linux bumped me to clang/llvm 11 today, which broke c2rust compilation.

This PR contains the fixes I needed to make it compile:

  1. ASTContext::getRawCommentList() was removed. It was a getter for ASTContext::Comments, which is a public field. So there's a commit that directly accesses the field.

  2. SmallString::str() changed semantics slightly, causing it to not map to std::string. A double .str().str() goes through StringRef to std::string. LLVM 11 offers a direct std::string(X) operator, but to keep this compatible, I kept the double call.

I did not test this on clang/llvm < 11...

+2 -2

0 comment

1 changed file

pr created time in 21 days

PR opened immunant/c2rust

Update handlebars to 3.0

handlebars 3.0 provides better performance than 2.0

+22 -3

0 comment

2 changed files

pr created time in 22 days

pull request commentimmunant/c2rust

asm-casts: Run on no_std

I was dumb and missed this crate in the publish. Should be good now @chrysn

chrysn

comment created time in a month

push eventimmunant/c2rust

Stephen Crane

commit sha 63848a29b44334f5688e3b440c84815d99425201

Update c2rust-asm-casts to 0.2.0 c2rust-asm-casts is now compatible with no_std

view details

push time in a month

push eventimmunant/c2rust

Stephen Crane

commit sha 5fafb8125d8922771720e22343dd42fd28f380ef

Update c2rust-asm-casts to 0.2.0 c2rust-asm-casts is now compatible with no_std

view details

push time in a month

created tagimmunant/c2rust

tag0.15.1

Migrate C code to Rust

created time in a month

pull request commentimmunant/c2rust

asm-casts: Run on no_std

I still see https://crates.io/crates/c2rust-asm-casts as being the 0.1.1 of last 2019-10-30, might something have gone wrong during the upload?

chrysn

comment created time in a month

pull request commentimmunant/c2rust

asm-casts: Run on no_std

@chrysn new version is published, sorry it took so long.

chrysn

comment created time in a month

created tagimmunant/c2rust

tag0.15.0

Migrate C code to Rust

created time in a month

release immunant/c2rust

0.15.0

released time in a month

push eventimmunant/c2rust

Stephen Crane

commit sha 27275f3b864496f1cb852199624b4452cd17fb1a

Bump version to 0.15.0

view details

push time in a month

issue commentimmunant/c2rust

Tracking Issue: Translation nightly features

Method wrapping_offset_from (which is often used in c2rust output) has been deprecated since 1.46 and it is being removed in ptr_offset_from stabilization PR: rust-lang/rust#74238

And looks like it's entirely gone now, says the feature doesn't exist and the wrapping_offset_from call no longer exists in the source.

TheDan64

comment created time in a month

issue openedsecuresystemslab/BinRec

source code availability

hello. when will it be released ?

created time in 2 months

pull request commentimmunant/c2rust

asm-casts: Run on no_std

@rinon, is there anything left to do / where I contribute to getting this to crates.io? That dependency is currently the largest stopper to a new round of RIOT sys-/wrapper crates being published.

chrysn

comment created time in 2 months

starteddtolnay/paste

started time in 2 months

more