mirror of
https://github.com/devkitPro/buildscripts.git
synced 2026-05-05 20:36:22 -05:00
devkitPPC: binutils 2.46, gcc 16.1.0
This commit is contained in:
parent
174e0edc3f
commit
eedcd788e7
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
#---------------------------------------------------------------------------------
|
||||
# devkitARM release 67.2
|
||||
# devkitPPC release 49.2
|
||||
# devkitPPC release 50
|
||||
# devkitA64 release 29.2
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
539
patches/binutils-2.46-1.patch
Normal file
539
patches/binutils-2.46-1.patch
Normal file
|
|
@ -0,0 +1,539 @@
|
|||
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
|
||||
index dbf53756200..087ea660042 100644
|
||||
--- a/bfd/elf-bfd.h
|
||||
+++ b/bfd/elf-bfd.h
|
||||
@@ -2070,6 +2070,14 @@ struct output_elf_obj_tdata
|
||||
asection *sec;
|
||||
} package_metadata;
|
||||
|
||||
+ /* Data for .nx-module-name. */
|
||||
+ struct
|
||||
+ {
|
||||
+ bool (*after_write_object_contents) (bfd *);
|
||||
+ const char *name;
|
||||
+ asection *sec;
|
||||
+ } nx_module_name;
|
||||
+
|
||||
/* Records the result of `get_program_header_size'. */
|
||||
bfd_size_type program_header_size;
|
||||
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
index 1177c3c3016..0cfd60b9426 100644
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -7288,6 +7288,14 @@ _bfd_elf_write_object_contents (bfd *abfd)
|
||||
if (!bed->s->write_shdrs_and_ehdr (abfd))
|
||||
return false;
|
||||
|
||||
+ /* Write out the NX module name. */
|
||||
+ if (t->o->nx_module_name.after_write_object_contents != NULL)
|
||||
+ {
|
||||
+ failed = !(*t->o->nx_module_name.after_write_object_contents) (abfd);
|
||||
+ if (failed)
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
/* This is last since write_shdrs_and_ehdr can touch i_shdrp[0]. */
|
||||
if (t->o->build_id.after_write_object_contents != NULL
|
||||
&& !(*t->o->build_id.after_write_object_contents) (abfd))
|
||||
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
|
||||
index 1ba7dd393e6..04f837e2140 100644
|
||||
--- a/bfd/elfnn-aarch64.c
|
||||
+++ b/bfd/elfnn-aarch64.c
|
||||
@@ -2444,6 +2444,12 @@ enum elf_aarch64_stub_type
|
||||
aarch64_stub_erratum_843419_veneer,
|
||||
};
|
||||
|
||||
+/* Is an undefined weak symbol resolved to 0 ? */
|
||||
+#define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, EH) \
|
||||
+ ((EH)->root.root.type == bfd_link_hash_undefweak \
|
||||
+ && bfd_link_executable (INFO) \
|
||||
+ && !(INFO)->dynamic_undefined_weak)
|
||||
+
|
||||
struct elf_aarch64_stub_hash_entry
|
||||
{
|
||||
/* Base hash table entry structure. */
|
||||
@@ -7054,11 +7060,13 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
|
||||
Elf_Internal_Sym *sym;
|
||||
asection *sec;
|
||||
struct elf_link_hash_entry *h;
|
||||
+ struct elf_aarch64_link_hash_entry *eh;
|
||||
bfd_vma relocation;
|
||||
bfd_reloc_status_type r;
|
||||
arelent bfd_reloc;
|
||||
char sym_type;
|
||||
bool unresolved_reloc = false;
|
||||
+ bool resolved_to_zero = false;
|
||||
char *error_message = NULL;
|
||||
|
||||
r_symndx = ELFNN_R_SYM (rel->r_info);
|
||||
@@ -7199,6 +7207,10 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
|
||||
h, &unresolved_reloc,
|
||||
save_addend, &addend, sym);
|
||||
|
||||
+ eh = (struct elf_aarch64_link_hash_entry *) h;
|
||||
+ resolved_to_zero = (eh != NULL
|
||||
+ && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh));
|
||||
+
|
||||
switch (elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type))
|
||||
{
|
||||
case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
|
||||
@@ -7222,7 +7234,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
|
||||
need_relocs =
|
||||
(!bfd_link_executable (info) || indx != 0) &&
|
||||
(h == NULL
|
||||
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero)
|
||||
|| h->root.type != bfd_link_hash_undefweak);
|
||||
|
||||
BFD_ASSERT (globals->root.srelgot != NULL);
|
||||
@@ -7317,7 +7329,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
|
||||
need_relocs =
|
||||
(!bfd_link_executable (info) || indx != 0) &&
|
||||
(h == NULL
|
||||
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero)
|
||||
|| h->root.type != bfd_link_hash_undefweak);
|
||||
|
||||
BFD_ASSERT (globals->root.srelgot != NULL);
|
||||
@@ -7366,7 +7378,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
|
||||
bfd_vma off = symbol_tlsdesc_got_offset (input_bfd, h, r_symndx);
|
||||
|
||||
need_relocs = (h == NULL
|
||||
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero)
|
||||
|| h->root.type != bfd_link_hash_undefweak);
|
||||
|
||||
BFD_ASSERT (globals->root.srelgot != NULL);
|
||||
@@ -7692,6 +7704,23 @@ need_copy_relocation_p (struct elf_aarch64_link_hash_entry *eh)
|
||||
return false;
|
||||
}
|
||||
|
||||
+/* Remove undefined weak symbol from the dynamic symbol table if it
|
||||
+ is resolved to 0. */
|
||||
+
|
||||
+static bool
|
||||
+elfNN_aarch64_elf_fixup_symbol (struct bfd_link_info *info,
|
||||
+ struct elf_link_hash_entry *h)
|
||||
+{
|
||||
+ if (h->dynindx != -1
|
||||
+ && UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, elf_aarch64_hash_entry (h)))
|
||||
+ {
|
||||
+ h->dynindx = -1;
|
||||
+ _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
|
||||
+ h->dynstr_index);
|
||||
+ }
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
/* Adjust a symbol defined by a dynamic object and referenced by a
|
||||
regular object. The current definition is in some section of the
|
||||
dynamic object, but we're not including those sections. We have to
|
||||
@@ -8797,6 +8826,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
struct elf_aarch64_link_hash_table *htab;
|
||||
struct elf_aarch64_link_hash_entry *eh;
|
||||
struct elf_dyn_relocs *p;
|
||||
+ bool resolved_to_zero;
|
||||
|
||||
/* An example of a bfd_link_hash_indirect symbol is versioned
|
||||
symbol. For example: __gxx_personality_v0(bfd_link_hash_indirect)
|
||||
@@ -8816,6 +8846,10 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
info = (struct bfd_link_info *) inf;
|
||||
htab = elf_aarch64_hash_table (info);
|
||||
|
||||
+ eh = (struct elf_aarch64_link_hash_entry *) h;
|
||||
+ eh->tlsdesc_got_jump_table_offset = (bfd_vma) - 1;
|
||||
+ resolved_to_zero = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh);
|
||||
+
|
||||
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle it
|
||||
here if it is defined and referenced in a non-shared object. */
|
||||
if (h->type == STT_GNU_IFUNC
|
||||
@@ -8825,7 +8859,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
{
|
||||
/* Make sure this symbol is output as a dynamic symbol.
|
||||
Undefined weak syms won't yet be marked as dynamic. */
|
||||
- if (h->dynindx == -1 && !h->forced_local
|
||||
+ if (h->dynindx == -1 && !h->forced_local && !resolved_to_zero
|
||||
&& h->root.type == bfd_link_hash_undefweak)
|
||||
{
|
||||
if (!bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
@@ -8859,6 +8893,11 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
of relaxing into these from the large model PLT entries. */
|
||||
s->size += htab->plt_entry_size;
|
||||
|
||||
+ /* There should be no PLT relocations against resolved undefined
|
||||
+ weak symbols in the executable. */
|
||||
+ if (!resolved_to_zero)
|
||||
+ {
|
||||
+
|
||||
/* We also need to make an entry in the .got.plt section, which
|
||||
will be placed in the .got section by the linker script. */
|
||||
htab->root.sgotplt->size += GOT_ENTRY_SIZE;
|
||||
@@ -8887,6 +8926,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
htab->variant_pcs = 1;
|
||||
|
||||
}
|
||||
+ }
|
||||
else
|
||||
{
|
||||
h->plt.offset = (bfd_vma) - 1;
|
||||
@@ -8899,9 +8939,6 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
h->needs_plt = 0;
|
||||
}
|
||||
|
||||
- eh = (struct elf_aarch64_link_hash_entry *) h;
|
||||
- eh->tlsdesc_got_jump_table_offset = (bfd_vma) - 1;
|
||||
-
|
||||
if (h->got.refcount > 0)
|
||||
{
|
||||
bool dyn;
|
||||
@@ -8913,7 +8950,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
|
||||
/* Make sure this symbol is output as a dynamic symbol.
|
||||
Undefined weak syms won't yet be marked as dynamic. */
|
||||
- if (dyn && h->dynindx == -1 && !h->forced_local
|
||||
+ if (dyn && h->dynindx == -1 && !h->forced_local && !resolved_to_zero
|
||||
&& h->root.type == bfd_link_hash_undefweak)
|
||||
{
|
||||
if (!bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
@@ -8927,7 +8964,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
{
|
||||
h->got.offset = htab->root.sgot->size;
|
||||
htab->root.sgot->size += GOT_ENTRY_SIZE;
|
||||
- if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
+ if (((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero)
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
|
||||
@@ -8963,7 +9000,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
}
|
||||
|
||||
indx = h && h->dynindx != -1 ? h->dynindx : 0;
|
||||
- if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
+ if (((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && !resolved_to_zero)
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (!bfd_link_executable (info)
|
||||
|| indx != 0
|
||||
@@ -9045,7 +9082,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
visibility. */
|
||||
if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak)
|
||||
{
|
||||
- if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT || resolved_to_zero
|
||||
|| UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
|
||||
h->dyn_relocs = NULL;
|
||||
|
||||
@@ -9065,7 +9102,9 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
symbols which turn out to need copy relocs or are not
|
||||
dynamic. */
|
||||
|
||||
- if (!h->non_got_ref
|
||||
+ if (!(h->non_got_ref
|
||||
+ || (h->root.type == bfd_link_hash_undefweak
|
||||
+ && !resolved_to_zero))
|
||||
&& ((h->def_dynamic
|
||||
&& !h->def_regular)
|
||||
|| (htab->root.dynamic_sections_created
|
||||
@@ -9076,6 +9115,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
Undefined weak syms won't yet be marked as dynamic. */
|
||||
if (h->dynindx == -1
|
||||
&& !h->forced_local
|
||||
+ && !resolved_to_zero
|
||||
&& h->root.type == bfd_link_hash_undefweak
|
||||
&& !bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return false;
|
||||
@@ -10046,8 +10086,17 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
Elf_Internal_Sym *sym)
|
||||
{
|
||||
struct elf_aarch64_link_hash_table *htab;
|
||||
+ struct elf_aarch64_link_hash_entry *eh;
|
||||
+ bool local_undefweak;
|
||||
htab = elf_aarch64_hash_table (info);
|
||||
|
||||
+ eh = (struct elf_aarch64_link_hash_entry *) h;
|
||||
+
|
||||
+ /* We keep PLT/GOT entries without dynamic PLT/GOT relocations for
|
||||
+ resolved undefined weak symbols in executable so that their
|
||||
+ references have value 0 at run-time. */
|
||||
+ local_undefweak = UNDEFINED_WEAK_RESOLVED_TO_ZERO (info, eh);
|
||||
+
|
||||
if (h->plt.offset != (bfd_vma) - 1)
|
||||
{
|
||||
asection *plt, *gotplt, *relplt;
|
||||
@@ -10082,7 +10131,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
abort ();
|
||||
|
||||
elfNN_aarch64_create_small_pltn_entry (h, htab, output_bfd, info);
|
||||
- if (!h->def_regular)
|
||||
+ if (!local_undefweak && !h->def_regular)
|
||||
{
|
||||
/* Mark the symbol as undefined, rather than as defined in
|
||||
the .plt section. */
|
||||
@@ -10104,7 +10153,8 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
&& elf_aarch64_hash_entry (h)->got_type == GOT_NORMAL
|
||||
/* Undefined weak symbol in static PIE resolves to 0 without
|
||||
any dynamic relocations. */
|
||||
- && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
|
||||
+ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)
|
||||
+ && !local_undefweak)
|
||||
{
|
||||
Elf_Internal_Rela rela;
|
||||
bfd_byte *loc;
|
||||
@@ -10811,6 +10861,9 @@ static const struct elf_size_info elfNN_aarch64_size_info =
|
||||
#define elf_backend_init_index_section \
|
||||
_bfd_elf_init_2_index_sections
|
||||
|
||||
+#define elf_backend_fixup_symbol \
|
||||
+ elfNN_aarch64_elf_fixup_symbol
|
||||
+
|
||||
#define elf_backend_finish_dynamic_sections \
|
||||
elfNN_aarch64_finish_dynamic_sections
|
||||
|
||||
diff --git a/ld/emulparams/aarch64elf.sh b/ld/emulparams/aarch64elf.sh
|
||||
index aa051c76a7a..073d3a47b65 100644
|
||||
--- a/ld/emulparams/aarch64elf.sh
|
||||
+++ b/ld/emulparams/aarch64elf.sh
|
||||
@@ -1,4 +1,5 @@
|
||||
source_sh ${srcdir}/emulparams/dt-relr.sh
|
||||
+source_sh ${srcdir}/emulparams/dynamic_undefined_weak.sh
|
||||
|
||||
ARCH=aarch64
|
||||
MACHINE=
|
||||
diff --git a/ld/emulparams/aarch64elf32.sh b/ld/emulparams/aarch64elf32.sh
|
||||
index 0565b7a066c..64821b1fc31 100644
|
||||
--- a/ld/emulparams/aarch64elf32.sh
|
||||
+++ b/ld/emulparams/aarch64elf32.sh
|
||||
@@ -1,4 +1,5 @@
|
||||
source_sh ${srcdir}/emulparams/dt-relr.sh
|
||||
+source_sh ${srcdir}/emulparams/dynamic_undefined_weak.sh
|
||||
|
||||
ARCH="aarch64:ilp32"
|
||||
MACHINE=
|
||||
diff --git a/ld/emulparams/elf32ppccommon.sh b/ld/emulparams/elf32ppccommon.sh
|
||||
index da892988f5d..6b8efb9bbdb 100644
|
||||
--- a/ld/emulparams/elf32ppccommon.sh
|
||||
+++ b/ld/emulparams/elf32ppccommon.sh
|
||||
@@ -23,7 +23,7 @@ else
|
||||
unset SBSS_START_SYMBOLS
|
||||
unset SBSS_END_SYMBOLS
|
||||
fi
|
||||
-OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end = .${CREATE_SHLIB+)};"
|
||||
+OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end = .${CREATE_SHLIB+)};${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
|
||||
OTHER_RELRO_SECTIONS="
|
||||
.fixup ${RELOCATING-0} : { *(.fixup) }
|
||||
.got1 ${RELOCATING-0} : { *(.got1) }
|
||||
diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
|
||||
index 5ddbed99724..2891f84ebdb 100644
|
||||
--- a/ld/emultempl/aarch64elf.em
|
||||
+++ b/ld/emultempl/aarch64elf.em
|
||||
@@ -490,7 +490,7 @@ PARSE_AND_LIST_LONGOPTS='
|
||||
{ "discard-sframe", no_argument, NULL, OPTION_DISCARD_SFRAME},
|
||||
'
|
||||
|
||||
-PARSE_AND_LIST_OPTIONS='
|
||||
+PARSE_AND_LIST_OPTIONS=${PARSE_AND_LIST_OPTIONS}'
|
||||
fprintf (file, _(" --no-enum-size-warning Don'\''t warn about objects with incompatible\n"
|
||||
" enum sizes\n"));
|
||||
fprintf (file, _(" --no-wchar-size-warning Don'\''t warn about objects with incompatible\n"
|
||||
diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
|
||||
index 37bdfff051c..14f4bd6e8c6 100644
|
||||
--- a/ld/emultempl/elf.em
|
||||
+++ b/ld/emultempl/elf.em
|
||||
@@ -814,6 +814,7 @@ EOF
|
||||
fi
|
||||
fragment <<EOF
|
||||
{"build-id", optional_argument, NULL, OPTION_BUILD_ID},
|
||||
+ {"nx-module-name", optional_argument, NULL, OPTION_NX_MODULE_NAME},
|
||||
{"package-metadata", optional_argument, NULL, OPTION_PACKAGE_METADATA},
|
||||
{"compress-debug-sections", required_argument, NULL, OPTION_COMPRESS_DEBUG},
|
||||
{"rosegment", no_argument, NULL, OPTION_ROSEGMENT},
|
||||
@@ -901,6 +902,18 @@ gld${EMULATION_NAME}_handle_option (int optc)
|
||||
case OPTION_NO_ROSEGMENT:
|
||||
link_info.one_rosegment = false;
|
||||
break;
|
||||
+
|
||||
+ case OPTION_NX_MODULE_NAME:
|
||||
+ if (ldelf_emit_nx_module_name != NULL)
|
||||
+ {
|
||||
+ free ((char *) ldelf_emit_nx_module_name);
|
||||
+ ldelf_emit_nx_module_name = NULL;
|
||||
+ }
|
||||
+ if (optarg == NULL)
|
||||
+ optarg = "";
|
||||
+ ldelf_emit_nx_module_name = xstrdup (optarg);
|
||||
+ break;
|
||||
+
|
||||
EOF
|
||||
|
||||
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
|
||||
diff --git a/ld/ldelf.c b/ld/ldelf.c
|
||||
index a623d37c4d0..1434a643db5 100644
|
||||
--- a/ld/ldelf.c
|
||||
+++ b/ld/ldelf.c
|
||||
@@ -55,6 +55,9 @@ const char *ldelf_emit_note_gnu_build_id;
|
||||
/* Content of .note.package section. */
|
||||
const char *ldelf_emit_note_fdo_package_metadata;
|
||||
|
||||
+/* NX module name. */
|
||||
+const char *ldelf_emit_nx_module_name;
|
||||
+
|
||||
/* These variables are required to pass information back and forth
|
||||
between after_open and check_needed and stat_needed and vercheck. */
|
||||
|
||||
@@ -1213,8 +1216,93 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
|
||||
*save_input_bfd_tail = NULL;
|
||||
}
|
||||
|
||||
-/* This is called before calling plugin 'all symbols read' hook. */
|
||||
+static bool
|
||||
+write_nx_module_name (bfd *abfd)
|
||||
+{
|
||||
+ struct elf_obj_tdata *t = elf_tdata (abfd);
|
||||
+ const char *name;
|
||||
+ asection *asec;
|
||||
+ Elf_Internal_Shdr *i_shdr;
|
||||
+ unsigned char *contents;
|
||||
+ bfd_size_type size;
|
||||
+ file_ptr position;
|
||||
+
|
||||
+ name = t->o->nx_module_name.name;
|
||||
+ asec = t->o->nx_module_name.sec;
|
||||
+ if (bfd_is_abs_section (asec->output_section))
|
||||
+ {
|
||||
+ einfo (_("%P: warning: .nx-module-name section discarded,"
|
||||
+ " --build-id ignored\n"));
|
||||
+ return true;
|
||||
+ }
|
||||
+ i_shdr = &elf_section_data (asec->output_section)->this_hdr;
|
||||
+
|
||||
+ if (i_shdr->contents == NULL)
|
||||
+ {
|
||||
+ if (asec->contents == NULL)
|
||||
+ asec->contents = (unsigned char *) xmalloc (asec->size);
|
||||
+ contents = asec->contents;
|
||||
+ }
|
||||
+ else
|
||||
+ contents = i_shdr->contents + asec->output_offset;
|
||||
+
|
||||
+ size = asec->size;
|
||||
+ bfd_h_put_32 (abfd, 0, &contents[0]);
|
||||
+ bfd_h_put_32 (abfd, size - 9, &contents[4]);
|
||||
+ memcpy (&contents[8], name, size - 9);
|
||||
+ contents[size - 1] = 0; /* ensure null termination for AMS */
|
||||
+
|
||||
+ position = i_shdr->sh_offset + asec->output_offset;
|
||||
+
|
||||
+ return (bfd_seek (abfd, position, SEEK_SET) == 0
|
||||
+ && bfd_write (contents, size, abfd) == size);
|
||||
+}
|
||||
|
||||
+/* Make .nx-module-name section, and set up elf_tdata->nx_module_name. */
|
||||
+
|
||||
+static bool
|
||||
+setup_nx_module_name (bfd *ibfd, bfd *obfd)
|
||||
+{
|
||||
+ asection *s;
|
||||
+ bfd_size_type size;
|
||||
+ flagword flags;
|
||||
+
|
||||
+ if (ldelf_emit_nx_module_name[0] == '\0')
|
||||
+ {
|
||||
+ /* Extract the basename of the output bfd and use it as the module name. */
|
||||
+ char *dot_pos;
|
||||
+ free ((char *) ldelf_emit_nx_module_name);
|
||||
+ ldelf_emit_nx_module_name = (char *) lbasename (bfd_get_filename (obfd));
|
||||
+ ldelf_emit_nx_module_name = xstrdup (ldelf_emit_nx_module_name);
|
||||
+ dot_pos = strrchr (ldelf_emit_nx_module_name, '.');
|
||||
+ if (dot_pos != NULL)
|
||||
+ {
|
||||
+ /* Remove extension. */
|
||||
+ *dot_pos = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ size = 8 + strlen(ldelf_emit_nx_module_name) + 1; /* extra null terminator for AMS */
|
||||
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY
|
||||
+ | SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA);
|
||||
+ s = bfd_make_section_with_flags (ibfd, ".nx-module-name", flags);
|
||||
+ if (s != NULL && bfd_set_section_alignment (s, 4))
|
||||
+ {
|
||||
+ struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd);
|
||||
+ t->o->nx_module_name.after_write_object_contents = &write_nx_module_name;
|
||||
+ t->o->nx_module_name.name = ldelf_emit_nx_module_name;
|
||||
+ t->o->nx_module_name.sec = s;
|
||||
+ elf_section_type (s) = SHT_PROGBITS;
|
||||
+ s->size = size;
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ einfo (_("%P: warning: cannot create .nx-module-name section,"
|
||||
+ " --nx-module-name ignored\n"));
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+/* This is called before calling plugin 'all symbols read' hook. */
|
||||
void
|
||||
ldelf_before_plugin_all_symbols_read (int use_libpath, int native,
|
||||
int is_linux, int is_freebsd,
|
||||
@@ -1291,6 +1379,24 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
|
||||
}
|
||||
}
|
||||
|
||||
+ if (ldelf_emit_nx_module_name != NULL)
|
||||
+ {
|
||||
+ /* Find an ELF input. */
|
||||
+ for (abfd = link_info.input_bfds;
|
||||
+ abfd != (bfd *) NULL; abfd = abfd->link.next)
|
||||
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
|
||||
+ && bfd_count_sections (abfd) != 0
|
||||
+ && !((lang_input_statement_type *) abfd->usrdata)->flags.just_syms)
|
||||
+ break;
|
||||
+
|
||||
+ /* If there are no ELF input files do not try to create a .nx-module-name section. */
|
||||
+ if (abfd == NULL || !setup_nx_module_name (abfd, link_info.output_bfd))
|
||||
+ {
|
||||
+ free ((char *) ldelf_emit_nx_module_name);
|
||||
+ ldelf_emit_nx_module_name = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
get_elf_backend_data (link_info.output_bfd)->setup_object_attributes (&link_info);
|
||||
get_elf_backend_data (link_info.output_bfd)->setup_gnu_properties (&link_info);
|
||||
|
||||
diff --git a/ld/ldelf.h b/ld/ldelf.h
|
||||
index 2bb2a3fb774..cd4385c056b 100644
|
||||
--- a/ld/ldelf.h
|
||||
+++ b/ld/ldelf.h
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
extern const char *ldelf_emit_note_gnu_build_id;
|
||||
extern const char *ldelf_emit_note_fdo_package_metadata;
|
||||
+extern const char *ldelf_emit_nx_module_name;
|
||||
|
||||
extern void ldelf_finish (void);
|
||||
extern void ldelf_after_parse (void);
|
||||
diff --git a/ld/ldlex.h b/ld/ldlex.h
|
||||
index 85e06b6fcc4..27243a47459 100644
|
||||
--- a/ld/ldlex.h
|
||||
+++ b/ld/ldlex.h
|
||||
@@ -186,6 +186,7 @@ enum option_values
|
||||
/* Used by emultempl/elf.em, emultempl/pe.em and emultempl/pep.em. */
|
||||
OPTION_BUILD_ID,
|
||||
OPTION_EXCLUDE_LIBS,
|
||||
+ OPTION_NX_MODULE_NAME,
|
||||
/* Used by emulparams/elf32mcore.sh, emultempl/beos.em, emultempl/pe.em
|
||||
and emultempl/pep.em. */
|
||||
OPTION_BASE_FILE,
|
||||
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
|
||||
index dfc6734e027..0b61a0612f6 100644
|
||||
--- a/opcodes/ppc-opc.c
|
||||
+++ b/opcodes/ppc-opc.c
|
||||
@@ -5123,7 +5123,7 @@ const unsigned int num_powerpc_operands = ARRAY_SIZE (powerpc_operands);
|
||||
#define MFDEC2 (PPC_OPCODE_PPC | PPC_OPCODE_601 | PPC_OPCODE_BOOKE \
|
||||
| PPC_OPCODE_TITAN)
|
||||
#define BOOKE PPC_OPCODE_BOOKE
|
||||
-#define NO371 PPC_OPCODE_BOOKE | PPC_OPCODE_PPCPS | PPC_OPCODE_EFS
|
||||
+#define NO371 PPC_OPCODE_BOOKE | PPC_OPCODE_EFS
|
||||
#define PPCE300 PPC_OPCODE_E300
|
||||
#define PPCSPE PPC_OPCODE_SPE
|
||||
#define PPCSPE2 PPC_OPCODE_SPE2
|
||||
1090
patches/gcc-16.1.0-1.patch
Normal file
1090
patches/gcc-16.1.0-1.patch
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -29,6 +29,7 @@ do
|
|||
done
|
||||
|
||||
case "$VERSION" in
|
||||
# devkitARM
|
||||
"1" )
|
||||
BINUTILS_VER=2.45.1
|
||||
GCC_VER=15.2.0
|
||||
|
|
@ -45,13 +46,14 @@ case "$VERSION" in
|
|||
_rules_ver=${DKARM_RULES_VER}
|
||||
_crtls_ver=${DKARM_CRTLS_VER}
|
||||
;;
|
||||
# devkitPPC
|
||||
"2" )
|
||||
BINUTILS_VER=2.45.1
|
||||
GCC_VER=15.2.0
|
||||
BINUTILS_VER=2.46.0
|
||||
GCC_VER=16.1.0
|
||||
MN_BINUTILS_VER=2.24
|
||||
NEWLIB_VER=4.6.0.20260123
|
||||
BINUTILS_PKGREL=2
|
||||
GCC_PKGREL=7
|
||||
BINUTILS_PKGREL=1
|
||||
GCC_PKGREL=1
|
||||
NEWLIB_PKGREL=4
|
||||
basedir='dkppc'
|
||||
package=devkitPPC
|
||||
|
|
@ -63,6 +65,7 @@ case "$VERSION" in
|
|||
_rules_ver=${DKPPC_RULES_VER}
|
||||
_crtls_ver=${DKPPC_CRTLS_VER}
|
||||
;;
|
||||
# devkitA64
|
||||
"3" )
|
||||
GCC_VER=15.2.0
|
||||
BINUTILS_VER=2.45.1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user