[Bug d/87864] libdruntime doesn't link with /bin/ld before Solaris 11.4
ro at CeBiTec dot Uni-Bielefeld.DE
gcc-bugzilla@gcc.gnu.org
Thu Nov 22 12:58:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87864
--- Comment #3 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
>> --- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
>> Is there another way to get a section in earlier versions of Solaris?
>
> What I initially did in LLVM's compiler-rt (which prompted the addition
> of __start_SEC/__stop_SEC support to ld) was to add two startup files to
> define the necessary labels and link the __start_SEC one early, the
> __stop_SEC one late:
>
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/
>
> See sancov_begin.S and sancov_end.S.
To elaborate, here's my current plan:
* Have some drtstuff.c like this
#ifdef DRT_BEGIN
void *__start_minfo[]
__attribute__((used, section("minfo"), aligned(sizeof(void *)))) = { };
#endif
#ifdef DRT_END
void *__stop_minfo[]
__attribute__((used, section("minfo"), aligned(sizeof(void *)))) = { };
#endif
and compile it into separate drtbegin.o/drtend.o.
* Based on the outcome of DCFG_MINFO_BRACKETING, add them to
libgphobos.spec like this:
%rename startfile startfile_orig
*startfile: %(startfile_orig) drtbegin.o%s
%rename endfile endfile_orig
*endfile: %(endfile_orig) drtend.o%s
* This will have to be done explicitly for libgdruntime.la and
libgphobos.la since both are linked with -nophoboslib.
Doing the equivalent of this manually allowed the libs to be linked on
Solaris 10. However, this was before the section_elf_shared.d work, so
the resulting libs had unresolved references.
More information about the Gcc-bugs
mailing list