Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jan 2017 12:37:52 -0800
From:      Mark Millard <markmi@dsl-only.net>
To:        Roman Divacky <rdivacky@vlakno.cz>
Cc:        Ed Maste <emaste@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Subject:   Re: /usr/bin/ld.lld on powerpc64: produces a.out for which: ld-elf.so.1: assert failed: /usr/src/libexec/rtld-elf/powerpc64/reloc.c:374
Message-ID:  <8242A7B9-7ED3-4861-8209-F3728113D188@dsl-only.net>
In-Reply-To: <20170111194844.GA16135@vlakno.cz>
References:  <7139F615-8F18-4EDC-9051-5FFEC0C4057F@dsl-only.net> <CAPyFy2CSmNyUjQcXyq4qUWp_A=Qr81O7fpRbZ5GcfFHFhdSntw@mail.gmail.com> <CF2D86C8-8EEB-4536-8D83-6F8C676EFEF6@dsl-only.net> <20170111194844.GA16135@vlakno.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2017-Jan-11, at 11:48 AM, Roman Divacky <rdivacky at vlakno.cz> =
wrote:

> Can you try this patch?
>=20
> Index: tools/lld/ELF/Target.cpp
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- tools/lld/ELF/Target.cpp	(revision 291691)
> +++ tools/lld/ELF/Target.cpp	(working copy)
> @@ -1062,7 +1062,8 @@
> }
>=20
> PPC64TargetInfo::PPC64TargetInfo() {
> -  PltRel =3D GotRel =3D R_PPC64_GLOB_DAT;
> +  GotRel =3D R_PPC64_GLOB_DAT;
> +  PltRel =3D R_PPC64_JMP_SLOT;
>   RelativeRel =3D R_PPC64_RELATIVE;
>   GotEntrySize =3D 8;
>   GotPltEntrySize =3D 8;

The result for the generated a.out (via ld.lld) was:

# /usr/local/bin/gdb a.out
. . .
Reading symbols from a.out...done.
(gdb) run
Starting program: /root/c_tests/a.out=20

Program received signal SIGSEGV, Segmentation fault.
0x000000001001056c in ?? ()
(gdb) bt
#0  0x000000001001056c in ?? ()
#1  0x00000000100100d8 in ?? ()
#2  0x00000000500279e0 in ._rtld_start () at =
/usr/src/libexec/rtld-elf/powerpc64/rtld_start.S:104
Backtrace stopped: frame did not save the PC


=3D=3D=3D
Mark Millard
markmi at dsl-only.net


On Wed, Jan 11, 2017 at 09:47:34AM -0800, Mark Millard wrote:
>=20
> On 2017-Jan-11, at 8:07 AM, Ed Maste <emaste at freebsd.org> wrote:
>=20
>> On 11 January 2017 at 04:15, Mark Millard <markmi at dsl-only.net> =
wrote:
>>>=20
>>> # ./a.out
>>> ld-elf.so.1: assert failed: =
/usr/src/libexec/rtld-elf/powerpc64/reloc.c:374
>>> Abort trap (core dumped)
>>=20
>> Would you paste the output of `readelf -r a.out`?
>=20
> Here you go, for ld.lld and for ld.bfd . . .
>=20
> For -fuse-ld=3Dlld :
>=20
> # readelf -r a.out
>=20
> Relocation section with addend (.rela.plt):
> r_offset     r_info       r_type              st_value         st_name =
+ r_addend
> 000010030038 000300000014 <unknown: 0x14>     0000000000000000 atexit =
+ 0
> 000010030040 000200000014 <unknown: 0x14>     0000000000000000 =
_init_tls + 0
> 000010030048 000500000014 <unknown: 0x14>     0000000000000000 exit + =
0
>=20
> For -fuse-ld=3Dbfd :
>=20
> # readelf -r a.out
>=20
> Relocation section with addend (.rela.plt):
> r_offset     r_info       r_type              st_value         st_name =
+ r_addend
> 000010010cb8 000300000015 <unknown: 0x15>     0000000000000000 atexit =
+ 0
> 000010010cd0 000400000015 <unknown: 0x15>     0000000000000000 =
_init_tls + 0
> 000010010ce8 000600000015 <unknown: 0x15>     0000000000000000 exit + =
0
>=20
> These were done on the powerpc64 machine (native).
>=20
>=20
> =3D=3D=3D
> Mark Millard
> markmi at dsl-only.net
> _______________________________________________
> freebsd-toolchain@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
> To unsubscribe, send any mail to =
"freebsd-toolchain-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8242A7B9-7ED3-4861-8209-F3728113D188>