Monday, November 5, 2012

On bzr-svn and svn-buildpackage

You might think that it would be hard to build a Debian package maintained in Subversion that you've checked out using bzr-svn; I certainly couldn't find anything actually about it when I searched for bzr-svn svn-buildpackage, whereas for git-svn svn-buildpackage I found some stuff obviously about that (but which didn't turn out to actually work).

However, it looks like the real reason nobody seems to say much about this is that it's actually drop-dead easy: just use bzr-builddeb as if it were really just a bzr branch! (It certainly seems to work with cm-super.)

Hopefully, this blog post will aid future searchers, even if I don't have much google-juice…

Edit: Unfortunately, with bzr-svn's demise – it is not being updated for compatibility with new versions of libsvn – it probably won't be of much further use to anyone. Good bye, bzr-svn, I miss you!

Saturday, June 2, 2012

Note on PowerPC relocations

It turns out that the #ha function, defined as #ha(x) = (((x >> 16) + ((x & 0x8000) ? 1 : 0)) & 0xFFFF) in the System V Application Binary Interface: PowerPC Processor Supplement, can also be implemented as #ha(x) = ((x + 0x8000) >> 16) & 0xFFFF, or simply #ha(x) = #hi(x + 0x8000):

Prelude Data.Bits Data.Int> let ha :: Int32 -> Int16; ha x = fromIntegral (x `shiftR` 16) + (if testBit x 15 then 1 else 0)
Prelude Data.Bits Data.Int> let hi :: Int32 -> Int16; hi x = fromIntegral (x `shiftR` 16)
Prelude Data.Bits Data.Int> all (\x -> ha x == hi (x + 0x8000)) [-0x20000..0x20000]

This could be useful in IDA, which does not have an offset type appropriate for R_PPC_ADDR16_HA relocations.