Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8707683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:55:51+00:00 2026-06-13T03:55:51+00:00

I have stumbled upon the following problem. The below code snippet does not link

  • 0

I have stumbled upon the following problem. The below code snippet does not link on Mac OS X with any Xcode I tried (4.4, 4.5)

#include <stdlib.h>
#include <string.h>
#include <emmintrin.h>

int main(int argc, char *argv[])
{
  char *temp;
#pragma omp parallel
  {
    __m128d v_a, v_ar;
    memcpy(temp, argv[0], 10);
    v_ar = _mm_shuffle_pd(v_a, v_a, _MM_SHUFFLE2 (0,1));
  }
}

The code is just provided as an example and would segfault when you run it. The point is that it does not compile. The compilation is done using the following line

/Applications/Xcode.app/Contents/Developer/usr/bin/gcc test.c -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -fopenmp

 Undefined symbols for architecture x86_64:
"___builtin_ia32_shufpd", referenced from:
    _main.omp_fn.0 in ccJM7RAw.o
"___builtin_object_size", referenced from:
    _main.omp_fn.0 in ccJM7RAw.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

The code compiles just fine when not using the -fopenmp flag to gcc. Now, I googled around and found a solution for the first problem connected with memcpy, which is adding -fno-builtin, or -D_FORTIFY_SOURCE=0 to gcc arguments list. I did not manage to solve the second problem (sse intrinsic).

Can anyone help me to solve this? The questions:

  • most importantly: how to get rid of the “___builtin_ia32_shufpd” error?
  • what exactly is the reason for the memcpy problem, and what does the -D_FORTIFY_SOURCE=0 flag eventually do?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:55:53+00:00Added an answer on June 13, 2026 at 3:55 am

    This is a bug in the way Apple’s LLVM-backed GCC (llvm-gcc) transforms OpenMP regions and handles calls to the built-ins inside them. The problem can be diagnosed by examining the intermediate tree dumps (obtainable by passing -fdump-tree-all argument to gcc). Without OpenMP enabled the following final code representation is generated (from the test.c.016t.fap):

    main (argc, argv)
    {
      D.6544 = __builtin_object_size (temp, 0);
      D.6545 = __builtin_object_size (temp, 0);
      D.6547 = __builtin___memcpy_chk (temp, D.6546, 10, D.6545);
      D.6550 = __builtin_ia32_shufpd (v_a, v_a, 1);
    }
    

    This is a C-like representation of how the compiler sees the code internally after all transformations. This is what is then gets turned into assembly instructions. (only those lines that refer to the built-ins are shown here)

    With OpenMP enabled the parallel region is extracted into own function, main.omp_fn.0:

    main.omp_fn.0 (.omp_data_i)
    {
      void * (*<T4f6>) (void *, const <unnamed type> *, long unsigned int, long unsigned int) __builtin___memcpy_chk.21;
      long unsigned int (*<T4f5>) (const <unnamed type> *, int) __builtin_object_size.20;
      vector double (*<T6b5>) (vector double, vector double, int) __builtin_ia32_shufpd.23;
      long unsigned int (*<T4f5>) (const <unnamed type> *, int) __builtin_object_size.19;
    
      __builtin_object_size.19 = __builtin_object_size;
      D.6587 = __builtin_object_size.19 (D.6603, 0);
      __builtin_ia32_shufpd.23 = __builtin_ia32_shufpd;
      D.6593 = __builtin_ia32_shufpd.23 (v_a, v_a, 1);
      __builtin_object_size.20 = __builtin_object_size;
      D.6588 = __builtin_object_size.20 (D.6605, 0);
      __builtin___memcpy_chk.21 = __builtin___memcpy_chk;
      D.6590 = __builtin___memcpy_chk.21 (D.6609, D.6589, 10, D.6588);
    }
    

    Again I have only left the code that refers to the builtins. What is apparent (but the reason for that is not immediately apparent to me) is that the OpenMP code trasnformer really insists on calling all the built-ins through function pointers. These pointer asignments:

    __builtin_object_size.19 = __builtin_object_size;
    __builtin_ia32_shufpd.23 = __builtin_ia32_shufpd;
    __builtin_object_size.20 = __builtin_object_size;
    __builtin___memcpy_chk.21 = __builtin___memcpy_chk;
    

    generate external references to symbols which are not really symbols but rather names that get special treatment by the compiler. The linker then tries to resolve them but is unable to find any of the __builtin_* names in any of the object files that the code is linked against. This is also observable in the assembly code that one can obtain by passing -S to gcc:

    LBB2_1:
        movapd  -48(%rbp), %xmm0
        movl    $1, %eax
        movaps  %xmm0, -80(%rbp)
        movaps  -80(%rbp), %xmm1
        movl    %eax, %edi
        callq   ___builtin_ia32_shufpd
        movapd  %xmm0, -32(%rbp)
    

    This basically is a function call that takes 3 arguments: one integer in %eax and two XMM arguments in %xmm0 and %xmm1, with the result being returned in %xmm0 (as per the SysV AMD64 ABI function calling convention). In contrast, the code generated without -fopenmp is an instruction-level expansion of the intrinsic as it is supposed to happen:

    LBB1_3:
        movapd  -64(%rbp), %xmm0
        shufpd  $1, %xmm0, %xmm0
        movapd  %xmm0, -80(%rbp)
    

    What happens when you pass -D_FORTIFY_SOURCE=0 is that memcpy is not replaced by the “fortified” checking version and a regular call to memcpy is used instead. This eliminates the references to object_size and __memcpy_chk but cannot remove the call to the ia32_shufpd built-in.

    This is obviously a compiler bug. If you really really really must use Apple’s GCC to compile the code, then an interim solution would be to move the offending code to an external function as the bug apparently only affects code that gets extracted from parallel regions:

    void func(char *temp, char *argv0)
    {
       __m128d v_a, v_ar;
       memcpy(temp, argv0, 10);
       v_ar = _mm_shuffle_pd(v_a, v_a, _MM_SHUFFLE2 (0,1));
    }
    
    int main(int argc, char *argv[])
    {
      char *temp;
    #pragma omp parallel
      {
        func(temp, argv[0]);
      }
    }
    

    The overhead of one additional function call is neglegible compared to the overhead of entering and exiting the parallel region. You can use OpenMP pragmas inside func – they will work because of the dynamic scoping of the parallel region.

    May be Apple would provide a fixed compiler in the future, may they won’t, given their commitment to replacing GCC with Clang.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am debugging some old ASP code and have stumbled upon the following error:
Im quite new to Java and i have stumbled upon the following problem. Im
I have stumbled upon the following F77 yacc grammar: http://yaxx.cvs.sourceforge.net/viewvc/yaxx/yaxx/fortran/fortran.y?revision=1.3&view=markup . How can I
I have recently stumbled upon a problem with selecting relationship details from a 1
I have stumbled upon a problem when calling a nested Async which happens to
I'm hoping someone happens to have stumbled upon the following issue before. My Java
I stumbled upon a problem from the last Facebook Hacker Cup (so it's NOT
I just stumbled upon the following article: http://www.josscrowcroft.com/2011/code/utf-8-multibyte-characters-in-url-parameters-%E2%9C%93/ The article talks about using UTF-8
I was testing a website: This Website When I stumbled upon the following problem.
In our project we've stumbled upon the following problem: we need to provide our

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.