public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* linker bug in gcc
@ 2011-06-03  4:30 Edward Peschko
  2011-06-03  5:53 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Edward Peschko @ 2011-06-03  4:30 UTC (permalink / raw)
  To: gcc-help

All,

I was trying to compile a new version of libselinux, and ran across a
weird error (attached). I tried a bunch of stuff, and finally searched
all the libraries on the system for that symbol, which was found in
/lib/ld-2.3.4.so.

In desperation I added it explicitly on the command line, and it
compiled. So. Is this just a bug in gcc and the linker chain?
Shouldn't the linker itself handle linking in symbols found in the
linker itself? Or perhaps its a bug.

I'm somewhat perplexed about this..

Ed

cc  -shared -o libselinux.so.1 avc.lo avc_internal.lo avc_sidtab.lo
booleans.lo canonicalize_context.lo checkAccess.lo check_context.lo
compute_av.lo compute_create.lo compute_member.lo compute_relabel.lo
compute_user.lo context.lo disable.lo enabled.lo fgetfilecon.lo
freeconary.lo freecon.lo fsetfilecon.lo get_context_list.lo
get_default_type.lo getenforce.lo getfilecon.lo getpeercon.lo init.lo
is_customizable_type.lo lgetfilecon.lo load_policy.lo lsetfilecon.lo
matchmediacon.lo matchpathcon.lo policyvers.lo procattr.lo
query_user_context.lo rpm.lo selinux_check_securetty_context.lo
selinux_config.lo setenforce.lo setfilecon.lo setrans_client.lo
seusers.lo -ldl -lsepol -L/usr/lib
-Wl,-soname,libselinux.so.1,-z,defs,-z,relro
matchpathcon.lo(.text+0x166): In function `set_matchpathcon_flags':
/usr/src/redhat/BUILD/libselinux-1.33.4/src/matchpathcon.c:84:
undefined reference to `___tls_get_addr'
matchpathcon.lo(.text+0xa29): In function `process_line':
/usr/src/redhat/BUILD/libselinux-1.33.4/src/matchpathcon.c:564:
undefined reference to `___tls_get_addr'
matchpathcon.lo(.text+0xde3): In function `*matchpathcon_init_prefix_internal':
/usr/src/redhat/BUILD/libselinux-1.33.4/src/matchpathcon.c:623:
undefined reference to `___tls_get_addr'
matchpathcon.lo(.text+0x183b): In function `matchpathcon':
/usr/src/redhat/BUILD/libselinux-1.33.4/src/matchpathcon.c:845:
undefined reference to `___tls_get_addr'
matchpathcon.lo(.text+0x1ac3): In function `selinux_file_context_verify':
/usr/src/redhat/BUILD/libselinux-1.33.4/src/matchpathcon.c:926:
undefined reference to `___tls_get_addr'
matchpathcon.lo(.text+0x1bad):/usr/src/redhat/BUILD/libselinux-1.33.4/src/matchpathcon.c:956:
more undefined references to `___tls_get_addr' follow
collect2: ld returned 1 exit status

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

* Re: linker bug in gcc
  2011-06-03  4:30 linker bug in gcc Edward Peschko
@ 2011-06-03  5:53 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2011-06-03  5:53 UTC (permalink / raw)
  To: Edward Peschko; +Cc: gcc-help

Edward Peschko <horos11@gmail.com> writes:

> I was trying to compile a new version of libselinux, and ran across a
> weird error (attached). I tried a bunch of stuff, and finally searched
> all the libraries on the system for that symbol, which was found in
> /lib/ld-2.3.4.so.
>
> In desperation I added it explicitly on the command line, and it
> compiled. So. Is this just a bug in gcc and the linker chain?
> Shouldn't the linker itself handle linking in symbols found in the
> linker itself? Or perhaps its a bug.

/lib/ld-2.3.4.so is the dynamic linker.  It is not the linker.

> cc  -shared -o libselinux.so.1 avc.lo avc_internal.lo avc_sidtab.lo
> booleans.lo canonicalize_context.lo checkAccess.lo check_context.lo
> compute_av.lo compute_create.lo compute_member.lo compute_relabel.lo
> compute_user.lo context.lo disable.lo enabled.lo fgetfilecon.lo
> freeconary.lo freecon.lo fsetfilecon.lo get_context_list.lo
> get_default_type.lo getenforce.lo getfilecon.lo getpeercon.lo init.lo
> is_customizable_type.lo lgetfilecon.lo load_policy.lo lsetfilecon.lo
> matchmediacon.lo matchpathcon.lo policyvers.lo procattr.lo
> query_user_context.lo rpm.lo selinux_check_securetty_context.lo
> selinux_config.lo setenforce.lo setfilecon.lo setrans_client.lo
> seusers.lo -ldl -lsepol -L/usr/lib
> -Wl,-soname,libselinux.so.1,-z,defs,-z,relro
> matchpathcon.lo(.text+0x166): In function `set_matchpathcon_flags':
> /usr/src/redhat/BUILD/libselinux-1.33.4/src/matchpathcon.c:84:
> undefined reference to `___tls_get_addr'

Normally this will link against -lc, which on GNU/Linux will normally
mean /usr/lib/libc.so, which will normally explicitly link against the
dynamic linker under the name /lib/ld-linux-x86-64.so.2 or
/lib32/ld-linux.so.2.  You mentioned the name ld-2.3.4.so, though, which
is a fairly old version of glibc.  It's possible that the
/usr/lib/libc.so on your system doesn't refer to the dynamic linker.
Please check.  If so, then that fact in conjunction with your use of -z
defs is the cause of your problem.

Ian

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

end of thread, other threads:[~2011-06-03  5:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-03  4:30 linker bug in gcc Edward Peschko
2011-06-03  5:53 ` Ian Lance Taylor

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