bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a bug report of binutils-010308


From: Hideo Saito
Subject: a bug report of binutils-010308
Date: Thu, 15 Mar 2001 18:00:13 +0900

To  : address@hidden
From: address@hidden (Hideo Saito)
Title: a bug report of binutils-010308

Hello. My name is H.Saito from Japan.

I report a bug of binutils-010308, when specified '-shared' option.
OS is NetBSD-1.4.3 and mips3 and big-endian architecture.

This is a test program.

static int aa = 0;
static int a0 = 0xa0;
static int a1 = 0xa1;
static int *p0 = &a0;
static int *p1 = &a1;
aaa()
{
}

I do "cc -c test.c" and extract ".data" section from test.o
and dumped it.

  offset   data
00000000   00000000  000000a0  000000a1  00000004 
00000010   00000008

I do "ld -shared -o test.so test.o" and extract ".data" section
from test.so and dumped it.

00000000   00000000  000000a0  000000a1  00000004
00000010   00000008

But ld-2.9.1 or ld-2.10.1 can link correctly.

00000000   00000000  000000a0  000000a1  6002043c
00000010   60020440

(nm test.so)
0000000060020470 A _DYNAMIC
0000000060020450 A _GLOBAL_OFFSET_TABLE_
0000000060020518 A __bss_start
000000005ffe03dc t __gnu_compiled_c
0000000060020518 A _edata
0000000060020518 A _end
0000000060020518 A _fbss
0000000060020438 A _fdata
000000005ffe03dc A _ftext
0000000060028440 A _gp
000000006002043c d a0
0000000060020440 d a1
0000000060020438 d aa
000000005ffe03dc A aaa
000000005ffe03dc t gcc2_compiled.
0000000060020444 d p0
0000000060020448 d p1

I append a patch.

Thank you. Good bye.
-----------------------------------
--- elf32-mips.c.orig   Mon Mar 12 18:19:21 2001
+++ elf32-mips.c        Thu Mar 15 17:02:53 2001
@@ -5869,7 +5869,7 @@
         this symbol will not be referred to by the relocation, we must
         adjust it by the value we give it in the dynamic symbol table.
         Otherwise leave the job up to the dynamic linker.  */
-      if (!indx && r_type != R_MIPS_REL32)
+      if (info->shared || (!indx && r_type != R_MIPS_REL32))
        *addendp += symbol;
 
       /* The relocation is always an REL32 relocation because we don't



reply via email to

[Prev in Thread] Current Thread [Next in Thread]