* [PATCH][ARM] Skip excluded sections when inserting mapping symbols for data-only sections
@ 2011-08-26 21:15 Christophe Lyon
2011-09-01 11:14 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Christophe Lyon @ 2011-08-26 21:15 UTC (permalink / raw)
To: Binutils
[-- Attachment #1: Type: text/plain, Size: 351 bytes --]
Hi,
On ARM, mapping symbols are inserted at the beginning of data-only sections, but in the case of merged sections it can result in a nameless symbol (when the corresponding input section has SEC_EXCLUDE). This causes Android's apriori to raise an assertion.
I propose the attached fix, tested on arm-none-eabi.
OK to commit?
Thanks
Christophe.
[-- Attachment #2: mapping-merge.changelog --]
[-- Type: text/plain, Size: 412 bytes --]
2011-08-26 Christophe Lyon <christophe.lyon@st.com>
bfd/
* elf32-arm.c (elf32_arm_output_arch_local_syms): Skip excluded
sections.
ld/testsuite/
* ld-arm/arm-elf.exp: Add new rodata-merge-map test.
* ld-arm/rodata-merge-map.ld: New file.
* ld-arm/rodata-merge-map.sym: Likewise.
* ld-arm/rodata-merge-map1.s Likewise.
* ld-arm/rodata-merge-map2.s: Likewise.
* ld-arm/rodata-merge-map3.s: Likewise.
[-- Attachment #3: mapping-merge.patch --]
[-- Type: text/plain, Size: 4666 bytes --]
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.274
diff -u -p -r1.274 elf32-arm.c
--- bfd/elf32-arm.c 9 Aug 2011 13:10:43 -0000 1.274
+++ bfd/elf32-arm.c 26 Aug 2011 14:54:03 -0000
@@ -14506,7 +14506,8 @@ elf32_arm_output_arch_local_syms (bfd *o
== SEC_HAS_CONTENTS
&& get_arm_elf_section_data (osi.sec) != NULL
&& get_arm_elf_section_data (osi.sec)->mapcount == 0
- && osi.sec->size > 0)
+ && osi.sec->size > 0
+ && (osi.sec->flags & SEC_EXCLUDE) == 0)
{
osi.sec_shndx = _bfd_elf_section_from_bfd_section
(output_bfd, osi.sec->output_section);
Index: ld/testsuite/ld-arm/arm-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-arm/arm-elf.exp,v
retrieving revision 1.89
diff -u -p -r1.89 arm-elf.exp
--- ld/testsuite/ld-arm/arm-elf.exp 9 Aug 2011 13:10:44 -0000 1.89
+++ ld/testsuite/ld-arm/arm-elf.exp 26 Aug 2011 14:54:05 -0000
@@ -323,6 +323,9 @@ set armelftests {
{"Data only mapping symbols" "-T data-only-map.ld -Map map" "" {data-only-map.s}
{{objdump -dr data-only-map.d}}
"data-only-map"}
+ {"Data only mapping symbols for merged sections" "-T rodata-merge-map.ld" "" {rodata-merge-map1.s rodata-merge-map2.s rodata-merge-map3.s}
+ {{readelf -s rodata-merge-map.sym}}
+ "rodata-merge-map"}
{"GOT relocations in executables (setup)" "-shared"
"" {exec-got-1a.s}
{}
Index: ld/testsuite/ld-arm/rodata-merge-map.ld
===================================================================
RCS file: ld/testsuite/ld-arm/rodata-merge-map.ld
diff -N ld/testsuite/ld-arm/rodata-merge-map.ld
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-arm/rodata-merge-map.ld 26 Aug 2011 14:54:05 -0000
@@ -0,0 +1,9 @@
+/* Script for ld testsuite */
+OUTPUT_ARCH(arm)
+SECTIONS
+{
+ .rodata :
+ {
+ *(.rodata*)
+ }
+}
Index: ld/testsuite/ld-arm/rodata-merge-map.sym
===================================================================
RCS file: ld/testsuite/ld-arm/rodata-merge-map.sym
diff -N ld/testsuite/ld-arm/rodata-merge-map.sym
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-arm/rodata-merge-map.sym 26 Aug 2011 14:54:05 -0000
@@ -0,0 +1,8 @@
+
+Symbol table '.symtab' contains 5 entries:
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+ 1: 00000000 0 SECTION LOCAL DEFAULT 1
+ 2: 00000000 0 SECTION LOCAL DEFAULT 2
+ 3: 00000000 0 NOTYPE LOCAL DEFAULT 1 \$d
+ 4: 0000000c 0 NOTYPE LOCAL DEFAULT 1 \$d
Index: ld/testsuite/ld-arm/rodata-merge-map1.s
===================================================================
RCS file: ld/testsuite/ld-arm/rodata-merge-map1.s
diff -N ld/testsuite/ld-arm/rodata-merge-map1.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-arm/rodata-merge-map1.s 26 Aug 2011 14:54:05 -0000
@@ -0,0 +1,8 @@
+@ Test to ensure that no nameless mapping symbol is inserted
+@ within a merged section.
+@ This file contains the 1st contribution, which is expected to
+@ generate a $d symbol at its beginning.
+
+ .section .rodata.str1.1,"aMS",%progbits,1
+.LC0:
+ .string "Hello world"
Index: ld/testsuite/ld-arm/rodata-merge-map2.s
===================================================================
RCS file: ld/testsuite/ld-arm/rodata-merge-map2.s
diff -N ld/testsuite/ld-arm/rodata-merge-map2.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-arm/rodata-merge-map2.s 26 Aug 2011 14:54:05 -0000
@@ -0,0 +1,9 @@
+@ This file contains the 2nd contribution, which is expected to
+@ be fully merged into the 1st contribution (from
+@ rodata-merge-map1.s), and generate no mapping symbol (which
+@ would otherwise be converted in a symbol table entry with no
+@ name).
+
+ .section .rodata.str1.1,"aMS",%progbits,1
+.LC0:
+ .string "world"
Index: ld/testsuite/ld-arm/rodata-merge-map3.s
===================================================================
RCS file: ld/testsuite/ld-arm/rodata-merge-map3.s
diff -N ld/testsuite/ld-arm/rodata-merge-map3.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-arm/rodata-merge-map3.s 26 Aug 2011 14:54:05 -0000
@@ -0,0 +1,9 @@
+@ This file contains the 3rd contribution, which is expected to
+@ be partially merged into the 1st contribution (from
+@ rodata-merge-map1.s), and generate a (redundant, but harmless)
+@ $d mapping symbol.
+
+ .section .rodata.str1.1,"aMS",%progbits,1
+.LC0:
+ .string "foo"
+ .string "world"
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][ARM] Skip excluded sections when inserting mapping symbols for data-only sections
2011-08-26 21:15 [PATCH][ARM] Skip excluded sections when inserting mapping symbols for data-only sections Christophe Lyon
@ 2011-09-01 11:14 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2011-09-01 11:14 UTC (permalink / raw)
To: Christophe Lyon; +Cc: Binutils
Hi Christophe,
> On ARM, mapping symbols are inserted at the beginning of data-only
> sections, but in the case of merged sections it can result in a nameless
> symbol (when the corresponding input section has SEC_EXCLUDE). This
> causes Android's apriori to raise an assertion.
>
> I propose the attached fix, tested on arm-none-eabi.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-01 11:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-26 21:15 [PATCH][ARM] Skip excluded sections when inserting mapping symbols for data-only sections Christophe Lyon
2011-09-01 11:14 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).