Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

Intel MPX, gcc/as fail to build glibc

c_43
Beginner
1,105 Views

Has anyone successfully compiled an MPX instrumented glibc? What version of glibc, gcc and binutils did you use?

I'm having a terrible time trying to get this to work. I get errors of this form: http://pastebin.com/kRRDN43Q

I have tried at least the following versions:

gcc (GCC) 5.0.0 20141211 (experimental) using GNU assembler (Gentoo 2.24 p1.4) 2.24
gcc (GCC) 5.0.0 20141215 (experimental) using GNU assembler (Gentoo 2.24 p1.4) 2.24
gcc (GCC) 5.0.0 20141216 (experimental) using GNU assembler (Gentoo 2.24 p1.4) 2.24
gcc (GCC) 5.0.0 20141216 (experimental) using GNU assembler (GNU Binutils) 2.25.51.20141215
gcc (GCC) 5.0.0 20141216 (experimental) using GNU assembler (GNU Binutils) 2.25.51.20141216
gcc (GCC) 5.0.0 20140925 (experimental) using GNU assembler (GNU Binutils) 2.24.51.20140422

They all give the same errors. Note that I'm giving the compiler -fcheck-pointer-bounds and -mmpx, if I omit these, there are no compilation issues.

Note that the last version is the same one as provided by Intel at https://software.intel.com/en-us/articles/intel-software-development-emulator

Passing -S to the compiler for the vfprintf.c file works without errors. However assembling this file fails. The unresolved labels in the assembly output look like this: http://pastebin.com/H73urZAM

I have a working MPX environment, I can compile and run MPX instrumented binaries using the Intel SDE with no issues.

My configure statement when attempting to build glibc: ..glibc_source/configure CC='/mpx_gcc3/bin/gcc' CFLAGS='-g -O2 -fcheck-pointer-bounds -mmpx' --prefix=/mpx_glibc2 --disable-werror

I have my MPX enabled GCC in /mpx_gcc3, I'm giving the CFLAGS argument (obviously) to get MPX instrumented code produced. I have --disable-werror as I get some warnings which otherwise halt the build earlier than my main error. If these warnings are useful, I can provide them.

What is the problem here? Is this GCC producing bad assembly, or is this an assembler (GNU AS) issue? I looked at the assembly and it seems it is a problem with GCC.

However my main question is simply: How do I compile glibc?

0 Kudos
2 Replies
Igor_Z_Intel
Employee
1,105 Views

Thanks for reporting this, I can reproduce the failure for the following test

int foo(int p)

{

 int a;

static const int step0_jumps[] = { &&l1 - &&l2};

l1:

 if (p > 0)

   a = 1;

 else

   a = 2;

l2: return a+ step0_jumps[0];

}

Issue seems to be in that tricky usage of labels. We will take a look

 

0 Kudos
c_43
Beginner
1,105 Views

Great, a few days after I posted here initially I filed a bug report to GCC as well. In case you were thinking of filing a bug report there, to avoid duplicates. I isolated the bug down to something similar to what you have found -- tricky usage of labels:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64363

0 Kudos
Reply