212 results for "":
Dynamic symbol resolution
More ELF relocations
In our last installment of
“Making our own executable packer”, we did some code cleanups. We got rid of
a bunch of unsafe
code, and found a way to represent memory-mapped data
structures safely.
But that article was merely a break in our otherwise colorful saga of “trying
to get as many executables to run with our own dynamic loader”. The last thing
we got running was the ifunc-nolibc
program.
Everything but ELF
And we’re back!
In the last article, we thanked our old code and bade it adieu, for it did not spark joy. And then we made a new, solid foundation, on which we planned to actually make an executable packer.
As part of this endeavor, we’ve made a crate called encore
, which only
depends on libcore
, and provides some of the things libstd
would give us,
but which we cannot have, because we do not want to rely on a libc.
Truly headless draw.io exports
I love diagrams. I love them so much!
In fact, I have fairly poor visualization skills, so making a diagram is extremely helpful to me: I’ll have some vague idea of how different things are connected, and then I’ll make a diagram, and suddenly there’s a tangible thing I can look at and talk about.
Of course the diagram only represents a fraction of what I had in mind in the first place, but that’s okay: the point is to be able to talk about some aspect of a concept, and so I have to make choices about what to include in the diagram. And maybe make several diagrams.
The shortest ooc quine
A few days ago I posted an ooc quine. But while browing HackerNews, I found an even shorter one. The shortest!
Here it is, in its full glory
Can’t see anything? That’s an empty file. It will compile and run just fine. ooc doesn’t require a main function - you can just shove code in there that will run at the program’s initialization. If there’s none, no big deal! It’ll just not run anything.
And then there were fewer bugs
Intro
This deals with rock internals, so fasten your seatbelts and expect many weird things along the way. I’m not necessarily proud of the state of the implementation, I’m just rolling with it and trying to improve it gradually rather than throw everything away.
An error out of nowhere
While working on my current game, John Q. Adamant, I was looking to extract a class into another module - this is routine refactoring and shouldn’t be too hard.
Huffman 101
Let’s play a game: your objective is to guess a word, but you can only ask yes or no questions. You should also aim to ask as few questions as possible.
You might have played a variant of this game before, guessing famous actors or musicians. You’d usually ask questions like “Are they alive?”, or “Have they won an Oscar”? And that would allow you to narrow down the possibilities, until you finally resort to a list of direct guesses (“Is it Amy Adams?”) or simply give up.
*andfall
Welp, I did it again - I released an album: it’s named *andfall, a play on the word “landfall”, and I wrote it in one week-end, for @McFunkyPants’ entry in the Ludum Dare 33 game jam.
It’s my first solo album, the previous ones were collaborations with @bigsylvain and @geckojsc. It feels a bit weird to release an album alone - there’s nobody to blame for the flaws, and nobody to praise for the good parts!
Day 10 (Advent of Code 2022)
Onwards! To the day 10 puzzle.
I don’t see a way to make part 1 especially fun — so let’s just get to it.
Parsing
As usual, let’s reach for the nom crate…
$ cargo add nom@7
(cut)
…to parse the input into nicely-organized Rust data structures:
// in `src/main.rs`
use nom::{
branch::alt,
bytes::complete::tag,
combinator::{map, value},
sequence::preceded,
IResult,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
enum Instruction {
Noop,
Addx(i32),
}
impl Instruction {
fn parse(i: &str) -> IResult<&str, Self> {
let noop = tag("noop");
let addx = preceded(tag("addx "), nom::character::complete::i32);
alt((value(Self::Noop, noop), map(addx, Self::Addx)))(i)
}
fn cycles(self) -> u32 {
match self {
Self::Noop => 1,
Self::Addx(_) => 2,
}
}
}
Porting poppler to meson
It took a hot minute.
Try several weeks.
Well, yeah. I got to contribute to a bunch of open-source projects in the meantime though, so I’m fairly pleased with it!
- libffi (for static linking)
- cairo (more static linking!)
- proxy-libintl (more static linking!)
- expat (static linking strikes again)
- poppler (for file descriptor stuff not properly gated on Windows, closed in favor of a similar MR)