Good evening everyone,

I discovered about one or two weeks ago that I can't link any debug
libraries on OpenBSD. At first I thought it was a cmake update[1] but
then I started digging further and it turns out its our gcc.

What threw me off is that gcc-4.7 from ports behaves the same way, but
I later discovered it's the same issue.

Anyway, the problem pops up when doing something like this:

-----------------------------------------------------------------------
$ cc -shared -fpic  -o libtest.so.0.0  `lorder test.so test1.so|tsort -q`
$
-----------------------------------------------------------------------

versus something like this:

-----------------------------------------------------------------------
$ cc -shared -fpic  -pg -o libtest.so.0.0  `lorder test.so test1.so|tsort -q`
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
0000000000400260
$
-----------------------------------------------------------------------

This used to work in the past and no longer does on -current.

I tested on a 5.1 system and the last command links libtest properly
without an error.

I tracked it down to the commit that enabled PIE support on OpenBSD.

I looked at the specs from other operating systems and Linux
distributions and I haven't found any -nopie references not only in the
libs section, but throughout the entire spec.

Thus I propose the following diff that removes the nopie bits.

An identical diff is needed for the ports tree and I will take care of
it if this is accepted. So comments, okays?

Cheers,
Paul Irofti


[1] -- http://marc.info/?l=openbsd-ports&m=136371733926696&w=2

Index: gcc/gcc.c
===================================================================
RCS file: /cvs/src/gnu/gcc/gcc/gcc.c,v
retrieving revision 1.2
diff -u -p -r1.2 gcc.c
--- gcc/gcc.c   28 Aug 2012 18:59:28 -0000      1.2
+++ gcc/gcc.c   26 Mar 2013 19:33:05 -0000
@@ -684,7 +684,7 @@ proper position among the other output f
 
 #ifndef LINK_PIE_SPEC
 #ifdef HAVE_LD_PIE
-#define LINK_PIE_SPEC "%{pie:-pie} %{p|pg|nopie:-nopie} "
+#define LINK_PIE_SPEC "%{pie:-pie} "
 #else
 #define LINK_PIE_SPEC "%{pie:} "
 #endif

Reply via email to