diff -ur xorg-x11-6.7.0-r2.orig/xc/config/cf/xf86.tmpl xorg-x11-6.7.0-r2/xc/config/cf/xf86.tmpl --- xorg-x11-6.7.0-r2.orig/xc/config/cf/xf86.tmpl 2004-07-31 22:21:33.000000000 +0200 +++ xorg-x11-6.7.0-r2/xc/config/cf/xf86.tmpl 2004-07-31 22:50:56.473231288 +0200 @@ -53,15 +53,23 @@ MODULE_GCC_FLAGS1 = -fno-stack-protector #endif +#ifndef HasGccPie +#define HasGccPie NO +#endif + +#if HasGccPie +MODULE_GCC_FLAGS2 = -fno-pie +#endif + #ifndef HasGccMergeConstants #define HasGccMergeConstants NO #endif #if HasGccMergeConstants && DoLoadableServer && !MakeDllModules -MODULE_GCC_FLAGS2 = -fno-merge-constants +MODULE_GCC_FLAGS3 = -fno-merge-constants #endif -MODULE_GCC_FLAGS = $(MODULE_GCC_FLAGS1) $(MODULE_GCC_FLAGS2) +MODULE_GCC_FLAGS = $(MODULE_GCC_FLAGS1) $(MODULE_GCC_FLAGS2) $(MODULE_GCC_FLAGS3) #if defined(IHaveModules) && MakeDllModules MODULE_PIC_FLAGS = $(PICFLAGS) diff -ur xorg-x11-6.7.0-r2.orig/xc/config/cf/xorg.tmpl xorg-x11-6.7.0-r2/xc/config/cf/xorg.tmpl --- xorg-x11-6.7.0-r2.orig/xc/config/cf/xorg.tmpl 2004-07-31 22:21:33.000000000 +0200 +++ xorg-x11-6.7.0-r2/xc/config/cf/xorg.tmpl 2004-07-31 22:50:10.278253992 +0200 @@ -67,15 +67,23 @@ MODULE_GCC_FLAGS1 = -fno-stack-protector #endif +#ifndef HasGccPie +#define HasGccPie NO +#endif + +#if HasGccPie +MODULE_GCC_FLAGS2 = -fno-pie +#endif + #ifndef HasGccMergeConstants #define HasGccMergeConstants NO #endif #if HasGccMergeConstants && DoLoadableServer && !MakeDllModules -MODULE_GCC_FLAGS2 = -fno-merge-constants +MODULE_GCC_FLAGS3 = -fno-merge-constants #endif -MODULE_GCC_FLAGS = $(MODULE_GCC_FLAGS1) $(MODULE_GCC_FLAGS2) +MODULE_GCC_FLAGS = $(MODULE_GCC_FLAGS1) $(MODULE_GCC_FLAGS2) $(MODULE_GCC_FLAGS3) #if defined(IHaveModules) && MakeDllModules MODULE_PIC_FLAGS = $(PICFLAGS) diff -ur xorg-x11-6.7.0-r2.orig/xc/config/imake/imake.c xorg-x11-6.7.0-r2/xc/config/imake/imake.c --- xorg-x11-6.7.0-r2.orig/xc/config/imake/imake.c 2004-07-31 22:21:33.000000000 +0200 +++ xorg-x11-6.7.0-r2/xc/config/imake/imake.c 2004-07-31 22:45:59.024450376 +0200 @@ -1034,26 +1034,19 @@ static void get_stackprotector(FILE *inFile) { - FILE *fp; char *cc; - char command[1024], buf[1024]; + char command[1024]; cc = getenv("CC"); if (cc == NULL) { cc = "cc"; } - snprintf(command, sizeof(command), "%s -v 2>&1", cc); - fp = popen(command, "r"); - if (fp == NULL) - abort(); - while (fgets(buf, sizeof(buf), fp)) { - if (strstr(buf, "propolice") != NULL) { + snprintf(command, sizeof(command), "%s -fno-stack-protector -S -o /dev/null -xc /dev/null > /dev/null 2>&1", cc); + if (system(command)==0) fprintf(inFile, "#define HasGccStackProtector YES\n"); - break; - } - } - if (pclose(fp)) - abort(); + snprintf(command, sizeof(command), "%s -fno-pie -S -o /dev/null -xc /dev/null > /dev/null 2>&1", cc); + if (system(command)==0) + fprintf(inFile, "#define HasGccPie YES\n"); }