bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/24601] New: aarch64: local-exec TPREL relocations to weak undefi


From: maskray at google dot com
Subject: [Bug ld/24601] New: aarch64: local-exec TPREL relocations to weak undefined symbols -> assertion fail
Date: Wed, 22 May 2019 14:46:04 +0000

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

            Bug ID: 24601
           Summary: aarch64: local-exec TPREL relocations to weak
                    undefined symbols -> assertion fail
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: maskray at google dot com
  Target Milestone: ---

% cat a.c
__attribute__((weak,tls_model("local-exec")))
extern __thread char tls;
char *get() { return &tls; }

% clang -target aarch64 -c a.c
% readelf -r a.o
Relocation section '.rela.text' at offset 0x158 contains 2 entries:
    Offset             Info             Type               Symbol's Value 
Symbol's Name + Addend
0000000000000004  0000000500000225 R_AARCH64_TLSLE_ADD_TPREL_HI12
0000000000000000 tls + 0
0000000000000008  0000000500000227 R_AARCH64_TLSLE_ADD_TPREL_LO12_NC
0000000000000000 tls + 0

% ./ld-new a.o
./ld-new: warning: cannot find entry symbol _start; defaulting to
00000000004000b0
./ld-new: BFD (GNU Binutils) 2.32.51.20190522 assertion fail
../../bfd/elfnn-aarch64.c:5059
[1]    153266 segmentation fault  ./ld-new a.o

static bfd_vma
tpoff_base (struct bfd_link_info *info)
{
  struct elf_link_hash_table *htab = elf_hash_table (info);

  /* If tls_sec is NULL, we should have signalled an error already.  */
  BFD_ASSERT (htab->tls_sec != NULL);

  bfd_vma base = align_power ((bfd_vma) TCB_SIZE,
                              htab->tls_sec->alignment_power);
  return htab->tls_sec->vma - base;
}


BTW, the formula may be incorrect if p_vaddr%p_align != 0 (the offset should be
chosen so that offset%p_align = p_vaddr%p_align, but that scenario may be
unrealistic.

-- 
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]