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]

-enable-targets=all ?


    binutils 2.18 (+ gcc 4.3.1, gmp 4.22, mpfr 2.3.1, building upon a Cygwin base/build gcc 3.4.4 (not yet bootstrapped))


     gas configure -enable-targets=all
       fails due to
        TARGET_FORMAT gets defined multiple times


      binutils -enable-targets=all
       fails due to:

        # -enable-targets=all bites again
        # /src/gcc/binutils/bin2c.c: In function `main":
        # /src/gcc/binutils/bin2c.c:89: warning: implicit declaration of function `_fileno"
        # /src/gcc/binutils/bin2c.c:89: warning: implicit declaration of function `_setmode"

       I patch the Makefile after configure to not build bin2c. Then it works.

     bfd fails, a warning/error about an array index out of bounds accession section fields
      I patch after configure to remove all the "tic" targets; I didn't record the error, sorry.

      Python shown that I'm using to do the patching so far, the results should be obvious:

    def PatchAfterConfigure_bfd(Package, SourceDir, ObjDir):
        #
        # Given that we -enable-targets=all, remove the "tic" targets
        # that fail to build.
        #

        if IsAlreadyBuilt(Package, ObjDir):
            return

        for FileName in ["Makefile"]:
            FilePath = ObjDir + "/" + FileName
            OldLines = file(FilePath).readlines()
            NewLines = [ ]
            Changed = False
            for OldLine in OldLines:
                NewLine = OldLine
                if NewLine.find("tic") != -1:
                    OldLine = OldLine.replace("\n", " \n")
                    NewLine = OldLine
                    for r in [
                            re.compile(x) for x in [
                                "^\s+cpu-tic.+\.[loc]+ \\ \n$",
                                "^\s+aout-tic.+\.[loc]+ \\ \n$",
                                "^\s+coff-tic.+\.[loc]+ \\ \n$" ]]:
                        if r.match(NewLine):
                            # print("matched " + NewLine)
                            NewLine = ""
                    NewLine = NewLine.replace(" $(srcdir)/archures.c ", " archures.c ")
                    NewLine = NewLine.replace(" $(srcdir)/targets.c ", " targets.c ")
                    if NewLine != OldLine:
                        Changed = True
                NewLines += NewLine
            if Changed:
                print("patching " + FilePath)
                file(FilePath, "w").writelines(NewLines)

        #
        # targmatch.h is a build output, and easier to patch it
        # during build than something before
        #

        Run(ObjDir, "make targmatch.h")

        for a in ["archures.c", "targets.c"]:
            MyCopyFileIncrementalByTime(SourceDir + "/" + a, ObjDir + "/" + a)

        for FileName in ["archures.c", "targets.c", "targmatch.h"]:
            FilePath = ObjDir + "/" + FileName
            OldLines = file(FilePath).readlines()
            NewLines = [ ]
            Changed = False
            for OldLine in OldLines:
                NewLine = OldLine
                if NewLine.find("tic") != -1:
                    for r in [
                            re.compile(x) for x in [
                                "^extern const bfd_target tic.+_vec;\n$",
                                "^extern const bfd_arch_info_type bfd_tic.+_arch;\n$",
                                "^\s+&tic.+_vec,\n$",
                                "^\s+&bfd_tic.+_arch,\n$" ]]:
                        if r.match(NewLine):
                            # print("matched " + NewLine)
                            NewLine = " /* " + NewLine + " */ "
                        NewLine = re.sub("#if !defined \(SELECT_VECS\) \|\| defined \(HAVE_tic.+", "#if 0\n", NewLine)
                    if NewLine != OldLine:
                        Changed = True
                NewLines += NewLine

            if Changed:
                print("patching " + FilePath)
                file(FilePath, "w").writelines(NewLines)


    def PatchAfterConfigure_binutils(Package, SourceDir, ObjDir):    
        #    
        # -enable-targets=all bites again    
        # /src/gcc/binutils/bin2c.c: In function `main":    
        # /src/gcc/binutils/bin2c.c:89: warning: implicit declaration of function `_fileno"    
        # /src/gcc/binutils/bin2c.c:89: warning: implicit declaration of function `_setmode"    
        #    

        if IsAlreadyBuilt(Package, ObjDir):    
            return    

        for FileName in ["Makefile"]:    
            FilePath = ObjDir + "/" + FileName    
            OldLines = file(FilePath).readlines()    
            NewLines = [ ]    
            Changed = False    
            for OldLine in OldLines:    
                NewLine = OldLine    
                if NewLine.startswith("BUILD_MISC = ") or NewLine.startswith("noinst_PROGRAMS = "):    
                    OldLine = OldLine.replace("\n", " \n")    
                    NewLine = OldLine    
                    NewLine = NewLine.replace(" bin2c$(EXEEXT_FOR_BUILD) ", " ")    
                    if NewLine != OldLine:    
                        Changed = True    
                NewLines += NewLine    
            if Changed:    
                print("patching " + FilePath)    
                file(FilePath, "w").writelines(NewLines)    




    It'd be super darn cool if "everything" supported -enable-targets=all -- gas, ld, gcc.
    And there was therefore no target-dependent tools, just host-dependent.
      (and target-dependent .libs, but wherever host and target coincide, only need one).
    Eliminate one axis in the cross product.
    I was surprised that binutils does have a finite definition for "all".
    Change all the #ifs to ifs, link all the code in all the time..
    I realize that is very futuristic for gcc, up there with integrating cc1 into gcc,
       (possibly as a .dll/.so) as well as having it output .o files directly, bypassing as.


    Which modules are host times/cross target-dependent anyway? Eh, I'll figure this out.
    I'm working on some automation that reduces the duplicate builds when building multiple
    cross toolsets. It seems like gmp, mpfr, bfd, opcodes, libiberty, libcpp, libdecnumber
    could all be built just per host OR target instead of per host times target pair. I'm still experimenting.


    That is, if I'm building three toolsets:
      build=a host=a target=a
      build=a host=a target=b
      build=a host=b target=b

      Most things should only have to build twice, and "nothing" should have to build
        three times, though at least gcc has to build three times.
      (I'm ignoring bootstrapping -- ok, build a/a/a twice, everything three times, not four).

  The whole notion of build=a host=a target=b could go away. 
  In place of just build=a host=a target=all. 
  Most things are already like that. 
  Too crazy? 

    My ld with -enable-targets=all at least builds, haven't used it yet.


    Looking at gas, it doesn't seem difficult to "fix".
     You would want to add a command line parameter from gcc to as to specify the target however,
     or text early in the assembly file.


     - Jay


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