This is the mail archive of the
mailing list for the binutils project.
Patching gas to remove relaxation.
- From: Sander Bogaert <sander dot bogaert at elis dot ugent dot be>
- To: binutils at sourceware dot org
- Date: Mon, 25 Nov 2013 16:44:39 +0100
- Subject: Patching gas to remove relaxation.
- Authentication-results: sourceware.org; auth=none
-----BEGIN PGP SIGNED MESSAGE-----
I'm trying to patch the GNU Assembler to prevent it from doing
relaxation. So I'm trying to retain symbols in relocations which are
exchanged with the section symbol by default.
I had a very simple, working patch for binutils 2.18. It basically
forces the "tc_fix_adjustable" function to return false by patching
the different back-end implementations. Some small other changes were
necessary too. (http://goo.gl/o57l9D)
For the newer binutils (2.22) this no longer works. The reason is the
check added in commit 76d12939 (http://goo.gl/KBFJdy).
To fix this I tried two things:
1. setting the BSF_KEEP flag for the symbols that were previously
'relaxed away' in the different fix_adjustment functions of the
I simply do this by adding (for example):
'symbol_get_bfdsym (fixP->fx_addsy)->flags |= BSF_KEEP;'
to gas/config/tc-arm.c:arm_fix_adjustable (fixS * fixP) right before
it's forced to return false.
2. comment out the previously mentioned check
Both manage to pass the if check ( kind of obvious for the second :-)
) but result in a new problem; "symbol `L0' required but not
present". This is caused by http://goo.gl/TMpzIQ . It seems like the
symbol gets removed in some way after all but not entirely since it's
So I have the following questions:
* Is my approach to achieve the removal of relaxation sane?
* Any suggestions on what I'm missing, do I need to patch other parts
to prevent deletion of the symbol?
* Could the "!=" on this line: http://goo.gl/Y4bwzr possibly be a bug?
Seems like it might want to check the single bit instead of the whole
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/
-----END PGP SIGNATURE-----