From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Wed, 8 May 96 23:47 EDT From: Eric Youngdale Subject: Re: gdb A few further thoughts. I am not trying to put you off of the idea of optimizing in such a way that we don't leave nops behind, but I just want to impress upon you how difficult such a thing really is. Normally the assembler will resolve some things such as local branches without the need for emitting a relocation. The idea is that the branch is pc-relative, so there is no point in wasting time and space by telling the linker about something which it doesn't need to handle anyways. If we were to start removing instructions, it means that we have to repair all of these local branches. One way of doing this would be to have the assembler emit everything as relocations instead of having it fill in fields that it thinks are fully resolved. To do this, absolutely everything, including every local label in the file must be emitted into the object file so that it is possible for the linker to optimize the instructions away. The other alternative to leaving ine information in the object file would be for the linker to do code reading to find all of the local branches, labelize them, optimize the code, and then use the labels to recompute all of the offsets for the local branches. In fact this is probably preferable. -Eric