[Bug libc/26065] New: aarch64: binutils-gdb/ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug libc/26065] New: aarch64: binutils-gdb/ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail

Sourceware - glibc-bugs mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=26065

            Bug ID: 26065
           Summary: aarch64: binutils-gdb/ld/testsuite/ld-elf symbolic
                    tests dl4e and dl4f fail
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: i at maskray dot me
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

On aarch64,

% make -C ~/Dev/binutils-gdb/Debug check-ld RUNTESTFLAGS='ld-elf/shared.exp'
...
Running /home/maskray/Dev/binutils-gdb/ld/testsuite/ld-elf/shared.exp ...
FAIL: Run with libdl4e.so
FAIL: Run with libdl4f.so


% cat dl4.c
#include <stdio.h>

int foo1;
int foo2;

extern void xxx1 (void);
extern void xxx2 (void);

void
bar (int x)
{
  if (foo1 == 1)
    printf ("bar OK1\n");
  else if (foo1 == 0)
    printf ("bar OK2\n");
  if (foo2 == 1)
    printf ("bar OK3\n");
  else if (foo2 == 0)
    printf ("bar OK4\n");
  foo1 = -1;
  foo2 = -1;
  xxx1 ();
  xxx2 ();
}

% cat dl4xxx.c
#include <stdio.h>

void
xxx1 (void)
{
  printf ("DSO1\n");
}

void
xxx2 (void)
{
  printf ("DSO2\n");
}


% cd /home/maskray/Dev/binutils-gdb/Debug/ld/tmpdir/ld

tmpdir/libdl4e.so is linked with:

gcc -B/home/maskray/Dev/binutils-gdb/Debug/ld/tmpdir/ld/
-L/usr/local/aarch64-unknown-linux-gnu/lib64 -L/usr/local/lib64 -L/lib64
-L/usr/lib64 -L/usr/local/aarch64-unknown-linux-gnu/lib -L/usr/local/lib -L/lib
-L/usr/lib -o tmpdir/libdl4e.so
-L/home/maskray/Dev/binutils-gdb/ld/testsuite/ld-elf -shared
-Wl,-Bsymbolic-functions,--dynamic-list-cpp-new tmpdir/dl4.o tmpdir/dl4xxx.o

ld emitted .dynsym is correct. There is no R_AARCH64_GLOB_DAT for foo1.
However, at runtime foo1 (in .bss) is somehow changed to 1. I don't understand
why this happens.
There is no dynamic relocation relocating foo1 in libdl4e.so

In ld/testsuite/ld-elf/dl4.c, if I change `int foo1;` to `int foo = -1;`. foo1
will reside in `.data`. It is still somehow relocated.

% readelf -Wr tmpdir/libdl4e.so

Relocation section '.rela.dyn' at offset 0x428 contains 9 entries:
    Offset             Info             Type               Symbol's Value
Symbol's Name + Addend
0000000000010de0  0000000000000403 R_AARCH64_RELATIVE                      
680
0000000000010de8  0000000000000403 R_AARCH64_RELATIVE                      
638
0000000000010fc8  0000000000000403 R_AARCH64_RELATIVE                      
11024
0000000000010fd8  0000000000000403 R_AARCH64_RELATIVE                      
11028
0000000000011018  0000000000000403 R_AARCH64_RELATIVE                      
11018
0000000000010fb8  0000000300000401 R_AARCH64_GLOB_DAT     0000000000000000
_ITM_deregisterTMCloneTable + 0
0000000000010fc0  0000000400000401 R_AARCH64_GLOB_DAT     0000000000000000
__cxa_finalize@GLIBC_2.17 + 0
0000000000010fd0  0000000500000401 R_AARCH64_GLOB_DAT     0000000000000000
__gmon_start__ + 0
0000000000010fe0  0000000700000401 R_AARCH64_GLOB_DAT     0000000000000000
_ITM_registerTMCloneTable + 0


GNU ld -Bsymbolic may be wrong as well. If I change
-Wl,-Bsymbolic-functions,--dynamic-list-cpp-new to -Bsymbolic, there will be a
GLOB_DAT for foo1.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/26065] aarch64: binutils-gdb/ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail

Sourceware - glibc-bugs mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=26065

Fangrui Song <i at maskray dot me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |aarch64-*

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/26065] aarch64: binutils-gdb/ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail

Sourceware - glibc-bugs mailing list
In reply to this post by Sourceware - glibc-bugs mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=26065

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2020-06-02
     Ever confirmed|0                           |1

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Please attach the required input files to this bug, with instructions how to
build them. We do not have access to your binutils source tree.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/26065] aarch64: binutils-gdb/ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail

Sourceware - glibc-bugs mailing list
In reply to this post by Sourceware - glibc-bugs mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=26065

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libc                        |dynamic-link
              Flags|                            |security-

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/26065] aarch64: binutils-gdb/ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail

Sourceware - glibc-bugs mailing list
In reply to this post by Sourceware - glibc-bugs mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=26065

--- Comment #2 from Fangrui Song <i at maskray dot me> ---
> Please attach the required input files to this bug, with instructions how to build them. We do not have access to your binutils source tree.

binutils-gdb master

You can reproduce with `make check-ld RUNTESTFLAGS='ld-elf/shared.exp'` at any
commit after bb68f22c8e648032a0d1c1d17353eec599ff5e6a (2020-05-24). Just
reproduced on an aarch64 machine at bb7322c67111024f5977deb85abd777ec713b1a9
(2020-06-02)

The tests work on an x86-64 machine.

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