From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5818 invoked by alias); 28 May 2004 22:31:57 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 5800 invoked from network); 28 May 2004 22:31:55 -0000 Received: from unknown (HELO iguana.mbuf.com) (209.19.166.52) by sourceware.org with SMTP; 28 May 2004 22:31:55 -0000 Received: (qmail 29398 invoked from network); 28 May 2004 22:31:54 -0000 Received: from localhost (HELO ?127.0.0.1?) (127.0.0.1) by localhost with SMTP; 28 May 2004 22:31:54 -0000 In-Reply-To: <0FCD2BB0-B0BB-11D8-8CFA-000393CDE218@mbuf.com> References: <20040528145608.GA556@nevyn.them.org> <0FCD2BB0-B0BB-11D8-8CFA-000393CDE218@mbuf.com> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: multipart/mixed; boundary=Apple-Mail-2-102130668 Message-Id: Cc: Daniel Jacobowitz From: David Poole Subject: Re: DT_TEXTREL/.dynamic issue with the binutils 2.15 linker on ARM and Linux Date: Fri, 28 May 2004 22:58:00 -0000 To: binutils@sources.redhat.com X-SW-Source: 2004-05/txt/msg00606.txt.bz2 --Apple-Mail-2-102130668 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Content-length: 126 >> Please create a complete linkable testcase that shows this. This is as simple as I can make it and still think it works. --Apple-Mail-2-102130668 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0755; name="mk" Content-Disposition: attachment; filename=mk Content-length: 933 #!/bin/sh set -x CC=arm-linux-uclibc-gcc STRIP=arm-linux-uclibc-strip LD=arm-linux-uclibc-ld #LD=/home/davep/src/binutils-2.15/build/ld/ld-new $CC -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fstrict-aliasing -Os -mlittle-endian -mtune=arm9tdmi -march=armv4 -msoft-float -fPIC -DUCLIBC_RUNTIME_PREFIX=\"/\" -fno-builtin -nostdinc -c resolve.S -o resolve.o $STRIP -x -R .note -R .comment resolve.o $CC -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fstrict-aliasing -Os -mlittle-endian -mtune=arm9tdmi -march=armv4 -msoft-float -fPIC -DUCLIBC_RUNTIME_PREFIX=\"/\" -fno-builtin -nostdinc -c test_dl-startup.c -o test_dl-startup.o $STRIP -x -R .note -R .comment test_dl-startup.o $LD -EL -shared --warn-common --export-dynamic --sort-common -z combreloc --discard-locals --discard-all --no-undefined -s -e _dl_boot -soname=uclibctest.so -o uclibctest.so resolve.o test_dl-startup.o --Apple-Mail-2-102130668 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="resolve.S" Content-Disposition: attachment; filename=resolve.S Content-length: 1420 /* * This function is _not_ called directly. It is jumped to (so no return * address is on the stack) when attempting to use a symbol that has not yet * been resolved. The first time a jump symbol (such as a function call inside * a shared library) is used (before it gets resolved) it will jump here to * _dl_linux_resolve. When we get called the stack looks like this: * reloc_entry * tpnt * * This function saves all the registers, puts a copy of reloc_entry and tpnt * on the stack (as function arguments) then make the function call * _dl_linux_resolver(tpnt, reloc_entry). _dl_linux_resolver() figures out * where the jump symbol is _really_ supposed to have jumped to and returns * that to us. Once we have that, we overwrite tpnt with this fixed up * address. We then clean up after ourselves, put all the registers back how we * found them, then we jump to the fixed up address, which is where the jump * symbol that got us here really wanted to jump to in the first place. * -Erik Andersen */ #define sl r10 #define fp r11 #define ip r12 .text .globl _dl_linux_resolve .type _dl_linux_resolve,%function .align 4; _dl_linux_resolve: stmdb sp!, {r0, r1, r2, r3, sl, fp} sub r1, ip, lr sub r1, r1, #4 add r1, r1, r1 ldr r0, [lr, #-4] mov r3,r0 bl _dl_linux_resolver mov ip, r0 ldmia sp!, {r0, r1, r2, r3, sl, fp, lr} mov pc,ip .size _dl_linux_resolve, .-_dl_linux_resolve --Apple-Mail-2-102130668 Content-Transfer-Encoding: 7bit Content-Type: text/plain; x-unix-mode=0644; name="test_dl-startup.c" Content-Disposition: attachment; filename=test_dl-startup.c Content-length: 81 unsigned long _dl_linux_resolver(void *tpnt, int reloc_entry) { return 0; } --Apple-Mail-2-102130668 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Content-length: 140 -- David Poole Mobility Electronics, Idaho http://www.mobl.com 960 Broadway Avenue, Suite 300 Boise, ID 83706 --Apple-Mail-2-102130668--