Unable to create a dynamic library with openmp offload=nvptx-none object files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



First a description of build environment i am using a variant of the gcc9.3.1 built after  fedoras koji package  gcc-9.3.1-1.fc30<https://koji.fedoraproject.org/koji/buildinfo?buildID=1478448> and binutils updated to  2.33.50 on centos 7/ rhel7 based system.

When i try to build a shared library using object files compiled with foffload=nvptx-none ..  the resultant shared library files when i would assume mkoffload is linking the resultant shared library .  It would appear that the generated assembly file to be linked to the shared library is not position independent .  I was able to create the shared library by changing the -foffload=nptx or  -flto to  either -foffload=disable or -fno-lto .  But when linking against the resulting shared library the offload payload did not get incorporated into the executable .
   I should mention if i either link against the object files directly or in a archive library the offloading and resulting executable works as expected ...


here is my "quasi" example

  *   gcc -fPIC -g -O3 -fopenmp -DUSE_OPENMP -DUSE_OFFLOAD -I. -L. -flto '-foffload=nvptx-none=-fPIC -lm' -c -save-temps -fPIC lmodeim_reproducer.c
  *   gcc -fopenmp -fPIC -flto -save-temps -shared -o libmodeim_reproducer.so lmodeim_reproducer.o

<... full path to ld ...>/bin/ld: /tmp/ccet4igB.target.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC collect2: error: ld returned 1 exit status

  *   gcc -fPIC -g -O3 -fopenmp -DUSE_OPENMP -DUSE_OFFLOAD -I. -L. -flto '-foffload=nvptx-none=-fPIC -lm' -save-temps -o modeim_reproducer modeim_reproducer.c -lmodeim_reproducer -lm

<... full path to ld ...>/bin/ld: cannot find -lmodeim_reproducer collect2: error: ld returned 1 exit status


....

below is the   "head" of the assembly file to be linked into the shared libary note the .rodata section  with the ascii "payload"

....

.file "ccwhZqo6.c" .text .section .rodata .align 32 .type ptx_code_0, @object .size ptx_code_0, 23308 ptx_code_0: .ascii "// BEGIN PREAMBLE\n.version 3.1\n.target sm_30\n.address_siz" .ascii "e 64\n// END PREAMBLE\n// BEGIN FUNCTION DECL: lmodeim$omp" .ascii "fn$1\n.func lmodeim$_omp_fn$1 (.param .u64 %in_ar0);\n// BEG" .ascii "IN FUNCTION DECL: lmodeim$_omp_fn$5\n.func lmodeim$_omp_fn$5" .ascii " (.param .u64 %in_ar0);\n// BEGIN FUNCTION DECL: lmodeim$_om"

... etc ...


My primary question is , is this expected ? it is mentioned in the gcc wiki that there are limitations to the nvptx offloading . Is this one, or do i need to change my options or how i built my compiler ?


Mike




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux