public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
To: Alan Modra <amodra@gmail.com>, Nick Clifton <nickc@redhat.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH v5] Support SHF_GNU_RETAIN ELF section flag
Date: Fri, 20 Nov 2020 10:40:32 +0000	[thread overview]
Message-ID: <20201120104032.b2lf7fgayp3c5qoc@jozef-acer-manjaro> (raw)
In-Reply-To: <20201119213315.xjyi6edclax6d7mv@jozef-acer-manjaro>

[-- Attachment #1: Type: text/plain, Size: 4873 bytes --]

On Thu, Nov 19, 2020 at 09:33:15PM +0000, Jozef Lawrynowicz wrote:
> On Thu, Nov 19, 2020 at 02:06:31PM +0000, Jozef Lawrynowicz wrote:
> > On Thu, Nov 19, 2020 at 03:43:46PM +1030, Alan Modra wrote:
> > > Hi Jozef,
> > > Some fallout from your patch.
> > > 
> > > alpha-unknown-freebsd4.7  +FAIL: SHF_GNU_RETAIN sections 22
> > > alpha-unknown-freebsd4.7  +FAIL: SHF_GNU_RETAIN set with numeric flag value in .section
> > > alpha-unknown-freebsd4.7  +FAIL: Merge SHF_GNU_RETAIN for non-unique sections
> > > arm-netbsdelf  +FAIL: Unknown SHF_MASKOS value in section
> > > arm-netbsdelf  +FAIL: -t (section details) for unknown SHF_MASKOS value in section
> > > arm-nto  +FAIL: Unknown SHF_MASKOS value in section
> > > arm-nto  +FAIL: -t (section details) for unknown SHF_MASKOS value in section
> > > bfin-linux-uclibc  +FAIL: SHF_GNU_RETAIN 3 (keep sections referenced by retained sections)
> > > bfin-linux-uclibc  +FAIL: SHF_GNU_RETAIN 6a (pull section out of lib required by SHF_GNU_RETAIN section)
> > > bfin-linux-uclibc  +FAIL: SHF_GNU_RETAIN 6b (pull section out of lib required by SHF_GNU_RETAIN section)
> > > frv-linux  +FAIL: SHF_GNU_RETAIN 3 (keep sections referenced by retained sections)
> > > frv-linux  +FAIL: SHF_GNU_RETAIN 6a (pull section out of lib required by SHF_GNU_RETAIN section)
> > > frv-linux  +FAIL: SHF_GNU_RETAIN 6b (pull section out of lib required by SHF_GNU_RETAIN section)
> > > hppa64-hp-hpux11.23  +FAIL: -t (section details) for unknown SHF_MASKOS value in section
> > > lm32-linux  +FAIL: SHF_GNU_RETAIN 3 (keep sections referenced by retained sections)
> > > lm32-linux  +FAIL: SHF_GNU_RETAIN 6a (pull section out of lib required by SHF_GNU_RETAIN section)
> > > lm32-linux  +FAIL: SHF_GNU_RETAIN 6b (pull section out of lib required by SHF_GNU_RETAIN section)
> > > mips64el-openbsd  +FAIL: SHF_GNU_RETAIN 5 (don't pull SHF_GNU_RETAIN section out of lib)
> > > mips64-linux  +FAIL: SHF_GNU_RETAIN 5 (don't pull SHF_GNU_RETAIN section out of lib)
> > > mips64-openbsd  +FAIL: SHF_GNU_RETAIN 5 (don't pull SHF_GNU_RETAIN section out of lib)
> > > mipsel-linux-gnu  +FAIL: SHF_GNU_RETAIN 5 (don't pull SHF_GNU_RETAIN section out of lib)
> > > mipsisa32el-linux  +FAIL: SHF_GNU_RETAIN 5 (don't pull SHF_GNU_RETAIN section out of lib)
> > > mips-linux  +FAIL: SHF_GNU_RETAIN 5 (don't pull SHF_GNU_RETAIN section out of lib)
> > > mips-sgi-irix6  +FAIL: SHF_GNU_RETAIN 5 (don't pull SHF_GNU_RETAIN section out of lib)
> > > powerpc64-freebsd  +FAIL: SHF_GNU_RETAIN sections 22
> > > powerpc64-freebsd  +FAIL: SHF_GNU_RETAIN set with numeric flag value in .section
> > > powerpc64-freebsd  +FAIL: Merge SHF_GNU_RETAIN for non-unique sections
> > > powerpc-freebsd  +FAIL: SHF_GNU_RETAIN sections 22
> > > powerpc-freebsd  +FAIL: SHF_GNU_RETAIN set with numeric flag value in .section
> > > powerpc-freebsd  +FAIL: Merge SHF_GNU_RETAIN for non-unique sections
> > > sparc-sun-solaris2  +FAIL: Unknown SHF_MASKOS value in section
> > > sparc-sun-solaris2  +FAIL: -t (section details) for unknown SHF_MASKOS value in section
> > > x86_64-cloudabi  +FAIL: -t (section details) for unknown SHF_MASKOS value in section
> > > 
> > 
> > On Thu, Nov 19, 2020 at 10:37:29AM +0000, Nick Clifton wrote:
> > > 
> > > And a few more:
> > > 
> > > m68k-uclinux ...
> > >   BIN REGRESSION: Unknown SHF_MASKOS value in section
> > >   BIN REGRESSION: -t (section details) for unknown
> > > 
> > > x86_64-solaris2 ...
> > >   BIN REGRESSION: Unknown SHF_MASKOS value in section
> > >   BIN REGRESSION: -t (section details) for unknown
> > > 
> > > sparc64-solaris2 ...
> > >   BIN REGRESSION: Unknown SHF_MASKOS value in section
> > >   BIN REGRESSION: -t (section details) for unknown
> > > 
> > > Cheers
> > >   Nick
> > > 
> > 
> > Thanks, I'm taking a look.
> 
> Ok I think I fixed them all, currently re-testing for all targets, will
> commit once those results come in.

Committed the attached patch. Tested on 

  alpha-unknown-freebsd4.7 arm-netbsdelf arm-nto bfin-linux-uclibc
  frv-linux hppa64-hp-hpux11.23 lm32-linux mips64el-openbsd mips64-linux
  mips64-openbsd mipsel-linux-gnu mipsisa32el-linux mips-linux
  mips-sgi-irix6 powerpc64-freebsd powerpc-freebsd sparc-sun-solaris2
  x86_64-cloudabi m68k-uclinux x86_64-solaris2 sparc64-solaris2
  aarch64-elf arc-elf arm-eabi avr-elf bfin-elf cr16-elf cris-elf
  crx-elf csky-elf d10v-elf d30v-elf dlx-elf epiphany-elf fr30-elf
  frv-elf ft32-elf h8300-elf hppa-elf i386-elf ip2k-elf iq2000-elf
  lm32-elf m32c-elf m32r-elf m68hc11-elf m68hc12-elf m68k-elf mcore-elf
  mep-elf metag-elf microblaze-elf mips-elf moxie-elf msp430-elf mt-elf
  nios2-elf or1k-elf pj-elf ppc-elf pru-elf riscv-elf rl78-elf rx-elf
  s12z-elf score-elf sh-elf sparc-elf spu-elf tic6x-elf tilegx-elf
  tilepro-elf v850-elf visium-elf wasm32-elf x86_64-pc-linux-gnu
  xgate-elf xstormy16-elf xtensa-elf z80-elf

Jozef

[-- Attachment #2: 0001-Fix-SHF_GNU_RETAIN-testsuite-fallout.patch --]
[-- Type: text/plain, Size: 6912 bytes --]

From cc6fd584ed920b14d57703bb62c9ed773cea3732 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Fri, 20 Nov 2020 10:31:07 +0000
Subject: [PATCH] Fix SHF_GNU_RETAIN testsuite fallout

binutils/ChangeLog:

	* testsuite/binutils-all/readelf-maskos-1a.d: Fix test for unrecognized
	bit set in SHF_MASKOS range.
	* testsuite/binutils-all/readelf-maskos-1b.d: Likewise.
	* testsuite/binutils-all/readelf-maskos-unknown.s: New test.

ld/ChangeLog:

	* testsuite/ld-elf/retain3.s: Move symbolic reference into writeable
	.data section from read-only .text section.
	* testsuite/ld-elf/retain5.d: Don't pass --print-gc-sections for test
	that doesn't require it.
	* testsuite/ld-elf/retain6a.d: Adjust test.
	* testsuite/ld-elf/retain6main.s: Move symbolic reference into writeable
	.data section from read-only .text section.
---
 binutils/ChangeLog                                   |  7 +++++++
 binutils/testsuite/binutils-all/readelf-maskos-1a.d  | 10 +++++-----
 binutils/testsuite/binutils-all/readelf-maskos-1b.d  | 12 ++++++------
 .../testsuite/binutils-all/readelf-maskos-unknown.s  | 11 +++++++++++
 ld/ChangeLog                                         | 10 ++++++++++
 ld/testsuite/ld-elf/retain3.s                        |  4 ++--
 ld/testsuite/ld-elf/retain5.d                        |  2 +-
 ld/testsuite/ld-elf/retain6a.d                       |  2 +-
 ld/testsuite/ld-elf/retain6main.s                    | 10 +++++-----
 9 files changed, 48 insertions(+), 20 deletions(-)
 create mode 100644 binutils/testsuite/binutils-all/readelf-maskos-unknown.s

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e8bcd97e8c..4acc0d479a 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2020-11-20  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+	* testsuite/binutils-all/readelf-maskos-1a.d: Fix test for unrecognized
+	bit set in SHF_MASKOS range.
+	* testsuite/binutils-all/readelf-maskos-1b.d: Likewise.
+	* testsuite/binutils-all/readelf-maskos-unknown.s: New test.
+
 2020-11-18  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
 
 	* NEWS: Announce SHF_GNU_RETAIN support.
diff --git a/binutils/testsuite/binutils-all/readelf-maskos-1a.d b/binutils/testsuite/binutils-all/readelf-maskos-1a.d
index 7b27358599..cb18b3b08b 100644
--- a/binutils/testsuite/binutils-all/readelf-maskos-1a.d
+++ b/binutils/testsuite/binutils-all/readelf-maskos-1a.d
@@ -1,10 +1,10 @@
 #name: Unknown SHF_MASKOS value in section
-#source: readelf-maskos.s
-#notarget: [supports_gnu_osabi] msp430-*-elf visium-*-elf
-#xfail: arm-*-elf
+#source: readelf-maskos-unknown.s
+#notarget: mips-*-* hppa-*-* score-*-* msp430-*-elf visium-*-elf
 #readelf: -S --wide
-# PR26722 for the arm-*-elf XFAIL
+# Only run this test for targets that are not ELFOSABI_STANDALONE, and do not
+# set SHF_MASKOS bit 0x8000000.
 
 #...
-  \[[ 0-9]+\] .data.retain_var.*WAo.*
+  \[[ 0-9]+\] .data.var.*WAo.*
 #pass
diff --git a/binutils/testsuite/binutils-all/readelf-maskos-1b.d b/binutils/testsuite/binutils-all/readelf-maskos-1b.d
index 2cbb58a73b..5c363f698f 100644
--- a/binutils/testsuite/binutils-all/readelf-maskos-1b.d
+++ b/binutils/testsuite/binutils-all/readelf-maskos-1b.d
@@ -1,12 +1,12 @@
 #name: -t (section details) for unknown SHF_MASKOS value in section
-#source: readelf-maskos.s
-#notarget: [supports_gnu_osabi] msp430-*-elf visium-*-elf
-#xfail: arm-*-elf
+#source: readelf-maskos-unknown.s
+#notarget: mips-*-* hppa-*-* score-*-* msp430-*-elf visium-*-elf
 #readelf: -S -t --wide
-# PR26722 for the arm-*-elf XFAIL
+# Only run this test for targets that are not ELFOSABI_STANDALONE, and do not
+# set SHF_MASKOS bit 0x8000000.
 
 #...
-  \[[ 0-9]+\] .data.retain_var
+  \[[ 0-9]+\] .data.var
        PROGBITS +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +(1|2|4|8)
-       \[00200003\]: WRITE, ALLOC, OS \(00200000\)
+       \[0+0800003\]: WRITE, ALLOC, OS \(0+0800000\)
 #pass
diff --git a/binutils/testsuite/binutils-all/readelf-maskos-unknown.s b/binutils/testsuite/binutils-all/readelf-maskos-unknown.s
new file mode 100644
index 0000000000..b36066b538
--- /dev/null
+++ b/binutils/testsuite/binutils-all/readelf-maskos-unknown.s
@@ -0,0 +1,11 @@
+  .section	.data.var,"0x800003"
+	.global	var
+	.type	var, %object
+var:
+	.long	2
+
+	.section	.text._start,"ax"
+	.global	_start
+	.type	_start, %function
+_start:
+	.word 0
diff --git a/ld/ChangeLog b/ld/ChangeLog
index e9da9f8c88..c0b47f480b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,13 @@
+2020-11-20  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+	* testsuite/ld-elf/retain3.s: Move symbolic reference into writeable
+	.data section from read-only .text section.
+	* testsuite/ld-elf/retain5.d: Don't pass --print-gc-sections for test
+	that doesn't require it.
+	* testsuite/ld-elf/retain6a.d: Adjust test.
+	* testsuite/ld-elf/retain6main.s: Move symbolic reference into writeable
+	.data section from read-only .text section.
+
 2020-11-18  Alan Modra  <amodra@gmail.com>
 
 	* testsuite/ld-powerpc/group1.d,
diff --git a/ld/testsuite/ld-elf/retain3.s b/ld/testsuite/ld-elf/retain3.s
index ce315cbaa6..9e388330ab 100644
--- a/ld/testsuite/ld-elf/retain3.s
+++ b/ld/testsuite/ld-elf/retain3.s
@@ -6,9 +6,9 @@
 foo:
 	.word 0
 
-	.section	.text.bar,"axR"
+	.section	.data.bar,"awR"
 	.global	bar
-	.type	bar, %function
+	.type	bar, %object
 bar:
 	.long foo
 
diff --git a/ld/testsuite/ld-elf/retain5.d b/ld/testsuite/ld-elf/retain5.d
index 86e85f8da5..9759531d65 100644
--- a/ld/testsuite/ld-elf/retain5.d
+++ b/ld/testsuite/ld-elf/retain5.d
@@ -1,6 +1,6 @@
 #name: SHF_GNU_RETAIN 5 (don't pull SHF_GNU_RETAIN section out of lib)
 #source: retain5main.s
-#ld: --gc-sections -e _start --print-gc-sections -Ltmpdir -lretain5 -Map=retain5.map
+#ld: --gc-sections -e _start -Ltmpdir -lretain5 -Map=retain5.map
 #notarget: ![supports_gnu_osabi] ![check_gc_sections_available]
 #map: retain5.map
 #DUMPPROG: nm
diff --git a/ld/testsuite/ld-elf/retain6a.d b/ld/testsuite/ld-elf/retain6a.d
index aa93117ae7..c8a47d58c0 100644
--- a/ld/testsuite/ld-elf/retain6a.d
+++ b/ld/testsuite/ld-elf/retain6a.d
@@ -9,5 +9,5 @@
 #...
 [0-9a-f]+ . retain_from_lib
 #...
-[0-9a-f]+ . retained_fn
+[0-9a-f]+ . retained_var
 #pass
diff --git a/ld/testsuite/ld-elf/retain6main.s b/ld/testsuite/ld-elf/retain6main.s
index a66c5b3247..a1916dea85 100644
--- a/ld/testsuite/ld-elf/retain6main.s
+++ b/ld/testsuite/ld-elf/retain6main.s
@@ -1,9 +1,9 @@
-/* Undefined symbol reference in retained section .text.retained_fn requires
+/* Undefined symbol reference in retained section .data.retained_var requires
    symbol definition to be pulled out of library.  */
-	.section	.text.retained_fn,"axR"
-	.global	retained_fn
-	.type	retained_fn, %function
-retained_fn:
+	.section	.data.retained_var,"awR"
+	.global	retained_var
+	.type	retained_var, %object
+retained_var:
 	.long bar
 
 	.section	.text._start,"ax"
-- 
2.29.2


      reply	other threads:[~2020-11-20 10:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 11:41 Jozef Lawrynowicz
2020-11-17 20:29 ` Alan Modra
2020-11-19  5:13   ` Alan Modra
2020-11-19 10:37     ` Nick Clifton
2020-11-19 14:06       ` Jozef Lawrynowicz
2020-11-19 21:33         ` Jozef Lawrynowicz
2020-11-20 10:40           ` Jozef Lawrynowicz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201120104032.b2lf7fgayp3c5qoc@jozef-acer-manjaro \
    --to=jozef.l@mittosystems.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).