Link-time relaxing for m68k ELF

Michael Sokolov msokolov@ivan.Harhan.ORG
Sat Apr 22 10:24:00 GMT 2000


Richard Henderson <rth@cygnus.com> wrote:

> I also recommend leaving the existing assembler relaxation in place.

Well, of course it will remain in the code, it has to at least because link
relaxing will be implemented for ELF only.

> If the assembler knows the displacement between the two locations, it
> should go ahead and generate the smallest known sequence.

Unfortunately, making the hooks for the new relaxer coexist with the current
one would be problematic. They can coexist in the code more or less OK, but
they cannot be active at the same time. First link-time relaxing of any kind
requires the assembler to emit relocs for everything, even internal references
that otherwise would be completely resolved by the assembler without a reloc. I
have found an easy way to make m68k gas do this, but only if its relaxer is
never invoked. I couldn't find an easy way to make the relaxer emit relocs, as
its very underlying principle is that it's invoked when the reference is
internal and is to resolved without a reloc. Second, as I explained in the
thread you are responding to, the assembler will need to emit a lot of special
relaxation control information into the object file in order to make link-time
relaxing practical. It wouldn't be all that hard and not too messy to provide
hooks for emitting this information in the normally assembly path, but putting
it in the gas relaxer would be *extremely* messy. (If link-time relaxing were
done on top of gas relaxing as you suggest, references relaxed by gas would
have to still be further relaxable by the linker, otherwise the final result
could potentially be worse than with relaxing in the linker only.)

> This so that
> gas output for non-relaxing linkers is no worse than it has to be.

My plan is to give gas on m68k ELF a special option (I'm thinking --link-relax)
to make it generate objects for link-time relaxing. This option would turn off
the gas relaxer, force relocs for everything, and generate the special
relaxation control sections. gas on ELF without --link-relax and gas on a.out
and COFF would still work exactly as they do now.

I think it's OK to require a special option to turn on the new behavior, as it
is my understanding that ld itself won't relax without -relax on its command
line given explicitly (please correct me if I'm wrong), so if enabling link-
time relaxing by default would require changing gcc's linker spec anyway, its
assembler spec could be changed just as well.

--
Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			615 N GOOD LATIMER EXPY STE #4
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)


More information about the Binutils mailing list