This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Suppress alignment


Hi Nick,

> > I'm using LD for linking some assembly, which should be small, but I
> > see NOP commands inserted all over, because LD align the labels on a
> > 4-byte boundary. Is it possible to suppress this alignment in LD?
>
> Which target are you using ?

I'm targeting I386 (binary). It is the first stage of a bootloader
stored in the master boot record, I'm creating. The space is limited
to 512 bytes.

> Which version of binutils are you using ?

Not sure. I'm actually using a port for Windows: DJGPP. LD tells me
version 2.16.1. I think it work just like the original.

> Are you sure that it is the linker that is to blame ?  Normally it will
> be the compiler or the assembler that decides upon the alignment of labels.

I think you're right. I have made some tests, and it seems NASM is to
blame or maybe the temporary target I'm using. It is the A.Out target
I use as a temporary between assembling and linking. It is the only
one I can use, it seems, because I code for real mode and it is the
only target with DISP16, etc. But it seems that A.Out are lacking some
other features, like deciding the alignment. In any case NASM sets a
default alignment of 4 bytes.

> Do you have a *small* reproducible testcase which demonstrates what you
> are trying to do ?

I don't think I need that. Instead I will use a different approach by
assembling it all at once without the need for linking. I think it is
easier to maintain. I will use the include preprocessing command to do
that.
No matter what there is no perfect target to use for x86 real mode code.

Thank you for answering,
Bjarke W.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]