From 3dbcc61de69ac77c852c865edb2720bc45e13d86 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 7 Sep 2010 15:02:17 +0000 Subject: [PATCH] * ldwrite.c (clone_section): Call bfd_copy_private_section_data on newly cloned section. * ld-x86-64/split-by-file.rd: New test. * ld-x86-64/split-by-file1.s: New test source code. * ld-x86-64/split-by-file2.s: New test source code. * ld-x86-64/x86-64.exp: Run the new test. * readelf.c (process_section_headers): Mention meaning of 'l' section flag for x86-64 targets. --- binutils/ChangeLog | 5 +++++ binutils/readelf.c | 11 ++++++++++- ld/ChangeLog | 5 +++++ ld/ldwrite.c | 7 +++++-- ld/testsuite/ChangeLog | 7 +++++++ ld/testsuite/ld-x86-64/split-by-file.rd | 17 +++++++++++++++++ ld/testsuite/ld-x86-64/x86-64.exp | 3 +++ 7 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 ld/testsuite/ld-x86-64/split-by-file.rd diff --git a/binutils/ChangeLog b/binutils/ChangeLog index fa83d02504a..d42141eadb2 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2010-09-07 Nick Clifton + + * readelf.c (process_section_headers): Mention meaning of 'l' + section flag for x86-64 targets. + 2010-09-03 Jan Kratochvil Jakub Jelinek diff --git a/binutils/readelf.c b/binutils/readelf.c index b345afb5027..b91c5ba7144 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -4861,10 +4861,19 @@ process_section_headers (FILE * file) } if (!do_section_details) - printf (_("Key to Flags:\n\ + { + if (elf_header.e_machine == EM_X86_64 + || elf_header.e_machine == EM_L1OM) + printf (_("Key to Flags:\n\ + W (write), A (alloc), X (execute), M (merge), S (strings), l (large)\n\ + I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)\n\ + O (extra OS processing required) o (OS specific), p (processor specific)\n")); + else + printf (_("Key to Flags:\n\ W (write), A (alloc), X (execute), M (merge), S (strings)\n\ I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)\n\ O (extra OS processing required) o (OS specific), p (processor specific)\n")); + } return 1; } diff --git a/ld/ChangeLog b/ld/ChangeLog index 43858f4e967..2c547c5b891 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2010-09-07 Andrew Burgess + + * ldwrite.c (clone_section): Call bfd_copy_private_section_data on + newly cloned section. + 2010-09-02 Richard Henderson * configure.tgt (x86_64-*-mingw*): Add 32-bit pe emulations too. diff --git a/ld/ldwrite.c b/ld/ldwrite.c index 2ff95472d63..7eb8b2b01d3 100644 --- a/ld/ldwrite.c +++ b/ld/ldwrite.c @@ -358,7 +358,7 @@ clone_section (bfd *abfd, asection *s, const char *name, int *count) } tname[5] = 0; } - + if ((sname = bfd_get_unique_section_name (abfd, tname, count)) == NULL || (n = bfd_make_section_anyway (abfd, sname)) == NULL || (h = bfd_link_hash_lookup (link_info.hash, @@ -369,7 +369,7 @@ clone_section (bfd *abfd, asection *s, const char *name, int *count) return NULL; } free (tname); - + /* Set up section symbol. */ h->type = bfd_link_hash_defined; h->u.def.value = 0; @@ -385,6 +385,9 @@ clone_section (bfd *abfd, asection *s, const char *name, int *count) n->orelocation = 0; n->reloc_count = 0; n->alignment_power = s->alignment_power; + + bfd_copy_private_section_data (abfd, s, abfd, n); + return n; } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index aee11147f21..5730d8c5751 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2010-09-07 Andrew Burgess + + * ld-x86-64/split-by-file.rd: New test. + * ld-x86-64/split-by-file1.s: New test source code. + * ld-x86-64/split-by-file2.s: New test source code. + * ld-x86-64/x86-64.exp: Run the new test. + 2010-08-31 Nick Clifton * ld-scripts/section-match.exp: New file. Runs the diff --git a/ld/testsuite/ld-x86-64/split-by-file.rd b/ld/testsuite/ld-x86-64/split-by-file.rd new file mode 100644 index 00000000000..7c63aaa1a68 --- /dev/null +++ b/ld/testsuite/ld-x86-64/split-by-file.rd @@ -0,0 +1,17 @@ +There are 9 section headers, starting at offset 0x80: + +Section Headers: + \[Nr\] Name Type Address Off Size ES Flg Lk Inf Al + \[ 0\] NULL 0000000000000000 000000 000000 00 0 0 0 + \[ 1\] .text PROGBITS 0000000000000000 000040 000000 00 AX 0 0 4 + \[ 2\] .foo PROGBITS 0000000000000000 000040 000003 00 AXl 0 0 1 + \[ 3\] .data PROGBITS 0000000000000000 000044 000000 00 WA 0 0 4 + \[ 4\] .bss NOBITS 0000000000000000 000044 000000 00 WA 0 0 4 + \[ 5\] .foo.0 PROGBITS 0000000000000003 000044 000003 00 AXl 0 0 1 + \[ 6\] .shstrtab STRTAB 0000000000000000 000047 000038 00 0 0 1 + \[ 7\] .symtab SYMTAB 0000000000000000 0002c0 0000d8 18 8 6 8 + \[ 8\] .strtab STRTAB 0000000000000000 000398 000016 00 0 0 1 +Key to Flags: + W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\), l \(large\) + I \(info\), L \(link order\), G \(group\), T \(TLS\), E \(exclude\), x \(unknown\) + O \(extra OS processing required\) o \(OS specific\), p \(processor specific\) diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 261b2d1da46..1d3d67e4f51 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -83,6 +83,9 @@ set x86_64tests { "--64" {mixed2a.s} {} "libmixe2a.o"} {"Helper 32bit object 2" "-r -melf_i386" "--32" {mixed2b.s} {} "libmixe2b.o"} + {"Split by file with 'l' flag on section." "-split-by-file -r" + "--64" {split-by-file1.s split-by-file2.s} + {{readelf -SW split-by-file.rd}} "split-by-file.o"} } run_ld_link_tests $x86_64tests -- 2.30.2