glibc

Enable/Disable Hardware Lock Elision

蹲街弑〆低调 提交于 2021-02-07 13:34:13
问题 I am using glibc 2.24 version. It has lock elision path included for pthread_mutex_lock implementation with Transactional Synchronization Extensions such as _xbegin() and _xend(). The hardware is supposed to support lock elision as hle CPU flag is for Hardware Lock Elision I think. The processor I am using is Intel(R) Xeon(R) Gold 6130 with Skylake architecture. First I wanted to disable Lock elision but when I run the program that uses pthread_mutex_lock , with perf stat -T to monitor

Enable/Disable Hardware Lock Elision

杀马特。学长 韩版系。学妹 提交于 2021-02-07 13:33:24
问题 I am using glibc 2.24 version. It has lock elision path included for pthread_mutex_lock implementation with Transactional Synchronization Extensions such as _xbegin() and _xend(). The hardware is supposed to support lock elision as hle CPU flag is for Hardware Lock Elision I think. The processor I am using is Intel(R) Xeon(R) Gold 6130 with Skylake architecture. First I wanted to disable Lock elision but when I run the program that uses pthread_mutex_lock , with perf stat -T to monitor

Why does GCC 6 assume data is 16-byte aligned?

旧巷老猫 提交于 2021-02-07 12:16:30
问题 (Sorry in advance for not having managed to reduce my problem to a simple failing test case...) I have faced issues with upgrading to GCC 6.3.0 to build our codebase (relevant flags: -O3 -m32 ). Specifically, my application segfaults within a struct ctor call because of GCC optimizations. In this ctor, GCC used movaps : movaps %xmm0,0x30a0(%ebx) movaps requires the operand to be 16-byte aligned . But at this point in time, %ebx points to my object, which is not necessarily 16-byte aligned .

Why does GCC 6 assume data is 16-byte aligned?

有些话、适合烂在心里 提交于 2021-02-07 12:15:19
问题 (Sorry in advance for not having managed to reduce my problem to a simple failing test case...) I have faced issues with upgrading to GCC 6.3.0 to build our codebase (relevant flags: -O3 -m32 ). Specifically, my application segfaults within a struct ctor call because of GCC optimizations. In this ctor, GCC used movaps : movaps %xmm0,0x30a0(%ebx) movaps requires the operand to be 16-byte aligned . But at this point in time, %ebx points to my object, which is not necessarily 16-byte aligned .

glibc detected malloc(): memory corruption in C

瘦欲@ 提交于 2021-02-07 06:48:18
问题 I am trying to compile and code written in C under linux, and got this error message: glibc detected malloc(): memory corruption and I cannot find out why... the substring() just return you part of the original string by giving the starting index and length. e.g. substring("this is example",0,4) = "this"; char *substring(char* str, int start, int length) { char *newString = (char *)malloc(length * sizeof(char)); int i, x = 0; int end=start+length-1; for(i = start ; i <= end; i++){ newString[x

how to port c/c++ applications to legacy linux kernel versions

天大地大妈咪最大 提交于 2021-02-06 10:00:18
问题 Ok, this is just a bit of a fun exercise, but it can't be too hard compiling programmes for some older linux systems, or can it? I have access to a couple of ancient systems all running linux and maybe it'd be interesting to see how they perform under load. Say as an example we want to do some linear algebra using Eigen which is a nice header-only library. Any chance to compile it on the target system? user@ancient:~ $ uname -a Linux local 2.2.16 #5 Sat Jul 8 20:36:25 MEST 2000 i586 unknown

Understanding the gcc version and the GLIBC, GLIBCXX versions in more detail

自作多情 提交于 2021-02-05 05:07:47
问题 Assume I have the following local gcc, g++ version: $ gcc -v $ g++ -v gcc version 6.3.1 I don't understanding the relation and meaning of the following compared to my compiler version: What is this referring to? /usr/lib64/libstdc++.so.6 Trying to run a binary and I get this error, what is GLIBCXX_3.4.20 referring to? why is the number starting with 3? /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found What is all this? $ strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX GLIBCXX_3.4

Understanding the gcc version and the GLIBC, GLIBCXX versions in more detail

大兔子大兔子 提交于 2021-02-05 05:04:41
问题 Assume I have the following local gcc, g++ version: $ gcc -v $ g++ -v gcc version 6.3.1 I don't understanding the relation and meaning of the following compared to my compiler version: What is this referring to? /usr/lib64/libstdc++.so.6 Trying to run a binary and I get this error, what is GLIBCXX_3.4.20 referring to? why is the number starting with 3? /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found What is all this? $ strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX GLIBCXX_3.4

Can LD_PRELOAD be used to load different versions of glibc?

◇◆丶佛笑我妖孽 提交于 2021-02-04 18:51:20
问题 Cast of characters big-old-app is linked to an old version of glibc , say glibc-2.12 . I cannot do anything to change this. cute-new-addon.o is linked to a newer version, glibc-2.23 . This glibc-2.23 is in a nonstandard path (because I don't have sudo powers). The story I want to use cute-new-addon.o inside big-old-app . I would normally write a script for big-old-app to execute, which then calls cute-new-addon.o to perform its tricks. From the command line, it would look like: $ big-old-app

Can LD_PRELOAD be used to load different versions of glibc?

大兔子大兔子 提交于 2021-02-04 18:49:04
问题 Cast of characters big-old-app is linked to an old version of glibc , say glibc-2.12 . I cannot do anything to change this. cute-new-addon.o is linked to a newer version, glibc-2.23 . This glibc-2.23 is in a nonstandard path (because I don't have sudo powers). The story I want to use cute-new-addon.o inside big-old-app . I would normally write a script for big-old-app to execute, which then calls cute-new-addon.o to perform its tricks. From the command line, it would look like: $ big-old-app