Summary: | [8/9/10 Regression] -fPIC isn't used to create offload shared library | ||
---|---|---|---|
Product: | gcc | Reporter: | Thomas Schwinge <tschwinge> |
Component: | target | Assignee: | Thomas Schwinge <tschwinge> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | hjl.tools, hubicka, jakub |
Priority: | P3 | Keywords: | openmp |
Version: | 8.0 | ||
Target Milestone: | 8.4 | ||
See Also: |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86517 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88185 |
||
Host: | Target: | x86_64-intelmicemul-linux-gnu | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2019-11-11 00:00:00 | |
Attachments: | WIP patch/work around |
Description
Thomas Schwinge
2018-10-31 17:00:46 UTC
Do you have a testcase? (In reply to H.J. Lu from comment #1) > Do you have a testcase? Thought that would be obvious from the report. Configure GCC for Intel MIC (emulated) offloading, then run the libgomp testsuite. (In reply to Thomas Schwinge from comment #2) > (In reply to H.J. Lu from comment #1) > > Do you have a testcase? > > Thought that would be obvious from the report. Configure GCC for Intel MIC > (emulated) offloading, then run the libgomp testsuite. Please provide your GCC configure options. [hjl@gnu-cfl-1 pr87833]$ cat x.i void open_fd(char *); void init_ioctl_ctl() { open_fd(""); } void get_ioctl_ops() {} [hjl@gnu-cfl-1 pr87833]$ cat y.i void get_ioctl_ops(); void a() { get_ioctl_ops(); } [hjl@gnu-cfl-1 pr87833]$ make /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -O2 -fPIC -c y.i /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -O2 -fPIC -c x.i /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -o x.so y.o x.o -shared -fPIC -fno-pie [hjl@gnu-cfl-1 pr87833]$ make clean rm -f *.o *.s foo bar *.[cCi].* x *.ii.* *.a [hjl@gnu-cfl-1 pr87833]$ make LTO=1 /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -O2 -flto -fPIC -c y.i /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -O2 -flto -fPIC -c x.i /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -o x.so y.o x.o -shared -fPIC -fno-pie /usr/local/bin/ld: /tmp/x.so.LWF6nG.ltrans0.ltrans.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/local/bin/ld: final link failed: nonrepresentable section on output collect2: error: ld returned 1 exit status make: *** [Makefile:21: x.so] Error 1 [hjl@gnu-cfl-1 pr87833]$ -fPIC -fno-pie should turn off PIE/pie, not PIC/pic. A patch is posted at https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00084.html On gcc-8-branch, as of r267610 (for PR86517, PR88185), this is now broken, too. I'll commit H.J.'s patch. Author: tschwinge Date: Mon Nov 11 08:38:28 2019 New Revision: 278041 URL: https://gcc.gnu.org/viewcvs?rev=278041&root=gcc&view=rev Log: [PR87833] x86: Put -fPIC and -shared the last to create offload image On x86, since -fPIC and -shared should be used to create offload image, we put them the last to properly create offload image. 2019-11-11 H.J. Lu <hjl.tools@gmail.com> PR target/87833 * config/i386/intelmic-mkoffload.c (prepare_target_image): Put -fPIC and -shared the last to create offload image. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/intelmic-mkoffload.c Author: tschwinge Date: Mon Nov 11 08:39:10 2019 New Revision: 278042 URL: https://gcc.gnu.org/viewcvs?rev=278042&root=gcc&view=rev Log: [PR87833] x86: Put -fPIC and -shared the last to create offload image On x86, since -fPIC and -shared should be used to create offload image, we put them the last to properly create offload image. 2019-11-11 H.J. Lu <hjl.tools@gmail.com> PR target/87833 * config/i386/intelmic-mkoffload.c (prepare_target_image): Put -fPIC and -shared the last to create offload image. Backport from trunk r278041. Modified: branches/gcc-9-branch/gcc/ChangeLog branches/gcc-9-branch/gcc/config/i386/intelmic-mkoffload.c Author: tschwinge Date: Mon Nov 11 08:39:32 2019 New Revision: 278043 URL: https://gcc.gnu.org/viewcvs?rev=278043&root=gcc&view=rev Log: [PR87833] x86: Put -fPIC and -shared the last to create offload image On x86, since -fPIC and -shared should be used to create offload image, we put them the last to properly create offload image. 2019-11-11 H.J. Lu <hjl.tools@gmail.com> PR target/87833 * config/i386/intelmic-mkoffload.c (prepare_target_image): Put -fPIC and -shared the last to create offload image. Backport from trunk r278041. Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/config/i386/intelmic-mkoffload.c . |