This is the mail archive of the binutils@sources.redhat.com 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]

ld problems on win32


I'm a newbie to using gcc and the binutils, so forgive me in advance if this
is just a stupid oversight on my part, but if it is, please point it out, as
I'm stumped on this one.

I'm using the following versions of my utils:
GNU ld 2.11.90 (with BFD 2.11.90) from the Mingw 1.0-20010608 release.
gcc version 2.95.2 19991024 (release) from the Dev-C++ release
GNU CPP version 2.95.2 19991024 (release) (80386, BSD syntax) from the
Dev-C++ release
GNU C++ version 2.95.2 19991024 (release) (i386-mingw32msvc) compiled by GNU
C version 2.95.2 19991024 (release). from the Dev-C++ release

First issue is ld seems to not be overriding the default linker script with
the --oformat argument.
I'm trying to link a file, main.o into an i386 elf file, and I'm using these
commands:
gcc -c -Wall main.cpp
ld -o main.elf main.o --oformat elf32-i386 -verbose

And ld gives back the following:
ld: PE operations on non PE file.

If I tell ld to be verbose, the first line of the defalt linker script gives
a clue:
GNU ld version 2.11.90 (with BFD 2.11.90)
  Supported emulations:
   i386pe
using internal linker script:
==================================================
OUTPUT_FORMAT(pei-i386)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/mingw/lib);
SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/mingw/mingw32/lib);
ENTRY(_mainCRTStartup)
SECTIONS
... rest of script

Surely the --oformat option should override the default script's pei-i386
output format, and if so, why is it trying to do PE operations when I've
explicitly specified an ELF output format?

Second issue is that when I specify --oformat=binary, ld crashes.

I do not have the experience to fix these things if they **are** indeed
bugs, but I doubt they are, they're more likely a misconfiguration on my
part. Please, by all means, tell me what I'm doing wrong!


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