All of lore.kernel.org
 help / color / mirror / Atom feed
* hppa: glibc and gcc 4.6, "error: _rtld_global_ro causes a section type conflict"
@ 2012-04-15 15:00 Carlos O'Donell
  2012-04-24 23:55 ` John David Anglin
  0 siblings, 1 reply; 3+ messages in thread
From: Carlos O'Donell @ 2012-04-15 15:00 UTC (permalink / raw)
  To: John David Anglin; +Cc: linux-parisc, libc-ports

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

Dave,

When compiling glibc on magnum with gcc-4.6 I get an odd failure about
section type conflicts.

The following is the reduced test case:

carlos@magnum:~/build/glibc$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/hppa-linux-gnu/4.6/lto-wrapper
Target: hppa-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian
4.6.3-1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --disable-libssp
--enable-plugin --enable-objc-gc --disable-libstdcxx-pch
--enable-checking=release --build=hppa-linux-gnu --host=hppa-linux-gnu
--target=hppa-linux-gnu
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-1)

carlos@magnum:~/src/glibc/elf$ hppa-linux-gnu-gcc rtld.i -c -std=gnu99
-fgnu89-inline -O2 -U_FORTIFY_SOURCE -Wall -Winline -Wwrite-strings
-fmerge-all-constants -fno-stack-protector -g -Wstrict-prototypes
-fPIC -mdisable-fpregs
rtld.c: In function âdl_mainâ:
rtld.c:937:3: warning: implicit declaration of function
â__canonicalize_funcptr_for_compareâ [-Wimplicit-function-declaration]
rtld.c: At top level:
rtld.c:150:23: error: _rtld_global_ro causes a section type conflict
carlos@magnum:~/src/glibc/elf$

Attached is the original unreduced file as rtld.tar.bz2 (modified
slightly to work standalone because glibc uses `-include' on the
command line).

Attached is the multi-delta reduced file as rtld-reduced.i.

Have you seen this before with gcc 4.6?

I'll be poking at this later, but I thought you might have seen this
so I'm posting to the list.

I know that Gentoo/hppa has already seen this issue, but not posted a solution.
https://bugs.gentoo.org/show_bug.cgi?id=405161

Comments?

Cheers,
Carlos.

[-- Attachment #2: rtld.tar.bz2 --]
[-- Type: application/x-bzip2, Size: 54700 bytes --]

[-- Attachment #3: rtld-reduced.i --]
[-- Type: application/octet-stream, Size: 5480 bytes --]

typedef unsigned int size_t;
typedef long int Lmid_t;
typedef unsigned int uint32_t;
__extension__ typedef unsigned long long int uint64_t;
typedef uint32_t Elf32_Word;
typedef uint32_t Elf32_Addr;
typedef struct {
}
Elf32_Sym;
typedef struct {
}
Elf32_Phdr;
typedef struct {
}
Elf32_auxv_t;
extern int _dl_discover_osversion (void) __attribute__ ((visibility ("hidden")));
enum {
  PTHREAD_MUTEX_TIMED_NP,
  PTHREAD_MUTEX_RECURSIVE_NP,
  PTHREAD_MUTEX_ERRORCHECK_NP,
  PTHREAD_MUTEX_ADAPTIVE_NP,
  PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
  PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
  PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
  PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL,
  PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP  
};
struct r_scope_elem {
  struct link_map **r_list;
  unsigned int r_nlist;
};
struct link_map   {
  struct r_scope_elem l_searchlist;
};
extern void _dl_close (void *map) __attribute__ ((visibility ("hidden")));
extern int _dl_catch_error (const char **objname, const char **errstring,        _Bool *mallocedp, void (*operate) (void *),        void *args)      ;
typedef unsigned int fpu_control_t;
typedef struct link_map *lookup_t;
struct rtld_global {
  struct link_map _dl_rtld_map;
  int (*_dl_make_stack_executable_hook) (void **) ;
};
struct rtld_global_ro {
  size_t _dl_pagesize;
  int _dl_debug_fd;
  int _dl_lazy;
  fpu_control_t _dl_fpu_control;
  int _dl_correct_cache_id;
  uint64_t _dl_hwcap_mask;
  Elf32_Addr _dl_use_load_bias;
  void (*_dl_debug_printf) (const char *, ...)        __attribute__ ((__format__ (__printf__, 1, 2)));
  int ( *_dl_catch_error) (const char **, const char **,          _Bool *, void (*) (void *), void *);
  void ( *_dl_signal_error) (int, const char *, const char *,            const char *);
  void (*_dl_mcount) (Elf32_Addr frompc, Elf32_Addr selfpc);
  lookup_t ( *_dl_lookup_symbol_x) (const char *,            struct link_map *,            const Elf32_Sym **,            struct r_scope_elem *[],            const struct r_found_version *,            int, int,            struct link_map *);
  int (*_dl_check_caller) (const void *, enum allowmask);
  void *(*_dl_open) (const char *file, int mode, const void *caller_dlopen,        Lmid_t nsid, int argc, char *argv[], char *env[]);
  void (*_dl_close) (void *map);
  void *(*_dl_tls_get_addr_soft) (struct link_map *);
  int (*_dl_discover_osversion) (void);
  int _dl_pointer_guard;
};
extern int _dl_make_stack_executable (void **stack_endp) ;
extern void _dl_debug_printf (const char *fmt, ...)      __attribute__ ((__format__ (__printf__, 1, 2))) __attribute__ ((visibility ("hidden")));
extern void _dl_signal_error (int errcode, const char *object,          const char *occurred, const char *errstring)      __attribute__ ((__noreturn__)) __attribute__ ((visibility ("hidden")));
extern lookup_t _dl_lookup_symbol_x (const char *undef,          struct link_map *undef_map,          const Elf32_Sym **sym,          struct r_scope_elem *symbol_scope[],          const struct r_found_version *version,          int type_class, int flags,          struct link_map *skip_map)      __attribute__ ((visibility ("hidden")));
extern void _dl_mcount_internal (Elf32_Addr frompc, Elf32_Addr selfpc)      __attribute__ ((visibility ("hidden")));
extern int _dl_check_caller (const void *caller, enum allowmask mask)      __attribute__ ((visibility ("hidden")));
extern void *_dl_open (const char *name, int mode, const void *caller,          Lmid_t nsid, int argc, char *argv[], char *env[])      __attribute__ ((visibility ("hidden")));
extern void *_dl_tls_get_addr_soft (struct link_map *l) __attribute__ ((visibility ("hidden")));
struct rtld_global _rtld_global =   {
};
extern struct rtld_global _rtld_local     __attribute__ ((alias ("_rtld_global"), visibility ("hidden")));
struct rtld_global_ro _rtld_global_ro __attribute__ ((section (".data.rel.ro"))) =   {
  ._dl_debug_fd = 2,
     ._dl_use_load_bias = -2,
     ._dl_correct_cache_id = 3,
     ._dl_hwcap_mask = (0),
     ._dl_lazy = 1,
     ._dl_fpu_control = 0x00000000,
     ._dl_pointer_guard = 1,
     ._dl_pagesize = 4096,
       ._dl_debug_printf = _dl_debug_printf,
     ._dl_catch_error = _dl_catch_error,
     ._dl_signal_error = _dl_signal_error,
     ._dl_mcount = _dl_mcount_internal,
     ._dl_lookup_symbol_x = _dl_lookup_symbol_x,
     ._dl_check_caller = _dl_check_caller,
     ._dl_open = _dl_open,
     ._dl_close = _dl_close,
     ._dl_tls_get_addr_soft = _dl_tls_get_addr_soft,
      ._dl_discover_osversion = _dl_discover_osversion
    };
static void dl_main (const Elf32_Phdr *phdr, Elf32_Word phnum,        Elf32_Addr *user_entry, Elf32_auxv_t *auxv);
struct dl_start_final_info 
{
};
static Elf32_Addr __attribute__ ((noinline)) 
_dl_start_final (void *arg, struct dl_start_final_info *info)  
{
  Elf32_Addr start_addr;
  start_addr = _dl_sysdep_start (arg, &dl_main);
}
static Elf32_Addr __attribute__ ((__used__)) _dl_start (void *arg) 
{
  struct dl_start_final_info info;
  {
    Elf32_Addr entry = _dl_start_final (arg, &info);
  }
}
static void dl_main (const Elf32_Phdr *phdr,   Elf32_Word phnum,   Elf32_Addr *user_entry,   Elf32_auxv_t *auxv) 
{
  struct link_map *main_map;
  unsigned int i;
  _rtld_local._dl_make_stack_executable_hook = &_dl_make_stack_executable;
  for (i = 1;
       i < main_map->l_searchlist.r_nlist;
       ++i)
    if (main_map->l_searchlist.r_list[i] == &_rtld_local._dl_rtld_map)
       break;
}

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

* Re: hppa: glibc and gcc 4.6, "error: _rtld_global_ro causes a section type conflict"
  2012-04-15 15:00 hppa: glibc and gcc 4.6, "error: _rtld_global_ro causes a section type conflict" Carlos O'Donell
@ 2012-04-24 23:55 ` John David Anglin
  2012-04-25  4:05   ` Carlos O'Donell
  0 siblings, 1 reply; 3+ messages in thread
From: John David Anglin @ 2012-04-24 23:55 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: linux-parisc, libc-ports

On 15-Apr-12, at 11:00 AM, Carlos O'Donell wrote:

> When compiling glibc on magnum with gcc-4.6 I get an odd failure about
> section type conflicts.


After discussing the issue with Jakub Jelinek,  it appears the bug is  
caused by placing
function labels (plabels) in the constant pool.  PA has done this for  
longer than I can
remember, but it doesn't appear necessary.  As you know, only ia64 and  
pa use plabels.
This causes the setting of default flags for .data.rel.ro which  
conflict with those needed
for _rtld_global_ro in the dynamic linker.  The problem doesn't have  
anything directly
to do with the handling of the variable _rtld_global_ro.  This was  
what was confusing
me as everything seemed generic.

I am testing a fix.  Your testcase compiles successfully with the fix.

The issue is incredibly subtle.  I would guess it was just a matter of  
luck that other targets
aren't affected given that the code in rtld.c is not exactly exactly  
kosher from GCC POV.

Regards,
Dave
--
John David Anglin	dave.anglin@bell.net




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

* Re: hppa: glibc and gcc 4.6, "error: _rtld_global_ro causes a section type conflict"
  2012-04-24 23:55 ` John David Anglin
@ 2012-04-25  4:05   ` Carlos O'Donell
  0 siblings, 0 replies; 3+ messages in thread
From: Carlos O'Donell @ 2012-04-25  4:05 UTC (permalink / raw)
  To: John David Anglin; +Cc: linux-parisc, libc-ports

On Tue, Apr 24, 2012 at 7:55 PM, John David Anglin <dave.anglin@bell.ne=
t> wrote:
> On 15-Apr-12, at 11:00 AM, Carlos O'Donell wrote:
>
>> When compiling glibc on magnum with gcc-4.6 I get an odd failure abo=
ut
>> section type conflicts.
>
>
>
> After discussing the issue with Jakub Jelinek, =A0it appears the bug =
is caused
> by placing
> function labels (plabels) in the constant pool.

Interesting.

> PA has done this for longer
> than I can
> remember, but it doesn't appear necessary. =A0As you know, only ia64 =
and pa
> use plabels.

Yes, we both rely on the plabel code in glibc.

> This causes the setting of default flags for .data.rel.ro which confl=
ict
> with those needed
> for _rtld_global_ro in the dynamic linker. =A0The problem doesn't hav=
e
> anything directly
> to do with the handling of the variable _rtld_global_ro. =A0This was =
what was
> confusing
> me as everything seemed generic.

Me too.

> I am testing a fix. =A0Your testcase compiles successfully with the f=
ix.

Excellent!

> The issue is incredibly subtle. =A0I would guess it was just a matter=
 of luck
> that other targets
> aren't affected given that the code in rtld.c is not exactly exactly =
kosher
> from GCC POV.

The dynamic linker isn't exactly kosher :-)

Cheers,
Carlos.
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc"=
 in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2012-04-25  4:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-15 15:00 hppa: glibc and gcc 4.6, "error: _rtld_global_ro causes a section type conflict" Carlos O'Donell
2012-04-24 23:55 ` John David Anglin
2012-04-25  4:05   ` Carlos O'Donell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.