https://sourceware.org/bugzilla/show_bug.cgi?id=24286
Bug ID: 24286 Summary: Can't relocate protected-visibility reference against a --defsym'd definition Product: binutils Version: 2.33 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: gold Assignee: ccoutant at gmail dot com Reporter: srk31 at srcf dot ucam.org CC: ian at airs dot com Target Milestone: --- Created attachment 11658 --> https://sourceware.org/bugzilla/attachment.cgi?id=11658&action=edit Test case If I have an undefined symbol with protected visibility, I get an internal gold error when attempting to relocate a reference to that symbol when its definition is provided via --defsym. Example: foo.c: int foo(void) { return 42; } uses-blah.c: extern int blah(void) __attribute__((visibility("protected"))); int bar(void) { return blah(); } $ make foo.o uses-blah.o ... $ cc -shared -o /dev/null uses-blah.o foo.o \ -Wl,--defsym,blah=foo \ -Wl,-fuse-ld=gold The BFD linker happily processes this. But gold (as of git revision cd5a152cebb201e98f3dbeca510aa39e838a1f62) bombs: /usr/local/bin/ld.gold: internal error in relocate, at x86_64.cc:4802 collect2: error: ld returned 1 exit status The failing assertion at x86_64.cc:4802 is this. case elfcpp::R_X86_64_PLT32: case elfcpp::R_X86_64_PLT32_BND: gold_assert(gsym == NULL || gsym->has_plt_offset() || gsym->final_value_is_known() || (gsym->is_defined() && !gsym->is_from_dynobj() && !gsym->is_preemptible())); (A valid question is: what is the purpose of making the undefined symbol have protected visibility? Indeed nothing as far as I can tell... it looks like I can work around the problem by tweaking my source code so that I attach visibility only to the definition, not to declarations.) Test case attached. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils