X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=u6xMzDWRnSaz3jhXbGyzitJK7N03WwdE+BaCTGQQb60=; b=oR3rC7xdWLA/vvJP7Rkcz8JeOIRbGOY0eNImxr72eLx09rSblytNGHpRo4iJGgBpFr rtorPSsKrZ4iGEmGz31JmYiO5Y69deoNMNp3YdOC3uH8tUwOPybxYfb+LUe8MoJZx+x2 SgZJgy6Mv8PqKqaz0KGe/2ZCZLe1CoQmSKUhmjk/ETZw3WSkxAP3LLI0FD/bzRUZAH0r 2cfqN5GR0AXZB0hfJ6tQ/bMHAFmY0Tr+AhozbWm/fe2LoMZO9gAsj9Dt3udIkOmt6MjD jha9BtTVvzy1zketcQQT8K5cW9KSpTuR/OeNOYLmd18aHgc8bcIEyfE28i6EaTPQZYl2 OpjA== MIME-Version: 1.0 X-Received: by 10.107.169.157 with SMTP id f29mr2864215ioj.74.1433492915632; Fri, 05 Jun 2015 01:28:35 -0700 (PDT) In-Reply-To: <201506050742.t557ggR8019445@envy.delorie.com> References: <201506050742 DOT t557ggR8019445 AT envy DOT delorie DOT com> Date: Fri, 5 Jun 2015 11:28:35 +0300 Message-ID: Subject: Re: dxe3gen patch From: "Ozkan Sezer (sezeroz AT gmail DOT com)" To: djgpp AT delorie DOT com Cc: DJ Delorie Content-Type: multipart/mixed; boundary=001a114260f80672360517c11481 Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk --001a114260f80672360517c11481 Content-Type: text/plain; charset=UTF-8 On 6/5/15, DJ Delorie wrote: > > I'm not opposed to environment variables, but they're a bit messy in a > unix environment (vs djgpp where we can ship djgpp.env with them ;). > We can provide a sample dxe3gen.sh for it maybe? (more below) > If dxegen is built as a native djgpp program, it should be using the > native djgpp tools (gcc, ld, etc). Yes? > Of course, > If dxegen is cross built, it should note the target prefix (the > i586-pc-djgpp- part) and change the defaults for the tools to have > that prefix (i586-pc-djgpp-gcc, etc). We try to do this with the > -DDXE_LD option. > > If we do both of these correctly, most users shouldn't need to > override the defaults at all, and then it's not as big a deal that > they're controlled with environment variables (or cleaner but harder > command line options). > > I don't think it's right for us to *rely* on environment variables to > provide correct *default* program names, though. > How about the following patch, which extends the -DDXE_?? options at cross-build time and also adds the DXE_?? environment stuff? Or, do you prefer something without any environment vars? > > Also, your mailer is wrapping lines, which corrupted the patch in a > way that really confused me at first: > > /* Prepare the command line for ld */ > new_argv = (const char **)malloc((argc - 1 + NUMBER_OF_LINKER_ARGS > + NUMBER_OF_ADDITIONAL_LOADED_LIBS + 2 + 1) * sizeof(char *)); > + process_env(); > process_args(argc, argv, new_argv); > > Note the column for the wrapped '+' :-) Yeah, gmail is to blame. Attaching the patch too this time. Index: src/dxe/makefile =================================================================== RCS file: /cvs/djgpp/djgpp/src/dxe/makefile,v retrieving revision 1.8 diff -u -r1.8 makefile --- src/dxe/makefile 21 Jul 2013 12:25:58 -0000 1.8 +++ src/dxe/makefile 5 Jun 2015 08:18:18 -0000 @@ -33,7 +33,7 @@ $(EXE) $(HOSTBIN)/dxegen.exe : dxe3gen.c init1.h init2.h init3.h init4.h init5.h fini1.h fini2.h fini3.h fini4.h fini5.h - $(GCC) -DDXE_LD=\"$(CROSS_LD)\" dxe3gen.c -o $@ + $(GCC) -DDXE_LD=\"$(CROSS_LD)\" -DDXE_CC=\"$(CROSS_GCC)\" -DDXE_AR=\"$(CROSS_AR)\" -DDXE_AS=\"$(CROSS_AS)\" dxe3gen.c -o $@ clean :: @-$(MISC) rm *.o *.h $(HOSTBIN)/dxegen.exe Index: src/dxe/dxe3gen.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/dxe/dxe3gen.c,v retrieving revision 1.20 diff -u -r1.20 dxe3gen.c --- src/dxe/dxe3gen.c 23 May 2015 08:20:05 -0000 1.20 +++ src/dxe/dxe3gen.c 5 Jun 2015 08:18:18 -0000 @@ -165,10 +165,23 @@ #endif /* !DEBUG_SUPPORT_PRINT_RELOCATION_DIRECTIVES */ +/* Cross compile tool names */ +#ifndef DXE_CC +#define DXE_CC "gcc" +#endif +#ifndef DXE_AS +#define DXE_AS "as" +#endif +#ifndef DXE_AR +#define DXE_AR "ar" +#endif #ifndef DXE_LD -/* Cross compile ld name/location */ #define DXE_LD "ld" #endif +#ifndef DXE_SC +#define DXE_SC "dxe.ld" +#endif + #ifdef _POSIX_SOURCE /* Linux violates POSIX.1 and defines this, but it shouldn't.. */ #undef _POSIX_SOURCE @@ -297,6 +310,15 @@ }; +static char *libdir; +/* build tools */ +static char *dxe_cc; /* default: "gcc" */ +static char *dxe_as; /* default: "as" */ +static char *dxe_ar; /* default: "ar" */ +static char *dxe_ld; /* default: "ld" */ +/* linker script */ +static char *dxe_sc; /* default: "dxe.ld" */ + /* Desc: replaces backslash with slash in a path * @@ -410,6 +432,45 @@ +/* Desc: process the DXE_?? environment variables + */ +static void process_env(void) +{ + const char *e; + + if ((e = getenv("DXE_CC")) != NULL) + dxe_cc = strdup(e); + else dxe_cc = strdup(DXE_CC); + + if ((e = getenv("DXE_AS")) != NULL) + dxe_as = strdup(e); + else dxe_as = strdup(DXE_AS); + + if ((e = getenv("DXE_AR")) != NULL) + dxe_ar = strdup(e); + else dxe_ar = strdup(DXE_AR); + + if ((e = getenv("DXE_LD")) != NULL) + dxe_ld = strdup(e); + else dxe_ld = strdup(DXE_LD); + + if ((e = getenv("DXE_SC")) != NULL) + dxe_sc = strdup(e); + else dxe_sc = strdup(DXE_SC); + + if ((e = getenv("DXE_LD_LIBRARY_PATH")) != NULL) + libdir = strdup(e); + else if ((e = getenv("DJDIR")) != NULL) { + size_t sz = strlen(e) + 5U; + libdir = malloc(sz); + strcpy(libdir, e); + strcat(libdir, "/lib"); + canonicalize_path(libdir); + } + else libdir = NULL; +} + + /* Desc: process command line args * * In : no of arguments, argument list, ptr to store linker args @@ -419,30 +480,15 @@ */ static void process_args(int argc, char *argv[], const char *new_argv[]) { - static char libdir[FILENAME_MAX]; - char *p; int i, new_argc = NUMBER_OF_LINKER_ARGS; - p = getenv("DXE_LD_LIBRARY_PATH"); - if (p) - strcpy(libdir, p); - else + if (!libdir) { - p = getenv("DJDIR"); - if (p) - { - strcpy(libdir, p); - strcat(libdir, "/lib"); - canonicalize_path(libdir); - } - else - { fprintf(stderr, "Error: neither DXE_LD_LIBRARY_PATH nor DJDIR are set in environment\n"); exit(1); - } } - new_argv[0] = DXE_LD; + new_argv[0] = dxe_ld; new_argv[1] = "-X"; new_argv[2] = "-S"; new_argv[3] = "-r"; @@ -451,7 +497,7 @@ new_argv[6] = "-L"; new_argv[7] = libdir; new_argv[8] = "-T"; - new_argv[9] = "dxe.ld"; + new_argv[9] = dxe_sc; if (!strcmp(base_name(argv[0]), "dxegen")) /* invoked as `dxegen' */ @@ -736,7 +782,7 @@ if ((rv = my_spawn(argv)) != 0) { if (rv == -1) - perror(DXE_LD); + perror("ld"); exit(rv); } @@ -861,7 +907,7 @@ if (rv) { if (rv == -1) - perror(DXE_LD); + perror("ld"); exit(rv); } @@ -1336,7 +1382,8 @@ } /* Pre-compile the resolver's output. */ - rv = system("gcc -o "TEMP_S_FILE" -O2 -S "TEMP_BASE".c"); + sprintf(cmdbuf, "%s -o %s -O2 -S %s.c", dxe_cc, TEMP_S_FILE, TEMP_BASE); + rv = system(cmdbuf); remove(TEMP_BASE".c"); if (rv != 0) { @@ -1420,7 +1467,8 @@ atexit(exit_cleanup); /* Allright, now run the assembler on the resulting file */ - if ((rv = system("as -o "TEMP_O_FILE" "TEMP_S_FILE)) != 0) + sprintf(cmdbuf, "%s -o %s %s", dxe_as, TEMP_O_FILE, TEMP_S_FILE); + if ((rv = system(cmdbuf)) != 0) { if (rv == -1) perror("as"); @@ -1428,7 +1476,7 @@ } /* Okey-dokey, let's stuff the object file into the archive */ - sprintf(cmdbuf, "ar crs %s "TEMP_O_FILE, opt.implib); + sprintf(cmdbuf, "%s crs %s "TEMP_O_FILE, dxe_ar, opt.implib); if ((rv = system(cmdbuf)) != 0) { if (rv == -1) @@ -1512,6 +1560,7 @@ progname = argv[0]; /* Prepare the command line for ld */ new_argv = (const char **)malloc((argc - 1 + NUMBER_OF_LINKER_ARGS + NUMBER_OF_ADDITIONAL_LOADED_LIBS + 2 + 1) * sizeof(char *)); + process_env(); process_args(argc, argv, new_argv); if (opt.showdep || opt.showexp || opt.showunres) Index: src/makefile.def =================================================================== RCS file: /cvs/djgpp/djgpp/src/makefile.def,v retrieving revision 1.5 diff -u -r1.5 makefile.def --- src/makefile.def 6 Feb 2003 10:40:24 -0000 1.5 +++ src/makefile.def 5 Jun 2015 08:18:17 -0000 @@ -26,6 +26,7 @@ # For building distributed (djgpp) libraries and programs CROSS_GCC = gcc CROSS_AR = ar +CROSS_AS = as CROSS_LD = ld CROSS_STRIP = strip CROSS_BISON = bison @@ -33,6 +34,7 @@ # For building native programs (hostbin/*); assumes GNU versions GCC = gcc -g AR = ar +AS = as LD = ld STRIP = strip BISON = bison @@ -47,6 +49,7 @@ CROSS_GCC = i586-pc-msdosdjgpp-gcc -pipe CROSS_AR = i586-pc-msdosdjgpp-ar +CROSS_AS = i586-pc-msdosdjgpp-as CROSS_LD = i586-pc-msdosdjgpp-ld CROSS_STRIP = i586-pc-msdosdjgpp-strip CROSS_BISON = bison @@ -56,6 +59,7 @@ GCC = gcc -g -O2 AR = ar +AS = as LD = ld STRIP = strip BISON = bison -- O.S. --001a114260f80672360517c11481 Content-Type: application/octet-stream; name="dxe3gen_2.patch" Content-Disposition: attachment; filename="dxe3gen_2.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: file0 SW5kZXg6IHNyYy9tYWtlZmlsZS5kZWYKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09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ICBpbnQgaSwgbmV3X2FyZ2MgPSBOVU1CRVJfT0ZfTElO S0VSX0FSR1M7CiAKLSAgcCA9IGdldGVudigiRFhFX0xEX0xJQlJBUllfUEFUSCIpOwotICBpZiAo cCkKLSAgICBzdHJjcHkobGliZGlyLCBwKTsKLSAgZWxzZQorICBpZiAoIWxpYmRpcikKICAgewot ICAgIHAgPSBnZXRlbnYoIkRKRElSIik7Ci0gICAgaWYgKHApCi0gICAgewotICAgICAgc3RyY3B5 KGxpYmRpciwgcCk7Ci0gICAgICBzdHJjYXQobGliZGlyLCAiL2xpYiIpOwotICAgICAgY2Fub25p Y2FsaXplX3BhdGgobGliZGlyKTsKLSAgICB9Ci0gICAgZWxzZQotICAgIHsKICAgICAgIGZwcmlu dGYoc3RkZXJyLCAiRXJyb3I6IG5laXRoZXIgRFhFX0xEX0xJQlJBUllfUEFUSCBub3IgREpESVIg YXJlIHNldCBpbiBlbnZpcm9ubWVudFxuIik7CiAgICAgICBleGl0KDEpOwotICAgIH0KICAgfQog Ci0gIG5ld19hcmd2WzBdID0gRFhFX0xEOworICBuZXdfYXJndlswXSA9IGR4ZV9sZDsKICAgbmV3 X2FyZ3ZbMV0gPSAiLVgiOwogICBuZXdfYXJndlsyXSA9ICItUyI7CiAgIG5ld19hcmd2WzNdID0g Ii1yIjsKQEAgLTQ1MSw3ICs0OTcsNyBAQAogICBuZXdfYXJndls2XSA9ICItTCI7CiAgIG5ld19h cmd2WzddID0gbGliZGlyOwogICBuZXdfYXJndls4XSA9ICItVCI7Ci0gIG5ld19hcmd2WzldID0g ImR4ZS5sZCI7CisgIG5ld19hcmd2WzldID0gZHhlX3NjOwogCiAgIGlmICghc3RyY21wKGJhc2Vf bmFtZShhcmd2WzBdKSwgImR4ZWdlbiIpKQogICAgIC8qIGludm9rZWQgYXMgYGR4ZWdlbicgKi8K QEAgLTczNiw3ICs3ODIsNyBAQAogICBpZiAoKHJ2ID0gbXlfc3Bhd24oYXJndikpICE9IDApCiAg IHsKICAgICBpZiAocnYgPT0gLTEpCi0gICAgICBwZXJyb3IoRFhFX0xEKTsKKyAgICAgIHBlcnJv cigibGQiKTsKICAgICBleGl0KHJ2KTsKICAgfQogCkBAIC04NjEsNyArOTA3LDcgQEAKICAgICAg IGlmIChydikKICAgICAgIHsKICAgICAgICAgaWYgKHJ2ID09IC0xKQotICAgICAgICAgIHBlcnJv cihEWEVfTEQpOworICAgICAgICAgIHBlcnJvcigibGQiKTsKICAgICAgICAgZXhpdChydik7CiAg ICAgICB9CiAKQEAgLTEzMzYsNyArMTM4Miw4IEBACiAgICAgfQogCiAgICAgLyogUHJlLWNvbXBp bGUgdGhlIHJlc29sdmVyJ3Mgb3V0cHV0LiAqLwotICAgIHJ2ID0gc3lzdGVtKCJnY2MgLW8gIlRF TVBfU19GSUxFIiAtTzIgLVMgIlRFTVBfQkFTRSIuYyIpOworICAgIHNwcmludGYoY21kYnVmLCAi JXMgLW8gJXMgLU8yIC1TICVzLmMiLCBkeGVfY2MsIFRFTVBfU19GSUxFLCBURU1QX0JBU0UpOwor ICAgIHJ2ID0gc3lzdGVtKGNtZGJ1Zik7CiAgICAgcmVtb3ZlKFRFTVBfQkFTRSIuYyIpOwogICAg IGlmIChydiAhPSAwKQogICAgIHsKQEAgLTE0MjAsNyArMTQ2Nyw4IEBACiAgIGF0ZXhpdChleGl0 X2NsZWFudXApOwogCiAgIC8qIEFsbHJpZ2h0LCBub3cgcnVuIHRoZSBhc3NlbWJsZXIgb24gdGhl IHJlc3VsdGluZyBmaWxlICovCi0gIGlmICgocnYgPSBzeXN0ZW0oImFzIC1vICJURU1QX09fRklM RSIgIlRFTVBfU19GSUxFKSkgIT0gMCkKKyAgc3ByaW50ZihjbWRidWYsICIlcyAtbyAlcyAlcyIs IGR4ZV9hcywgVEVNUF9PX0ZJTEUsIFRFTVBfU19GSUxFKTsKKyAgaWYgKChydiA9IHN5c3RlbShj bWRidWYpKSAhPSAwKQogICB7CiAgICAgaWYgKHJ2ID09IC0xKQogICAgICA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