[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gold/21054] New: [MIPS] Forced local symbol rearranging messes up G
From: |
james410 at cowgill dot org.uk |
Subject: |
[Bug gold/21054] New: [MIPS] Forced local symbol rearranging messes up GOT |
Date: |
Mon, 16 Jan 2017 17:58:30 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=21054
Bug ID: 21054
Summary: [MIPS] Forced local symbol rearranging messes up GOT
Product: binutils
Version: 2.29 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: james410 at cowgill dot org.uk
CC: ian at airs dot com
Target Milestone: ---
Created attachment 9754
--> https://sourceware.org/bugzilla/attachment.cgi?id=9754&action=edit
gold-mips-forced-local.c
Originally this systemd bug in Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851412
The attached testcase immediately segfaults when run after being compiled by
gold on mips. It works fine when the bfd linker is used.
Compile with:
gcc -Wl,-version-script=blank.ver -fuse-ld=gold gold-mips-forced-local.c
With blank.ver hiding all symbols:
{
local:
*;
};
The segfault occurs in __start when it tries to call __libc_start_main. It
instead calls a NULL pointer. Looking in GDB the GOT has definitely been
initialized but the pointer to __libc_start_main occurs 8 bytes (2 words)
before the GOT entry actually accessed in __start.
In Debian, the bug manifested in any executable which loaded libsystemd.so by
segfaulting on exit. The segfault occured in __do_global_dtors_aux when it
tried to call __cxa_finalize but instead called some other random function from
libsystemd.
Aurélien Jarno bisected this bug to commit
c4d5a76223f74930add9014f2a77339eb80b737c:
Author: Cary Coutant <address@hidden>
Date: Thu Dec 22 14:06:24 2016 -0800
Fix placement of forced local symbols in the dynamic symbol table.
Gold was not placing forced-local symbols (e.g., hidden visibility)
at the front of the dynamic symbol table, or including them in the
count of local symbols recorded in the .dynsym section's sh_info field.
In my testcase I expect the __start_ASECTION and __stop_ASECTION symbols are
forced local and were affected by this (also fits the GOT being offset by 2
words). On MIPS they will require GOT entries as they are used by num_ptrs, but
presumably moving them around the dynamic symbol table screwed the GOT up on
MIPS. I know that on MIPS, the dynamic symbol table is used as an index into
the GOT but I don't have a lot of in depth knowledge on it.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gold/21054] New: [MIPS] Forced local symbol rearranging messes up GOT,
james410 at cowgill dot org.uk <=
- [Bug gold/21054] [MIPS] Forced local symbol rearranging messes up GOT, aurelien at aurel32 dot net, 2017/01/16
- [Bug gold/21054] [MIPS] Forced local symbol rearranging messes up GOT, james410 at cowgill dot org.uk, 2017/01/17
- [Bug gold/21054] [MIPS] Forced local symbol rearranging messes up GOT, pochu27 at gmail dot com, 2017/01/17
- [Bug gold/21054] [MIPS] Forced local symbol rearranging messes up GOT, vladaqm at gmail dot com, 2017/01/18
- [Bug gold/21054] [MIPS] Forced local symbol rearranging messes up GOT, cvs-commit at gcc dot gnu.org, 2017/01/23
- [Bug gold/21054] [MIPS] Forced local symbol rearranging messes up GOT, cvs-commit at gcc dot gnu.org, 2017/01/23
- [Bug gold/21054] [MIPS] Forced local symbol rearranging messes up GOT, ccoutant at gmail dot com, 2017/01/23