ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2020/04/24/16:19:09

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Received: by 2002:a05:620a:1649:: with SMTP id c9mr11062080qko.396.1587758383747;
Fri, 24 Apr 2020 12:59:43 -0700 (PDT)
X-Received: by 2002:a25:3c83:: with SMTP id j125mr17837193yba.348.1587758383382;
Fri, 24 Apr 2020 12:59:43 -0700 (PDT)
Newsgroups: comp.os.msdos.djgpp
Date: Fri, 24 Apr 2020 12:59:43 -0700 (PDT)
In-Reply-To: <8af0ebdd-acea-a7be-3388-d295af50bfc7@gmail.com>
Complaints-To: groups-abuse AT google DOT com
Injection-Info: google-groups.googlegroups.com; posting-host=45.58.213.126; posting-account=DTw6mgoAAABVKmwnaJ8FE6P8zb_HY_u-
NNTP-Posting-Host: 45.58.213.126
References: <b73af67e-9b17-40c7-9b8d-dcb6d70b2944 AT googlegroups DOT com> <8af0ebdd-acea-a7be-3388-d295af50bfc7 AT gmail DOT com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <708c79a5-c5f4-4144-8d02-0f2a0497c441@googlegroups.com>
Subject: Re: Issues using DJGPP with Rust
From: "noname422 AT gmail DOT com [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Injection-Date: Fri, 24 Apr 2020 19:59:43 +0000
Bytes: 4211
Lines: 57
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 03OKFJmp023976
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

I sent responses to this by email but it's not showing up on the Google group so I'll past it in here. If you get duplicate messages, sorry about that.

The first message:

Sure! I've had a somewhat long conversation on GitHub, where I've been trying to figure it out with the help of a few other people. Here's a link to that. The repository that this discussion is on doesn't currently have the DJGPP version of this, so the code there isn't that relevant.

https://github.com/Serentty/rusty-dos/issues/3

Maybe I can upload a ZIP file with the code I have at the moment. I'll see if I can get that up in a bit. The tools I'm using are a DJGPP cross compiler (including the linker), and the Rust compiler. I'm using Rust's Cargo build system, so it's that that ends up invoking both the Rust and C compilers. I have absolute paths to the DJGPP tools at the moment, so to build it locally you would need to modify both dos32.json (the target specification file) and build.rs (the build script which is responsible for compiling the C section).

I'll ZIP it up and send it off in a few minutes.

The second message:

Before I go on, I should mention one small change I've made that I haven't mentioned so far: I told LLVM to generate code using the “large” code model in the dos32.json file, which describes the target platform. This makes it always loads the address of a function into a register before calling it, and it seems like it works as a workaround to get it to call the correct address for functions, but the address offset issue is still a big problem, as I'll explain below. This seems connected to it calling the wrong address for functions, so I have a hunch that if I can solve it that workaround will not be necessary.

Here is a ZIP file with the source code, along with two prebuilt executables built by commenting and uncommenting different lines in the source.

http://www.mediafire.com/file/nnwprp5bdv41gr9/Rust_DJGPP_Stuff.zip

I uploaded it to MediaFire because Gmail doesn't let you send ZIP files with EXEs in them or encrypted ZIP files. The trick of just changing the extension to something else doesn't work anymore it seems. To build it yourself, you need a recent version of Rust (maybe the nightly version, get that one to be safe), DJGPP (which you need to point to in the two files I mentioned in the last message), and to run this Cargo command in the project directory:

cargo build --target dos32.json --release -Z build-std=core,alloc

It will build the executable in target/dos32/release if all goes well.

If you can't get it building, I'll point out a specific issue that happens in the version that tries to use puts(). That's one of the executables that I've included. It seems like the pointer that puts() get is pointing to the wrong place, because the string that gets printed out is nonsense and doesn't even match the length of my string.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019