hns - 日記自動生成システム - Version 2.19.9

先月 2004年10月 来月
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Namazu for hns による簡易全文検索
詳しくは 詳細指定/ヘルプを参照して下さい
検索式:

2004年10月16日() 旧暦 [n年日記]

更新: "2004/10/16 21:30:33"

#1 [NetBSD][2.0H] いつ R_PPC_REL24 に設定される ?

gnu/dist/binutils/bfd/elf32-ppc.c:

    case BFD_RELOC_PPC_B26:           r = R_PPC_REL24; break;

src/gnu/dist/binutils/gas/config/tc-ppc.c:

5489  /* Determine a BFD reloc value based on the operand information.
5490     We are only prepared to turn a few of the operands into
5491     relocs.  */
5492  if ((operand->flags & PPC_OPERAND_RELATIVE) != 0
5493      && operand->bits == 26
5494      && operand->shift == 0)
5495    fixP->fx_r_type = BFD_RELOC_PPC_B26;
かなり乱暴だけれど、 ここを次のように変更してしまう ?
gnu/dist/binutils/bfd/elf32-ppc.c:
1959     case BFD_RELOC_PPC_B26:             r = R_PPC_REL24;          
...
1971     case BFD_RELOC_32_PCREL:            r = R_PPC_REL32;          
shared library の時だけそうして欲しい訳で、ちょっとまずい ?
-fPIC した時に、このコードを出すのが間違い ?

変更して見たが::

/usr/lib/libgcc_s.so.1: Unsupported relocation type 26 in non-PLT relocations
これは許可一覧の中になかった
case R_TYPE(NONE):
case R_TYPE(32):        /* word32 S + A */
case R_TYPE(GLOB_DAT):  /* word32 S + A */
case R_TYPE(RELATIVE):  /* word32 B + A */
case R_TYPE(COPY):
case R_TYPE(JMP_SLOT):
/usr/include/reloc.h
  0          RELOC_NONE,
  1          RELOC_32,
  2          RELOC_24,
  3          RELOC_16,
  4          RELOC_16_LO,
  5          RELOC_16_HI,    /* RELOC_ADDIS = 5 */
  6          RELOC_16_HA,
  7          RELOC_14,
  8          RELOC_14_TAKEN,
  9          RELOC_14_NTAKEN,
 10          RELOC_REL24,    /* RELOC_BRANCH = 10 */
 11          RELOC_REL14,
 12          RELOC_REL14_TAKEN,
 13          RELOC_REL14_NTAKEN,
 14          RELOC_GOT16,
 15          RELOC_GOT16_LO,
 16          RELOC_GOT16_HI,
 17          RELOC_GOT16_HA,
 18          RELOC_PLT24,
 19          RELOC_COPY,
 20          RELOC_GLOB_DAT,
 21          RELOC_JMP_SLOT,
 22          RELOC_RELATIVE,
 23          RELOC_LOCAL24PC,
 24          RELOC_U32,
 25          RELOC_U16,
 26          RELOC_REL32,
 27          RELOC_PLT32,
 28          RELOC_PLTREL32,
 29          RELOC_PLT16_LO,
 30          RELOC_PLT16_HI,
 31          RELOC_PLT16_HA,

次のようにして見よう。:

case BFD_RELOC_32:                  r = R_PPC_ADDR32;               break;
つまり次のように変更
 Index: gnu/dist/binutils/gas/config/tc-ppc.c
 ===================================================================
 RCS file: /e/st4200/20040925/Repository/src/gnu/dist/binutils/gas/config/tc-ppc.c,v
 retrieving revision 1.1.1.1
 diff -u -r1.1.1.1 tc-ppc.c
 --- gnu/dist/binutils/gas/config/tc-ppc.c	28 Sep 2004 12:38:06 -0000	1.1.1.1
 +++ gnu/dist/binutils/gas/config/tc-ppc.c	16 Oct 2004 09:12:36 -0000
 @@ -5492,7 +5492,7 @@
        if ((operand->flags & PPC_OPERAND_RELATIVE) != 0
  	  && operand->bits == 26
  	  && operand->shift == 0)
 -	fixP->fx_r_type = BFD_RELOC_PPC_B26;
 +	fixP->fx_r_type = BFD_RELOC_32
        else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0
  	  && operand->bits == 16
  	  && operand->shift == 0)
これで、使える libgcc_s.so.1.0 が出来た。

#2 [build.sh] gcc の版が違うと

/usr/include/signal.h:68: error: `pthread_t' was not declared in this scope
/usr/include/signal.h:68: error: parse error before `)' token
/usr/include/signal.h:68: error: initializer list being treated as compound 
ImageMagick
ttyp0:makoto@st4200  11:24:36/041016(...checkout/src)> c++ --version
c++ (GCC) 3.3.4
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ttyp0:makoto@st4200  11:24:41/041016(...checkout/src)> g++ --version
g++ (GCC) 3.3.3 (NetBSD nb3 20040520)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ttyp0:makoto@st4200  11:24:43/041016(...checkout/src)> which c++
/usr/local/bin/c++
ttyp0:makoto@st4200  11:24:53/041016(...checkout/src)> which g++
/usr/bin/g++

僕の用意した 2.0H では build.sh は走らない:

dependall ===> tools/groff
...
configure: error: a working C++ compiler is required

*** Failed target:  .configure_done

src/tools/groff/obj/build/config.log:

configure:2625: ./conftest
/usr/lib/libgcc_s.so.1: Unsupported relocation type 10 in non-PLT relocations

#3 [NetBSD] gcc に -fPIC を指定しても R_PPC_PLTREL24 に

 ttyp2:makoto@st4200  21:29:55/041016(...checkout/src)> objdump -r gnu/lib/libgcc3/libgcc_s/obj/_absvdi2.so
 
 gnu/lib/libgcc3/libgcc_s/obj/_absvdi2.so:     file format elf32-powerpc
 
 RELOCATION RECORDS FOR [.text]:
 OFFSET   TYPE              VALUE 
 00000034 R_PPC_PLTREL24    abort
良く見ると REL24 でなくて RLTREL24 になっている



最近の日記
2024年03月10日
停電 (瞬電)
2024年03月03日
the second try on bare-metal
useradd
2024年02月29日
opendkim and senmail
2024年01月24日
chat/iam 0.0.8
2024年01月21日
uselocale vs setlocale (textproc/R-readxl)
以上、1 日分です。
タイトル一覧
カテゴリ分類
Powered by hns-2.19.9, HyperNikkiSystem Project

Count.cgi (since 2000/02/05)