• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision549dba71045c856f3d169bf2edc7bfc7cabe5a0b (tree)
l'heure2015-12-07 11:47:00
AuteurAlan Modra <amodra@gmai...>
CommiterAlan Modra

Message de Log

[GOLD] R_PPC64_ENTRY support

elfcpp/
* powerpc.h (R_PPC64_ENTRY): Define.
gold/
* powerpc.cc (add_2_2_12, ld_2_12, lis_2): Define.
(Target_powerpc::Scan::local, global): Handle R_PPC64_ENTRY.
(Target_powerpc::Relocate::relocate): Edit code at R_PPC64_ENTRY.

Change Summary

Modification

--- a/elfcpp/ChangeLog
+++ b/elfcpp/ChangeLog
@@ -1,3 +1,7 @@
1+2015-12-07 Alan Modra <amodra@gmail.com>
2+
3+ * powerpc.h (R_PPC64_ENTRY): Define.
4+
15 2015-11-11 Alan Modra <amodra@gmail.com>
26 Peter Bergner <bergner@vnet.ibm.com>
37
--- a/elfcpp/powerpc.h
+++ b/elfcpp/powerpc.h
@@ -178,6 +178,7 @@ enum
178178 R_PPC_EMB_RELSDA = 116,
179179 R_PPC64_REL24_NOTOC = 116,
180180 R_PPC64_ADDR64_LOCAL = 117,
181+ R_PPC64_ENTRY = 118,
181182
182183 R_PPC_VLE_REL8 = 216,
183184 R_PPC_VLE_REL15 = 217,
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
1+2015-12-07 Alan Modra <amodra@gmail.com>
2+
3+ * powerpc.cc (add_2_2_12, ld_2_12, lis_2): Define.
4+ (Target_powerpc::Scan::local, global): Handle R_PPC64_ENTRY.
5+ (Target_powerpc::Relocate::relocate): Edit code at R_PPC64_ENTRY.
6+
17 2015-12-03 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
28
39 * object.cc (Sized_relobj::do_for_all_local_got_entries): Use
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -3224,6 +3224,7 @@ Output_data_plt_powerpc<size, big_endian>::add_local_ifunc_entry(
32243224
32253225 static const uint32_t add_0_11_11 = 0x7c0b5a14;
32263226 static const uint32_t add_2_2_11 = 0x7c425a14;
3227+static const uint32_t add_2_2_12 = 0x7c426214;
32273228 static const uint32_t add_3_3_2 = 0x7c631214;
32283229 static const uint32_t add_3_3_13 = 0x7c636a14;
32293230 static const uint32_t add_11_0_11 = 0x7d605a14;
@@ -3258,6 +3259,7 @@ static const uint32_t ld_0_12 = 0xe80c0000;
32583259 static const uint32_t ld_2_1 = 0xe8410000;
32593260 static const uint32_t ld_2_2 = 0xe8420000;
32603261 static const uint32_t ld_2_11 = 0xe84b0000;
3262+static const uint32_t ld_2_12 = 0xe84c0000;
32613263 static const uint32_t ld_11_2 = 0xe9620000;
32623264 static const uint32_t ld_11_11 = 0xe96b0000;
32633265 static const uint32_t ld_12_2 = 0xe9820000;
@@ -3267,6 +3269,7 @@ static const uint32_t lfd_0_1 = 0xc8010000;
32673269 static const uint32_t li_0_0 = 0x38000000;
32683270 static const uint32_t li_12_0 = 0x39800000;
32693271 static const uint32_t lis_0 = 0x3c000000;
3272+static const uint32_t lis_2 = 0x3c400000;
32703273 static const uint32_t lis_11 = 0x3d600000;
32713274 static const uint32_t lis_12 = 0x3d800000;
32723275 static const uint32_t lvx_0_12_0 = 0x7c0c00ce;
@@ -5607,6 +5610,7 @@ Target_powerpc<size, big_endian>::Scan::local(
56075610 case elfcpp::R_POWERPC_GNU_VTENTRY:
56085611 case elfcpp::R_PPC64_TOCSAVE:
56095612 case elfcpp::R_POWERPC_TLS:
5613+ case elfcpp::R_PPC64_ENTRY:
56105614 break;
56115615
56125616 case elfcpp::R_PPC64_TOC:
@@ -5982,6 +5986,7 @@ Target_powerpc<size, big_endian>::Scan::global(
59825986 case elfcpp::R_POWERPC_GNU_VTENTRY:
59835987 case elfcpp::R_PPC_LOCAL24PC:
59845988 case elfcpp::R_POWERPC_TLS:
5989+ case elfcpp::R_PPC64_ENTRY:
59855990 break;
59865991
59875992 case elfcpp::R_PPC64_TOC:
@@ -7655,6 +7660,48 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
76557660 }
76567661 }
76577662 break;
7663+
7664+ case elfcpp::R_PPC64_ENTRY:
7665+ value = (target->got_section()->output_section()->address()
7666+ + object->toc_base_offset());
7667+ if (value + 0x80008000 <= 0xffffffff
7668+ && !parameters->options().output_is_position_independent())
7669+ {
7670+ Insn* iview = reinterpret_cast<Insn*>(view);
7671+ Insn insn1 = elfcpp::Swap<32, big_endian>::readval(iview);
7672+ Insn insn2 = elfcpp::Swap<32, big_endian>::readval(iview + 1);
7673+
7674+ if ((insn1 & ~0xfffc) == ld_2_12
7675+ && insn2 == add_2_2_12)
7676+ {
7677+ insn1 = lis_2 + ha(value);
7678+ elfcpp::Swap<32, big_endian>::writeval(iview, insn1);
7679+ insn2 = addi_2_2 + l(value);
7680+ elfcpp::Swap<32, big_endian>::writeval(iview + 1, insn2);
7681+ return true;
7682+ }
7683+ }
7684+ else
7685+ {
7686+ value -= address;
7687+ if (value + 0x80008000 <= 0xffffffff)
7688+ {
7689+ Insn* iview = reinterpret_cast<Insn*>(view);
7690+ Insn insn1 = elfcpp::Swap<32, big_endian>::readval(iview);
7691+ Insn insn2 = elfcpp::Swap<32, big_endian>::readval(iview + 1);
7692+
7693+ if ((insn1 & ~0xfffc) == ld_2_12
7694+ && insn2 == add_2_2_12)
7695+ {
7696+ insn1 = addis_2_12 + ha(value);
7697+ elfcpp::Swap<32, big_endian>::writeval(iview, insn1);
7698+ insn2 = addi_2_2 + l(value);
7699+ elfcpp::Swap<32, big_endian>::writeval(iview + 1, insn2);
7700+ return true;
7701+ }
7702+ }
7703+ }
7704+ break;
76587705 }
76597706 }
76607707