bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/20267] New: ld.bfd crash when link with LLVMgold.so plugin


From: zyfwong at gmail dot com
Subject: [Bug ld/20267] New: ld.bfd crash when link with LLVMgold.so plugin
Date: Fri, 17 Jun 2016 07:47:50 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20267

            Bug ID: 20267
           Summary: ld.bfd crash when link with LLVMgold.so plugin
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: zyfwong at gmail dot com
  Target Milestone: ---

=== foo.c ====
int global_var;

=== main.c ====
int global_var;
int main(void)
{
  return global_var;
}

void _start()
{
  main();
}

=== Compile ===
$ clang -emit-llvm -Os foo.c -c foo.o
$ ar rs --plugin LLVMgold.so foo.a foo.o
$ clang -emit-llvm -Os main.c -c main.o
$ ld --plugin LLVMgold.so main.o foo.a
segmentation fault (core dumped)

ld.bfd will crash in `elf_link_is_defined_archive_symbol`.

The original code:
  /* Return FALSE if the object has been claimed by plugin.  */
  if (abfd->plugin_format == bfd_plugin_yes)
    return FALSE;

  if (! bfd_check_format (abfd, bfd_object))
    return FALSE;

If I add one more check after `bfd_check_format`, it seems that the problem is
fixed:

  if (abfd->plugin_format == bfd_plugin_yes)
    return FALSE;

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]