Skip to content

Commit e50c10e

Browse files
committed
gold: Remove NaCl target support
NaCl has been deprecated: https://developer.chrome.com/docs/native-client/migration/ It is now in the process of being removed from llvm: llvm/llvm-project#133661 Remove NaCl target support from gold. * Makefile.am (CCFILES): Remove nacl.cc. (HFILES): Remove nacl.h. * Makefile.in: Regenerated. * aarch64.cc: Don't include nacl.h. * arm.cc: Don't include nacl.h. (Target_arm_nacl): Removed. (Output_data_plt_arm_nacl): Likewise. (target_selector_arm): Replace Target_arm_nacl with Target_selector_arm. * i386.cc: Don't include nacl.h. (Output_data_plt_i386_nacl): Removed. (Target_i386_nacl): Likewise. (target_selector_i386): Replace Target_selector_i386_nacl with Target_selector_i386. * mips.cc: Don't include nacl.h. (Target_mips_nacl): Removed. (Target_selector_mips_nacl): Likewise. (target_selector_mips32): Replace Target_selector_mips_nacl with Target_selector_mips. (target_selector_mips32el): Likewise. (target_selector_mips64): Likewise. (target_selector_mips64el): Likewise. * nacl.cc: Removed. * nacl.h: Likewise. * x86_64.cc: Don't include nacl.h. (Output_data_plt_x86_64_nacl): Removed. (Target_x86_64_nacl): Likewise. (target_selector_x86_64): Replace Target_x86_64_nacl with Target_selector_x86_64. (target_selector_x32): Likewise. * po/POTFILES.in: Regenerated. Signed-off-by: H.J. Lu <[email protected]>
1 parent b8ef160 commit e50c10e

File tree

10 files changed

+20
-1311
lines changed

10 files changed

+20
-1311
lines changed

gold/Makefile.am

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ CCFILES = \
8989
layout.cc \
9090
mapfile.cc \
9191
merge.cc \
92-
nacl.cc \
9392
object.cc \
9493
options.cc \
9594
output.cc \
@@ -138,7 +137,6 @@ HFILES = \
138137
layout.h \
139138
mapfile.h \
140139
merge.h \
141-
nacl.h \
142140
object.h \
143141
options.h \
144142
output.h \

gold/Makefile.in

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,13 @@ am__objects_1 = archive.$(OBJEXT) attributes.$(OBJEXT) \
173173
gdb-index.$(OBJEXT) gold.$(OBJEXT) gold-threads.$(OBJEXT) \
174174
icf.$(OBJEXT) incremental.$(OBJEXT) int_encoding.$(OBJEXT) \
175175
layout.$(OBJEXT) mapfile.$(OBJEXT) merge.$(OBJEXT) \
176-
nacl.$(OBJEXT) object.$(OBJEXT) options.$(OBJEXT) \
177-
output.$(OBJEXT) parameters.$(OBJEXT) plugin.$(OBJEXT) \
178-
readsyms.$(OBJEXT) reduced_debug_output.$(OBJEXT) \
179-
reloc.$(OBJEXT) resolve.$(OBJEXT) script-sections.$(OBJEXT) \
180-
script.$(OBJEXT) stringpool.$(OBJEXT) symtab.$(OBJEXT) \
181-
target.$(OBJEXT) target-select.$(OBJEXT) timer.$(OBJEXT) \
182-
version.$(OBJEXT) workqueue.$(OBJEXT) \
183-
workqueue-threads.$(OBJEXT)
176+
object.$(OBJEXT) options.$(OBJEXT) output.$(OBJEXT) \
177+
parameters.$(OBJEXT) plugin.$(OBJEXT) readsyms.$(OBJEXT) \
178+
reduced_debug_output.$(OBJEXT) reloc.$(OBJEXT) \
179+
resolve.$(OBJEXT) script-sections.$(OBJEXT) script.$(OBJEXT) \
180+
stringpool.$(OBJEXT) symtab.$(OBJEXT) target.$(OBJEXT) \
181+
target-select.$(OBJEXT) timer.$(OBJEXT) version.$(OBJEXT) \
182+
workqueue.$(OBJEXT) workqueue-threads.$(OBJEXT)
184183
am__objects_2 =
185184
am__objects_3 = yyscript.$(OBJEXT)
186185
am_libgold_a_OBJECTS = $(am__objects_1) $(am__objects_2) \
@@ -736,7 +735,6 @@ CCFILES = \
736735
layout.cc \
737736
mapfile.cc \
738737
merge.cc \
739-
nacl.cc \
740738
object.cc \
741739
options.cc \
742740
output.cc \
@@ -785,7 +783,6 @@ HFILES = \
785783
layout.h \
786784
mapfile.h \
787785
merge.h \
788-
nacl.h \
789786
object.h \
790787
options.h \
791788
output.h \
@@ -1113,7 +1110,6 @@ distclean-compile:
11131110
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapfile.Po@am__quote@
11141111
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/merge.Po@am__quote@
11151112
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mips.Po@am__quote@
1116-
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nacl.Po@am__quote@
11171113
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
11181114
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
11191115
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@

gold/aarch64.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include "target-select.h"
4242
#include "tls.h"
4343
#include "freebsd.h"
44-
#include "nacl.h"
4544
#include "gc.h"
4645
#include "icf.h"
4746
#include "aarch64-reloc-property.h"

gold/arm.cc

Lines changed: 3 additions & 227 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#include "gc.h"
5252
#include "attributes.h"
5353
#include "arm-reloc-property.h"
54-
#include "nacl.h"
5554

5655
namespace
5756
{
@@ -12865,8 +12864,7 @@ Target_arm<big_endian>::apply_cortex_a8_workaround(
1286512864
elfcpp::Swap<16, big_endian>::writeval(wv + 1, lower_insn);
1286612865
}
1286712866

12868-
// Target selector for ARM. Note this is never instantiated directly.
12869-
// It's only used in Target_selector_arm_nacl, below.
12867+
// Target selector for ARM.
1287012868

1287112869
template<bool big_endian>
1287212870
class Target_selector_arm : public Target_selector
@@ -13002,229 +13000,7 @@ Target_arm<big_endian>::do_define_standard_symbols(
1300213000
}
1300313001
}
1300413002

13005-
// NaCl variant. It uses different PLT contents.
13006-
13007-
template<bool big_endian>
13008-
class Output_data_plt_arm_nacl;
13009-
13010-
template<bool big_endian>
13011-
class Target_arm_nacl : public Target_arm<big_endian>
13012-
{
13013-
public:
13014-
Target_arm_nacl()
13015-
: Target_arm<big_endian>(&arm_nacl_info)
13016-
{ }
13017-
13018-
protected:
13019-
virtual Output_data_plt_arm<big_endian>*
13020-
do_make_data_plt(
13021-
Layout* layout,
13022-
Arm_output_data_got<big_endian>* got,
13023-
Output_data_space* got_plt,
13024-
Output_data_space* got_irelative)
13025-
{ return new Output_data_plt_arm_nacl<big_endian>(
13026-
layout, got, got_plt, got_irelative); }
13027-
13028-
private:
13029-
static const Target::Target_info arm_nacl_info;
13030-
};
13031-
13032-
template<bool big_endian>
13033-
const Target::Target_info Target_arm_nacl<big_endian>::arm_nacl_info =
13034-
{
13035-
32, // size
13036-
big_endian, // is_big_endian
13037-
elfcpp::EM_ARM, // machine_code
13038-
false, // has_make_symbol
13039-
false, // has_resolve
13040-
false, // has_code_fill
13041-
true, // is_default_stack_executable
13042-
false, // can_icf_inline_merge_sections
13043-
'\0', // wrap_char
13044-
"/lib/ld-nacl-arm.so.1", // dynamic_linker
13045-
0x20000, // default_text_segment_address
13046-
0x10000, // abi_pagesize (overridable by -z max-page-size)
13047-
0x10000, // common_pagesize (overridable by -z common-page-size)
13048-
true, // isolate_execinstr
13049-
0x10000000, // rosegment_gap
13050-
elfcpp::SHN_UNDEF, // small_common_shndx
13051-
elfcpp::SHN_UNDEF, // large_common_shndx
13052-
0, // small_common_section_flags
13053-
0, // large_common_section_flags
13054-
".ARM.attributes", // attributes_section
13055-
"aeabi", // attributes_vendor
13056-
"_start", // entry_symbol_name
13057-
32, // hash_entry_size
13058-
elfcpp::SHT_PROGBITS, // unwind_section_type
13059-
};
13060-
13061-
template<bool big_endian>
13062-
class Output_data_plt_arm_nacl : public Output_data_plt_arm<big_endian>
13063-
{
13064-
public:
13065-
Output_data_plt_arm_nacl(
13066-
Layout* layout,
13067-
Arm_output_data_got<big_endian>* got,
13068-
Output_data_space* got_plt,
13069-
Output_data_space* got_irelative)
13070-
: Output_data_plt_arm<big_endian>(layout, 16, got, got_plt, got_irelative)
13071-
{ }
13072-
13073-
protected:
13074-
// Return the offset of the first non-reserved PLT entry.
13075-
virtual unsigned int
13076-
do_first_plt_entry_offset() const
13077-
{ return sizeof(first_plt_entry); }
13078-
13079-
// Return the size of a PLT entry.
13080-
virtual unsigned int
13081-
do_get_plt_entry_size() const
13082-
{ return sizeof(plt_entry); }
13083-
13084-
virtual void
13085-
do_fill_first_plt_entry(unsigned char* pov,
13086-
Arm_address got_address,
13087-
Arm_address plt_address);
13088-
13089-
virtual void
13090-
do_fill_plt_entry(unsigned char* pov,
13091-
Arm_address got_address,
13092-
Arm_address plt_address,
13093-
unsigned int got_offset,
13094-
unsigned int plt_offset);
13095-
13096-
private:
13097-
inline uint32_t arm_movw_immediate(uint32_t value)
13098-
{
13099-
return (value & 0x00000fff) | ((value & 0x0000f000) << 4);
13100-
}
13101-
13102-
inline uint32_t arm_movt_immediate(uint32_t value)
13103-
{
13104-
return ((value & 0x0fff0000) >> 16) | ((value & 0xf0000000) >> 12);
13105-
}
13106-
13107-
// Template for the first PLT entry.
13108-
static const uint32_t first_plt_entry[16];
13109-
13110-
// Template for subsequent PLT entries.
13111-
static const uint32_t plt_entry[4];
13112-
};
13113-
13114-
// The first entry in the PLT.
13115-
template<bool big_endian>
13116-
const uint32_t Output_data_plt_arm_nacl<big_endian>::first_plt_entry[16] =
13117-
{
13118-
// First bundle:
13119-
0xe300c000, // movw ip, #:lower16:&GOT[2]-.+8
13120-
0xe340c000, // movt ip, #:upper16:&GOT[2]-.+8
13121-
0xe08cc00f, // add ip, ip, pc
13122-
0xe52dc008, // str ip, [sp, #-8]!
13123-
// Second bundle:
13124-
0xe3ccc103, // bic ip, ip, #0xc0000000
13125-
0xe59cc000, // ldr ip, [ip]
13126-
0xe3ccc13f, // bic ip, ip, #0xc000000f
13127-
0xe12fff1c, // bx ip
13128-
// Third bundle:
13129-
0xe320f000, // nop
13130-
0xe320f000, // nop
13131-
0xe320f000, // nop
13132-
// .Lplt_tail:
13133-
0xe50dc004, // str ip, [sp, #-4]
13134-
// Fourth bundle:
13135-
0xe3ccc103, // bic ip, ip, #0xc0000000
13136-
0xe59cc000, // ldr ip, [ip]
13137-
0xe3ccc13f, // bic ip, ip, #0xc000000f
13138-
0xe12fff1c, // bx ip
13139-
};
13140-
13141-
template<bool big_endian>
13142-
void
13143-
Output_data_plt_arm_nacl<big_endian>::do_fill_first_plt_entry(
13144-
unsigned char* pov,
13145-
Arm_address got_address,
13146-
Arm_address plt_address)
13147-
{
13148-
// Write first PLT entry. All but first two words are constants.
13149-
const size_t num_first_plt_words = (sizeof(first_plt_entry)
13150-
/ sizeof(first_plt_entry[0]));
13151-
13152-
int32_t got_displacement = got_address + 8 - (plt_address + 16);
13153-
13154-
elfcpp::Swap<32, big_endian>::writeval
13155-
(pov + 0, first_plt_entry[0] | arm_movw_immediate (got_displacement));
13156-
elfcpp::Swap<32, big_endian>::writeval
13157-
(pov + 4, first_plt_entry[1] | arm_movt_immediate (got_displacement));
13158-
13159-
for (size_t i = 2; i < num_first_plt_words; ++i)
13160-
elfcpp::Swap<32, big_endian>::writeval(pov + i * 4, first_plt_entry[i]);
13161-
}
13162-
13163-
// Subsequent entries in the PLT.
13164-
13165-
template<bool big_endian>
13166-
const uint32_t Output_data_plt_arm_nacl<big_endian>::plt_entry[4] =
13167-
{
13168-
0xe300c000, // movw ip, #:lower16:&GOT[n]-.+8
13169-
0xe340c000, // movt ip, #:upper16:&GOT[n]-.+8
13170-
0xe08cc00f, // add ip, ip, pc
13171-
0xea000000, // b .Lplt_tail
13172-
};
13173-
13174-
template<bool big_endian>
13175-
void
13176-
Output_data_plt_arm_nacl<big_endian>::do_fill_plt_entry(
13177-
unsigned char* pov,
13178-
Arm_address got_address,
13179-
Arm_address plt_address,
13180-
unsigned int got_offset,
13181-
unsigned int plt_offset)
13182-
{
13183-
// Calculate the displacement between the PLT slot and the
13184-
// common tail that's part of the special initial PLT slot.
13185-
int32_t tail_displacement = (plt_address + (11 * sizeof(uint32_t))
13186-
- (plt_address + plt_offset
13187-
+ sizeof(plt_entry) + sizeof(uint32_t)));
13188-
gold_assert((tail_displacement & 3) == 0);
13189-
tail_displacement >>= 2;
13190-
13191-
gold_assert ((tail_displacement & 0xff000000) == 0
13192-
|| (-tail_displacement & 0xff000000) == 0);
13193-
13194-
// Calculate the displacement between the PLT slot and the entry
13195-
// in the GOT. The offset accounts for the value produced by
13196-
// adding to pc in the penultimate instruction of the PLT stub.
13197-
const int32_t got_displacement = (got_address + got_offset
13198-
- (plt_address + sizeof(plt_entry)));
13199-
13200-
elfcpp::Swap<32, big_endian>::writeval
13201-
(pov + 0, plt_entry[0] | arm_movw_immediate (got_displacement));
13202-
elfcpp::Swap<32, big_endian>::writeval
13203-
(pov + 4, plt_entry[1] | arm_movt_immediate (got_displacement));
13204-
elfcpp::Swap<32, big_endian>::writeval
13205-
(pov + 8, plt_entry[2]);
13206-
elfcpp::Swap<32, big_endian>::writeval
13207-
(pov + 12, plt_entry[3] | (tail_displacement & 0x00ffffff));
13208-
}
13209-
13210-
// Target selectors.
13211-
13212-
template<bool big_endian>
13213-
class Target_selector_arm_nacl
13214-
: public Target_selector_nacl<Target_selector_arm<big_endian>,
13215-
Target_arm_nacl<big_endian> >
13216-
{
13217-
public:
13218-
Target_selector_arm_nacl()
13219-
: Target_selector_nacl<Target_selector_arm<big_endian>,
13220-
Target_arm_nacl<big_endian> >(
13221-
"arm",
13222-
big_endian ? "elf32-bigarm-nacl" : "elf32-littlearm-nacl",
13223-
big_endian ? "armelfb_nacl" : "armelf_nacl")
13224-
{ }
13225-
};
13226-
13227-
Target_selector_arm_nacl<false> target_selector_arm;
13228-
Target_selector_arm_nacl<true> target_selector_armbe;
13003+
Target_selector_arm<false> target_selector_arm;
13004+
Target_selector_arm<true> target_selector_armbe;
1322913005

1323013006
} // End anonymous namespace.

0 commit comments

Comments
 (0)