public inbox for prelink@sourceware.org
 help / color / mirror / Atom feed
* RE: [PATCH] Add TLS support for SH architecture.
@ 2009-07-01 15:09 Filippo ARCIDIACONO
  2009-07-08 15:58 ` Filippo ARCIDIACONO
  0 siblings, 1 reply; 4+ messages in thread
From: Filippo ARCIDIACONO @ 2009-07-01 15:09 UTC (permalink / raw)
  To: prelink



> -----Original Message-----
> From: prelink-owner@sourceware.org
> [mailto:prelink-owner@sourceware.org] On Behalf Of Jakub Jelinek
> Sent: Wednesday, July 01, 2009 10:55 AM
> To: Filippo ARCIDIACONO
> Cc: prelink@sourceware.org
> Subject: Re: [PATCH] Add TLS support for SH architecture.
> 
> On Wed, Jul 01, 2009 at 03:03:09AM -0400, Filippo ARCIDIACONO wrote:
> > This patch extend the prelink tool also for sh architecture
> adding the
> > tls support, and fixes some architecture specific issue.
> > The fix in the sh_undo_prelink_rela function is needed to
> restore all
> > the GOT entries to the original value.
> > In the prelink stage GOT[1] has been set to the first plt
> entry just
> > after the plt header (This is the necessary code to jump at PLT[0]).
> > To retrieve the other ones we need to add (28 * n) byte to
> the first
> > one, where n is the n-th entry of the PLTn (n = 0,1,2,...).
> > The fix in src/dwarf2.c avoid assertion fail at line 808 for 
> > layout[12], cxx[12] and undosyslibs tests.
> > 
> > --- a/src/dwarf2.c
> > +++ b/src/dwarf2.c
> > @@ -789,6 +789,13 @@ adjust_dwarf2_aranges (DSO *dso,
> GElf_Addr start, GElf_Addr adjust)
> >  	}
> >  
> >        ptr += 6;
> > +#ifdef __SH4__
> > +/*
> > + * This fix skips padding to avoid assertion fail at line 808 for
> > + * layout[12], cxx[12] and undosyslibs tests.
> > + */
> > +      ptr += 8;
> > +#endif
> >        while (ptr < endcu)
> >  	{
> >  	  addr = read_ptr (ptr);
> 

Hi Jakub,
firstly thanks for reviewing this patch.

> This change is not acceptable.  Sometimes prelink is used as a cross 
> tool, so host macros shouldn't make a difference on target behavior.

You're right, indeed I did not think to prelink to be used as cross Tool; that would be an interesting thing anyway.

> Also, if you really need to skip another 8 bytes, it doesn't seem SH 
> is using valid DWARF2/3 .debug_aranges, there really should be just 6 
> bytes skipped here (one byte address_size, one byte segment_size, 4 
> bytes padding to 16 byte boundary (the tuples are supposed to be 
> aligned to twice the pointer
> size) and the aranges entries start right after that.  I don't see 
> anything in GCC that would suggest SH is treated differently.
> 
I looked again at the test failure, indeed it seems the problem is in our libstdc++, While all other DSOs have a valid dwarf2 .debug_aranges.
Our libstdc++ .debug_aranges seems to be not valid.

readelf --debug-dump=aranges ./libstdc++.so.6

The section .debug_aranges contains:

  Length:                   1028 
  Version:                  2    
  Offset into .debug_info:  0x0  
  Pointer Size:             4    
  Segment Size:             0    

    Address    Length
00000000 00000000    <----- Spurious 8 bytes I skipped
319c7b00 00000020
319c7b20 00000020
319c7b40 00000054
319c7b94 00000040
319c7bd4 00000012
:
:

I'll have a look at binutils. So I agree with you to discard this part of the patch.

> So, which compiler are you testing with, if it is not GCC, are you 
> sure you aren't breaking prelink support for GCC on this arch?  And in 
> any case assembly output from the compiler with -dA for the 
> .debug_aranges section to show what those 8 bytes are.
> 
> Also, I'd like to understand those other non-TLS non-testsuite 
> changes, are you saying prelink as is never really worked on any SH, 
> or just the SH variant you are testing on behaves differently from the 
> one it has been used on before (my memory is weak, it has been many 
> years, so I don't remember well who tested prelink on which of the 
> embedded arches I didn't have any access to).

Which other changes (other than dwarf2.c) are you referring to?

> 
> > --- a/testsuite/reloc8.sh
> > +++ b/testsuite/reloc8.sh
> > @@ -8,6 +8,9 @@ NOCOPYRELOC=-Wl,-z,nocopyreloc  case "`uname -m`" in
> >    x86_64|s390*) if file reloc1lib1.so | grep -q 64-bit; then 
> > NOCOPYRELOC=; fi;;  esac
> > +case "`uname -m`" in
> > +  sh4) NOCOPYRELOC=;
> > +esac
> 
> This certainly should go into the same case, no need to call uname -m 
> the second time.
> 
> > --- a/testsuite/reloc9.sh
> > +++ b/testsuite/reloc9.sh
> > @@ -8,6 +8,9 @@ NOCOPYRELOC=-Wl,-z,nocopyreloc  case "`uname -m`" in
> >    x86_64|s390*) if file reloc1lib1.so | grep -q 64-bit; then 
> > NOCOPYRELOC=; fi;;  esac
> > +case "`uname -m`" in
> > +  sh4) NOCOPYRELOC=;
> > +esac

I'll review both.
> 
> Likewise.
> 
> 	Jakub
> 

Regards,
Filippo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] Add TLS support for SH architecture.
  2009-07-01 15:09 [PATCH] Add TLS support for SH architecture Filippo ARCIDIACONO
@ 2009-07-08 15:58 ` Filippo ARCIDIACONO
  0 siblings, 0 replies; 4+ messages in thread
From: Filippo ARCIDIACONO @ 2009-07-08 15:58 UTC (permalink / raw)
  To: prelink

 

[SNIP]

> I looked again at the test failure, indeed it seems the 
> problem is in our libstdc++, While all other DSOs have a 
> valid dwarf2 .debug_aranges.
> Our libstdc++ .debug_aranges seems to be not valid.
> 
> readelf --debug-dump=aranges ./libstdc++.so.6
> 
> The section .debug_aranges contains:
> 
>   Length:                   1028 
>   Version:                  2    
>   Offset into .debug_info:  0x0  
>   Pointer Size:             4    
>   Segment Size:             0    
> 
>     Address    Length
> 00000000 00000000    <----- Spurious 8 bytes I skipped
> 319c7b00 00000020
> 319c7b20 00000020
> 319c7b40 00000054
> 319c7b94 00000040
> 319c7bd4 00000012
> :
> :
> 
> I'll have a look at binutils. So I agree with you to discard 
> this part of the patch.

This isn't sh4 specific issue but it is a known gcc bug in 4.2.4 version, 
fixed in 4.3.
See http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01200.html for detail, 
Where there is also a reference to prelink sanity check.

> 
[SINP]

Filippo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add TLS support for SH architecture.
  2009-07-01  7:04 Filippo ARCIDIACONO
@ 2009-07-01  8:55 ` Jakub Jelinek
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2009-07-01  8:55 UTC (permalink / raw)
  To: Filippo ARCIDIACONO; +Cc: prelink

On Wed, Jul 01, 2009 at 03:03:09AM -0400, Filippo ARCIDIACONO wrote:
> This patch extend the prelink tool also for sh architecture adding the tls
> support, and fixes some architecture specific issue.
> The fix in the sh_undo_prelink_rela function is needed to restore all the GOT
> entries to the original value.
> In the prelink stage GOT[1] has been set to the first plt entry just after the
> plt header (This is the necessary code to jump at PLT[0]).
> To retrieve the other ones we need to add (28 * n) byte to the first one, where
> n is the n-th entry of the PLTn (n = 0,1,2,...).
> The fix in src/dwarf2.c avoid assertion fail at line 808 for layout[12],
> cxx[12] and undosyslibs tests.
> 
> --- a/src/dwarf2.c
> +++ b/src/dwarf2.c
> @@ -789,6 +789,13 @@ adjust_dwarf2_aranges (DSO *dso, GElf_Addr start, GElf_Addr adjust)
>  	}
>  
>        ptr += 6;
> +#ifdef __SH4__
> +/*
> + * This fix skips padding to avoid assertion fail at line 808 for 
> + * layout[12], cxx[12] and undosyslibs tests.
> + */
> +      ptr += 8;
> +#endif
>        while (ptr < endcu)
>  	{
>  	  addr = read_ptr (ptr);

This change is not acceptable.  Sometimes prelink is used as a cross tool,
so host macros shouldn't make a difference on target behavior.  Also,
if you really need to skip another 8 bytes, it doesn't seem SH is using
valid DWARF2/3 .debug_aranges, there really should be just 6 bytes skipped
here (one byte address_size, one byte segment_size, 4 bytes padding to 16
byte boundary (the tuples are supposed to be aligned to twice the pointer
size) and the aranges entries start right after that.  I don't see anything
in GCC that would suggest SH is treated differently.

So, which compiler are you testing with, if it is not GCC, are you sure you
aren't breaking prelink support for GCC on this arch?  And in any case
assembly output from the compiler with -dA for the .debug_aranges section
to show what those 8 bytes are.

Also, I'd like to understand those other non-TLS non-testsuite changes,
are you saying prelink as is never really worked on any SH, or just the SH
variant you are testing on behaves differently from the one it has been used
on before (my memory is weak, it has been many years, so I don't remember
well who tested prelink on which of the embedded arches I didn't have any
access to).

> --- a/testsuite/reloc8.sh
> +++ b/testsuite/reloc8.sh
> @@ -8,6 +8,9 @@ NOCOPYRELOC=-Wl,-z,nocopyreloc
>  case "`uname -m`" in
>    x86_64|s390*) if file reloc1lib1.so | grep -q 64-bit; then NOCOPYRELOC=; fi;;
>  esac
> +case "`uname -m`" in
> +  sh4) NOCOPYRELOC=;
> +esac

This certainly should go into the same case, no need to call uname -m the
second time.

> --- a/testsuite/reloc9.sh
> +++ b/testsuite/reloc9.sh
> @@ -8,6 +8,9 @@ NOCOPYRELOC=-Wl,-z,nocopyreloc
>  case "`uname -m`" in
>    x86_64|s390*) if file reloc1lib1.so | grep -q 64-bit; then NOCOPYRELOC=; fi;;
>  esac
> +case "`uname -m`" in
> +  sh4) NOCOPYRELOC=;
> +esac

Likewise.

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Add TLS support for SH architecture.
@ 2009-07-01  7:04 Filippo ARCIDIACONO
  2009-07-01  8:55 ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Filippo ARCIDIACONO @ 2009-07-01  7:04 UTC (permalink / raw)
  To: prelink; +Cc: Filippo Arcidiacono

This patch extend the prelink tool also for sh architecture adding the tls
support, and fixes some architecture specific issue.
The fix in the sh_undo_prelink_rela function is needed to restore all the GOT
entries to the original value.
In the prelink stage GOT[1] has been set to the first plt entry just after the
plt header (This is the necessary code to jump at PLT[0]).
To retrieve the other ones we need to add (28 * n) byte to the first one, where
n is the n-th entry of the PLTn (n = 0,1,2,...).
The fix in src/dwarf2.c avoid assertion fail at line 808 for layout[12],
cxx[12] and undosyslibs tests.

2009-06-25  Filippo Arcidiacono  <filippo.arcidiacono@st.com>

        * src/arch-sh.c: Added TLS relocation support on SH.
        * src/dwarf2.c: SH specific fix.
        * testsuite/reloc8.sh: Update test for SH.
        * testsuite/reloc9.sh: Update test for SH.
        * testsuite/tls3.sh: Update test for SH.
---
 src/arch-sh.c       |  101 +++++++++++++++++++++++++++++++++++++++++++++++----
 src/dwarf2.c        |    7 ++++
 testsuite/reloc8.sh |    3 ++
 testsuite/reloc9.sh |    3 ++
 testsuite/tls3.sh   |    2 +-
 5 files changed, 108 insertions(+), 8 deletions(-)

diff --git a/src/arch-sh.c b/src/arch-sh.c
index c5c9f52..1944a74 100644
--- a/src/arch-sh.c
+++ b/src/arch-sh.c
@@ -85,8 +85,10 @@ sh_adjust_rela (DSO *dso, GElf_Rela *rela, GElf_Addr start,
       if (rela->r_addend && (Elf32_Addr) rela->r_addend >= start)
 	{
 	  rela->r_addend += (Elf32_Sword) adjust;
+          write_ne32 (dso, rela->r_offset, rela->r_addend);
 	  break;
 	}
+       break;
       /* FALLTHROUGH */
     case R_SH_JMP_SLOT:
       data = read_une32 (dso, rela->r_offset);
@@ -133,8 +135,26 @@ sh_prelink_rela (struct prelink_info *info, GElf_Rela *rela,
       write_ne32 (dso, rela->r_offset, value);
       break;
     case R_SH_REL32:
-      write_ne32 (dso, rela->r_offset, value - rela->r_addend);
+      write_ne32 (dso, rela->r_offset, value - rela->r_offset);
       break;
+    case R_SH_TLS_DTPOFF32:
+      write_ne32 (dso, rela->r_offset, value);
+      break;
+    /* DTPMOD32 and TPOFF{32,} is impossible to predict unless prelink
+       sets the rules.  */
+    case R_SH_TLS_DTPMOD32:
+      if (dso->ehdr.e_type == ET_EXEC)
+        {
+          error (0, 0, "%s: R_SH_TLS_DTPMOD32 reloc in executable?",
+                 dso->filename);
+          return 1;
+        }
+      break;
+    case R_SH_TLS_TPOFF32:
+      if (dso->ehdr.e_type == ET_EXEC && info->resolvetls)
+        write_ne32 (dso, rela->r_offset,
+                    (value + info->resolvetls->offset));
+       break;
     case R_SH_COPY:
       if (dso->ehdr.e_type == ET_EXEC)
 	/* COPY relocs are handled specially in generic code.  */
@@ -218,6 +238,7 @@ sh_prelink_conflict_rela (DSO *dso, struct prelink_info *info,
 {
   GElf_Addr value;
   struct prelink_conflict *conflict;
+  struct prelink_tls *tls;
   GElf_Rela *ret;
 
   if (GELF_R_TYPE (rela->r_info) == R_SH_RELATIVE
@@ -227,8 +248,31 @@ sh_prelink_conflict_rela (DSO *dso, struct prelink_info *info,
   conflict = prelink_conflict (info, GELF_R_SYM (rela->r_info),
 			       GELF_R_TYPE (rela->r_info));
   if (conflict == NULL)
+    {
+      if (info->curtls == NULL)
     return 0;
-  value = conflict_lookup_value (conflict);
+      switch (GELF_R_TYPE (rela->r_info))
+	{
+	/* Even local DTPMOD and TPOFF relocs need conflicts.  */
+	case R_SH_TLS_DTPMOD32:
+	case R_SH_TLS_TPOFF32:
+	  break;
+	default:
+	  return 0;
+	}
+      value = 0;
+    }
+  else
+    {
+      /* DTPOFF32 wants to see only real conflicts, not lookups
+	 with reloc_class RTYPE_CLASS_TLS.  */
+      if (GELF_R_TYPE (rela->r_info) == R_SH_TLS_DTPOFF32
+	  && conflict->lookup.tls == conflict->conflict.tls
+	  && conflict->lookupval == conflict->conflictval)
+	return 0;
+
+      value = conflict_lookup_value (conflict);
+    }
   ret = prelink_conflict_add_rela (info);
   if (ret == NULL)
     return 1;
@@ -247,11 +291,38 @@ sh_prelink_conflict_rela (DSO *dso, struct prelink_info *info,
       /* FALLTHROUGH */
     case R_SH_GLOB_DAT:
     case R_SH_JMP_SLOT:
-      ret->r_addend = (Elf32_Sword) (value + rela->r_addend);
+      ret->r_addend = (Elf32_Sword) (value);
       break;
     case R_SH_COPY:
       error (0, 0, "R_SH_COPY should not be present in shared libraries");
       return 1;
+    case R_SH_TLS_DTPMOD32:
+    case R_SH_TLS_DTPOFF32:
+    case R_SH_TLS_TPOFF32:
+      if (conflict != NULL
+          && (conflict->reloc_class != RTYPE_CLASS_TLS
+              || conflict->lookup.tls == NULL))
+        {
+          error (0, 0, "%s: R_SH_TLS not resolving to STT_TLS symbol",
+                 dso->filename);
+          return 1;
+        }
+      tls = conflict ? conflict->lookup.tls : info->curtls;
+      ret->r_info = GELF_R_INFO (0, R_SH_DIR32);
+      switch (GELF_R_TYPE (rela->r_info))
+        {
+        case R_SH_TLS_DTPMOD32:
+          ret->r_addend = tls->modid;
+          break;
+        case R_SH_TLS_DTPOFF32:
+          ret->r_addend += value;
+          break;
+        case R_SH_TLS_TPOFF32:
+          ret->r_addend = value + tls->offset;
+          break;
+        }
+      break;
+
     default:
       error (0, 0, "%s: Unknown sh relocation type %d", dso->filename,
 	     (int) GELF_R_TYPE (rela->r_info));
@@ -348,7 +419,7 @@ sh_undo_prelink_rela (DSO *dso, GElf_Rela *rela, GElf_Addr relaaddr)
       break;
     case R_SH_RELATIVE:
       if (rela->r_addend)
-	write_le32 (dso, rela->r_offset, 0);
+	write_ne32 (dso, rela->r_offset, 0);
       break;
     case R_SH_JMP_SLOT:
       sec = addr_to_sec (dso, rela->r_offset);
@@ -365,15 +436,22 @@ sh_undo_prelink_rela (DSO *dso, GElf_Rela *rela, GElf_Addr relaaddr)
 
 	  assert (rela->r_offset >= dso->shdr[sec].sh_addr + 12);
 	  assert (((rela->r_offset - dso->shdr[sec].sh_addr) & 3) == 0);
+      /*
+       * In the prelink stage GOT[1] has been set to the first plt entry 
+       * just after the plt header (This is the necessary code to jump at 
+       * PLT[0]).
+       * To retrieve the other ones we need to add (28 * n) byte to the 
+       * first one, where n is the n-th entry of the PLTn (n = 0,1,2,...).
+       */
 	  write_ne32 (dso, rela->r_offset,
-		      7 * (rela->r_offset - dso->shdr[sec].sh_addr - 12)
+		      28 * ((rela->r_offset - dso->shdr[sec].sh_addr - 12) / 4)
 		      + data);
 	}
       break;
     case R_SH_GLOB_DAT:
     case R_SH_DIR32:
     case R_SH_REL32:
-      write_ne32 (dso, rela->r_offset, 0);
+      write_ne32 (dso, rela->r_offset, rela->r_addend);
       break;
     case R_SH_COPY:
       if (dso->ehdr.e_type == ET_EXEC)
@@ -381,6 +459,11 @@ sh_undo_prelink_rela (DSO *dso, GElf_Rela *rela, GElf_Addr relaaddr)
 	return 0;
       error (0, 0, "%s: R_SH_COPY reloc in shared library?", dso->filename);
       return 1;
+    case R_SH_TLS_DTPMOD32:
+    case R_SH_TLS_DTPOFF32:
+    case R_SH_TLS_TPOFF32:
+      write_ne32 (dso, rela->r_offset, 0);
+      break;
     default:
       error (0, 0, "%s: Unknown sh relocation type %d", dso->filename,
 	     (int) GELF_R_TYPE (rela->r_info));
@@ -402,6 +485,10 @@ sh_reloc_class (int reloc_type)
     {
     case R_SH_COPY: return RTYPE_CLASS_COPY;
     case R_SH_JMP_SLOT: return RTYPE_CLASS_PLT;
+    case R_SH_TLS_DTPMOD32:
+    case R_SH_TLS_DTPOFF32:
+    case R_SH_TLS_TPOFF32:
+      return RTYPE_CLASS_TLS;
     default: return RTYPE_CLASS_VALID;
     }
 }
@@ -441,6 +528,6 @@ PL_ARCH = {
      even dlopened libraries will get the slots they desire.  */
   .mmap_base = 0x30000000,
   .mmap_end =  0x40000000,
-  .max_page_size = 0x2000,
+  .max_page_size = 0x10000,
   .page_size = 0x1000
 };
diff --git a/src/dwarf2.c b/src/dwarf2.c
index 4c27836..4d3e1b9 100644
--- a/src/dwarf2.c
+++ b/src/dwarf2.c
@@ -789,6 +789,13 @@ adjust_dwarf2_aranges (DSO *dso, GElf_Addr start, GElf_Addr adjust)
 	}
 
       ptr += 6;
+#ifdef __SH4__
+/*
+ * This fix skips padding to avoid assertion fail at line 808 for 
+ * layout[12], cxx[12] and undosyslibs tests.
+ */
+      ptr += 8;
+#endif
       while (ptr < endcu)
 	{
 	  addr = read_ptr (ptr);
diff --git a/testsuite/reloc8.sh b/testsuite/reloc8.sh
index ea0a89e..d2377f0 100755
--- a/testsuite/reloc8.sh
+++ b/testsuite/reloc8.sh
@@ -8,6 +8,9 @@ NOCOPYRELOC=-Wl,-z,nocopyreloc
 case "`uname -m`" in
   x86_64|s390*) if file reloc1lib1.so | grep -q 64-bit; then NOCOPYRELOC=; fi;;
 esac
+case "`uname -m`" in
+  sh4) NOCOPYRELOC=;
+esac
 $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc8lib1.so $srcdir/reloc3lib1.c
 $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc8lib2.so $srcdir/reloc1lib2.c reloc8lib1.so
 BINS="reloc8"
diff --git a/testsuite/reloc9.sh b/testsuite/reloc9.sh
index 41fe578..4b2b57c 100755
--- a/testsuite/reloc9.sh
+++ b/testsuite/reloc9.sh
@@ -8,6 +8,9 @@ NOCOPYRELOC=-Wl,-z,nocopyreloc
 case "`uname -m`" in
   x86_64|s390*) if file reloc1lib1.so | grep -q 64-bit; then NOCOPYRELOC=; fi;;
 esac
+case "`uname -m`" in
+  sh4) NOCOPYRELOC=;
+esac
 $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc9lib1.so $srcdir/reloc3lib1.c
 $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc9lib2.so $srcdir/reloc1lib2.c reloc9lib1.so
 BINS="reloc9"
diff --git a/testsuite/tls3.sh b/testsuite/tls3.sh
index 34cbfd7..6ccb159 100755
--- a/testsuite/tls3.sh
+++ b/testsuite/tls3.sh
@@ -7,7 +7,7 @@ echo '__thread int a; int main (void) { return a; }' \
 ( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77
 SHFLAGS=
 case "`uname -m`" in
-  ia64|ppc*|x86_64|alpha*|s390*|mips*|arm*) SHFLAGS=-fpic;; # Does not support non-pic shared libs
+  ia64|ppc*|x86_64|alpha*|s390*|mips*|arm*|sh4) SHFLAGS=-fpic;; # Does not support non-pic shared libs
 esac
 # Disable this test under SELinux if textrel
 test -z "$SHFLAGS" -a -x /usr/sbin/getenforce -a "`/usr/sbin/getenforce`" = Enforcing && exit 77
-- 
1.6.0.6

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-08 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-01 15:09 [PATCH] Add TLS support for SH architecture Filippo ARCIDIACONO
2009-07-08 15:58 ` Filippo ARCIDIACONO
  -- strict thread matches above, loose matches on Subject: below --
2009-07-01  7:04 Filippo ARCIDIACONO
2009-07-01  8:55 ` Jakub Jelinek

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).