From: Gwenole Beauchesne <gbeauchesne@mandriva.com>
To: binutils@sources.redhat.com
Cc: hongjiu.lu@intel.com
Subject: [PATCH] PR 878: fix -pie
Date: Fri, 06 May 2005 10:33:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.58.0505061154420.13659@thalys.mandrakesoft.com> (raw)
Hi,
This change:
2005-03-22 H.J. Lu <hongjiu.lu@intel.com>
* emultempl/elf32.em (gld${EMULATION_NAME}_provide_bound_symbols): New
(gld${EMULATION_NAME}_finish): Call
gld${EMULATION_NAME}_provide_bound_symbols to provide
__preinit_array_start, __preinit_array_end, __init_array_start,
__init_array_end, __fini_array_start and __fini_array_end.
* scripttempl/elf.sc: Don't provide __preinit_array_start,
__preinit_array_end, __init_array_start, __init_array_end,
__fini_array_start nor __fini_array_end.
causes -pie to fail on linux:
[gb@n2 vrac]$ echo 'int main(void){return 0;}' | gcc -xc -fPIE -pie -
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
: undefined reference to `__init_array_end'
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
: undefined reference to `__init_array_start'
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_fini':
: undefined reference to `__fini_array_end'
/usr/lib/libc_nonshared.a(elf-init.oS): In function `__libc_csu_fini':
: undefined reference to `__fini_array_start'
collect2: ld returned 1 exit status
[gb@n2 vrac]$ ld --version
GNU ld version 2.16.90 20050506
The following patch makes sure the test for shared library doesn't cover
pie executables. WDYT?
2005-04-30 Gwenole Beauchesne <gbeauchesne@mandriva.com>
PR 878
* emultempl/elf32.em
(gld${EMULATION_NAME}_provide_init_fini_syms): Provide init/fini
symbols for -pie executables.
--- binutils-2.16.90.0.2/ld/emultempl/elf32.em.ld-pie-init-fini-syms 2005-04-29 19:50:30.000000000 +0200
+++ binutils-2.16.90.0.2/ld/emultempl/elf32.em 2005-04-30 07:58:17.739644900 +0200
@@ -1495,7 +1495,7 @@ gld${EMULATION_NAME}_provide_bound_symbo
static void
gld${EMULATION_NAME}_provide_init_fini_syms (void)
{
- if (!link_info.relocatable && !link_info.shared)
+ if (!link_info.relocatable && (!link_info.shared || link_info.pie))
{
gld${EMULATION_NAME}_provide_bound_symbols (".preinit_array",
"__preinit_array_start",
next reply other threads:[~2005-05-06 10:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-06 10:33 Gwenole Beauchesne [this message]
2005-05-06 10:38 ` Jakub Jelinek
2005-05-06 15:45 ` H. J. Lu
2005-05-07 0:30 ` Alan Modra
2005-05-07 0:49 ` H. J. Lu
2005-05-07 3:45 ` Alan Modra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.58.0505061154420.13659@thalys.mandrakesoft.com \
--to=gbeauchesne@mandriva.com \
--cc=binutils@sources.redhat.com \
--cc=hongjiu.lu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).