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]

extra alignment/padding when using pe-i386


When assembling the following code with an assembler that generates pe-i386 format, the data section gets extra bytes added *after* the constant value. When the same code is assembled using an assembler that generates elf32-i386, the extra bytes are not present. Is there a way to make the output of the pe-i386 and elf32-i386 assemblers match? The pe-i386 assembler is being run under cygwin, and the elf32-i386 assembler is being run under linux. (Please pardon the line wrapping.)

thanks,
galen


$ cat bar.s .data .align 16 .word 1

#==== cygwin ====
$ gcc -v -c bar.s
Using built-in specs.
Target: i686-pc-cygwin
Configured with: /gnu/gcc/package/gcc4-4.3.2-2/src/gcc-4.3.2/configure --srcdir=/gnu/gcc/package/gcc4-4.3.2-2/src/gcc-4.3.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/sbin --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --infodir=/usr/share/info --mandir=/usr/share/man --datadir=/usr/share --infodir=/usr/share/info --mandir=/usr/share/man -v --with-gmp=/usr --with-mpfr=/usr --enable-bootstrap --enable-version-specific-runtime-libs --with-slibdir=/usr/bin --libexecdir=/usr/lib --enable-static --enable-shared --enable-shared-libgcc --enable-__cxa_atexit --with-gnu-ld --with-gnu-as --with-dwarf2 --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,objc,obj-c++ --disable-symvers --enable-libjava --program-suffix=-4 --enable-libgomp --enable-libssp --enable-libada --enable-threads=posix AS=/opt/gcc-tools/bin/as.exe AS_FOR_TARGET=/opt/gcc-tools/bin/as.exe LD=/opt/gcc-tools/bin/ld.exe LD_FOR_TARGET=/opt/gcc-tools/bin/ld.exe
Thread model: posix
gcc version 4.3.2 20080827 (beta) 2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-c' '-mtune=generic'


/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/as.exe -v -o bar.o bar.s
GNU assembler version 2.18.50 (i686-pc-cygwin) using BFD version (GNU Binutils) 2.18.50.20080625
COMPILER_PATH=/usr/lib/gcc/i686-pc-cygwin/4.3.2/:/usr/lib/gcc/i686-pc-cygwin/4.3.2/:/usr/lib/gcc/i686-pc-cygwin/:/usr/lib/gcc/i686-pc-cygwin/4.3.2/:/usr/lib/gcc/i686-pc-cygwin/:/usr/lib/gcc/i686-pc-cygwin/4.3.2/:/usr/lib/gcc/i686-pc-cygwin/:/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/
LIBRARY_PATH=/usr/lib/gcc/i686-pc-cygwin/4.3.2/:/usr/lib/gcc/i686-pc-cygwin/4.3.2/:/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-c' '-mtune=generic'


$ objdump.exe -s bar.o

bar.o: file format pe-i386

Contents of section .data:
 0000 01000000 00000000 00000000 00000000  ................


#==== linux ====
$ gcc -v -c bar.s
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)
as -V -Qy -o bar.o bar.s
GNU assembler version 2.17.50.0.6-9.el5 (i386-redhat-linux) using BFD version 2.17.50.0.6-9.el5 20061020


$ objdump -s bar.o

bar.o: file format elf32-i386

Contents of section .data:
 0000 0100                                 ..


-- Galen Seitz galens@seitzassoc.com


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