You are not logged in.

#1 2021-03-11 16:50:25

musasabi
Member
From: Chicago, IL
Registered: 2011-06-23
Posts: 63

binutils 2.36.1-2 versus binutils 2.35-2

Hello all. I was working on this tutorial. It's my first foray into assembly after ~20 years of C/C++ and daily Linux usage. A little overdue, but ya know. smile

I arrived at the question this post regards via this reddit post for those who might wonder.

What I've discovered is that the as command from binutils 2.36.1-2 adds the .note.gnu.property section to a binary, and then ld goes ahead and combines that section with the `.text` section when asked to create a flat binary.

Moreover, it also aligns the binary with the minimum page size by default. The result requires one to strip out the errant section from the result of the as command as well as disable page alignment (with --nmagic) in order to get a predictably sized flat binary.

The goofy part is that if I downgrade to 2.35-2 via the Arch archive, all of this behavior vanishes. Now, without --nmagic and without any calls to strip, I get a 510 byte binary when I expect to get a 510 byte binary.

Given how new I am to this arena within Linux, I was unsurprisingly unable to find something of note in the binutils 2.36 release notes. But... surely there must be something? Perhaps there was no change in the upstream software, but the official Arch package for the most recent version was compiled with different options?

I'm interested to hear what anyone has to say about this, so thanks in advance for feedback/insights. smile

Offline

#2 2021-03-13 11:34:27

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: binutils 2.36.1-2 versus binutils 2.35-2

The binutils package has some very verbose source management. With ~20 years of C/C++, I think you'll be better off just reading the source code.

https://www.gnu.org/software/binutils/ points users to git://sourceware.org/git/binutils-gdb.git which can be cloned and examined. They also have a gitweb interface: https://sourceware.org/git/gitweb.cgi?p … ls-gdb.git. This github repo claims to be a mirror of the sourceware repo: https://github.com/bminor/binutils-gdb, but I have no way (or rather the intention ;-)) of verifying that right now. It might be a bit more comfortable on github.

My naive attempt to just compare the commit tags with "git diff binutils-2_36_1 binutils-2_35" is still running, but maybe you can start by grepping for ".note.gnu.property" and just diff the respective files. I'm by far not git wizard, but that's what I'd use.

Offline

Board footer

Powered by FluxBB