if (htab->root.dynamic_sections_created)
{
+ const char *name;
ElfNN_External_Dyn *dyncon, *dynconend;
if (sdyn == NULL || htab->root.sgot == NULL)
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
+ htab->root.tlsdesc_got;
break;
+
+ /* Set the bottom bit of DT_INIT/FINI if the
+ corresponding function is C64. */
+ case DT_INIT:
+ name = info->init_function;
+ goto get_sym;
+ case DT_FINI:
+ name = info->fini_function;
+get_sym:
+ /* If it wasn't set by elf_bfd_final_link
+ then there is nothing to adjust. */
+ if (dyn.d_un.d_val != 0)
+ {
+ struct elf_link_hash_entry * eh;
+
+ eh = elf_link_hash_lookup (elf_hash_table (info), name,
+ FALSE, FALSE, TRUE);
+ if (eh != NULL)
+ dyn.d_un.d_val |= eh->target_internal;
+ }
+ break;
}
bfd_elfNN_swap_dyn_out (output_bfd, &dyn, dyncon);
run_dump_test_lp64 "morello-disallow-merged-binaries"
run_dump_test_lp64 "c64-ehdr-sized-reloc"
+run_dump_test_lp64 "morello-dt-init-fini"
run_dump_test_lp64 "morello-capinit"
run_dump_test_lp64 "morello-stubs"
run_dump_test_lp64 "morello-stubs-static"
--- /dev/null
+# Checking that the DT_INIT and DT_FINI entries in the dynamic section include
+# the LSB when referring to functions which include the LSB.
+#as: -march=morello+c64
+#ld: -shared
+#readelf: --symbols --dynamic --wide
+
+Dynamic section at offset .*
+ Tag Type Name/Value
+#record: INIT_LOC
+#...
+ 0x000000000000000c \(INIT\) 0x([0-9a-f]+)
+#record: FINI_LOC
+#...
+ 0x000000000000000d \(FINI\) 0x([0-9a-f]+)
+#...
+Symbol table '.symtab' contains 18 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+#check: INIT_ADDR string tolower $INIT_LOC
+#check: FINI_ADDR string tolower $FINI_LOC
+#...
+.*: 0+INIT_ADDR 0 FUNC LOCAL DEFAULT .* _init
+.*: 0+FINI_ADDR 0 FUNC LOCAL DEFAULT .* _fini
+#pass
--- /dev/null
+ .section .init,"ax",%progbits
+ .global _init
+ .hidden _init
+ .type _init, %function
+_init:
+ ret
+
+ .section .fini,"ax",%progbits
+ .global _fini
+ .hidden _fini
+ .type _fini, %function
+_fini:
+ ret