On 10/21/15 13:33, Ilya Verbin wrote:
Hi!
This happens because .gnu.offload_{funcs,vars} sections in crtoffload{begin,end}.o now doesn't have WRITE flag, but the same sections produced by omp_finish_file has it. When linker joins writable + nonwritable sections from several objects, it inserts some weird 2MB offset into the final binary. I.e. now there are 2 such offsets: one in the host binary and one in the MIC target image, hence 4MB. I haven't investigated how it happens, because I thing it's bad idea to join sections with different flags.
That is a strange insertion of padding. Joining sections with different flags, is IIUC, perfectly fine.
But we can't make .gnu.offload_{funcs,vars} in omp_finish_file also readonly, because in case of shared libraries there are R_X86_64_RELATIVE relocations,
Um, I thought they had absolute relocs, and thus were relro, but ICBW.
which make these sections writable. So, I guess we need to remove all consts to make these sections writable in all objects.
That seems like the prudent path. nathan