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]

Use of crtbegin.o in elf.sc


I just happened to notice that this use of crtbegin.o in elf.sc:

    /* gcc uses crtbegin.o to find the start of
       the constructors, so we make sure it is
       first.  Because this is a wildcard, it
       doesn't matter if the user does not
       actually link against crtbegin.o; the
       linker won't look for a file to match a
       wildcard.  The wildcard also means that it
       doesn't matter which directory crtbegin.o
       is in.  */

    KEEP (*crtbegin*.o(.ctors))

does not work in practice.  This is because crtbegin.o is normally
specified using an absolute path.  However, the comparison is done
using FNM_FILE_NAME in walk_wild:
	  if (fnmatch (file_spec, f->filename, FNM_FILE_NAME) == 0)
The use of FNM_FILE_NAME means that the '*' will not match anything
containing a slash.  Therefore, the *crtbegin*.o will not match, e.g.,
    /usr/lib/gcc/i386-redhat-linux/4.0.2/crtbegin.o

This doesn't normally matter because gcc normally puts crtbegin.o at
the start of the command line anyhow.

Still, it was an interesting discovery.

Ian


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