This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gomp4.1] coerce libgomp to build with C++


Ughh... what was supposed to be a short hack turned out to be 2 days of pure torture.

So...I'm implementing task priorities as per the 4.1 standard, and decided to use a priority queue. Since we already have splay trees in libgomp, I figured these priority queues could be built on top of them. However, our libgomp splay tree adaptation is not exactly generic enough, so I started rewriting it to use C++ templates.

I quickly found out that libgomp is built with C, so I said to myself... "Self, how bad can it be to convert libgomp to C++?". Very.

I've pretty much renounced the splay tree in C++ idea, but only because I don't want to iron out the remaining automake/configury magic, not to mention possible ABI issues I've yet to uncover. However, throwing 2 days' worth of work away would be silly, so how about we pass -Wc++-compat and avoid further C/C++ divergence?

I have tested this patch as is, as well as with:

	AM_CFLAGS = $(XCFLAGS) -x c++

Using the C++ compiler compiles, but does not link:

/usr/bin/ld: .libs/loop.o: relocation R_X86_64_PC32 against undefined symbol `gomp_ialias_GOMP_parallel_end' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value

I really must get back to task priorities, so I'm not going to pursue C++ linking any further. However, the attached patch should get us 95% of the way there, and we can keep it going forward.

I could provide a trunk version of this, but considering gomp4.1 will get merged (*crosses fingers*), no sense in doing the work twice.

Most everything is obvious. The things that are not, or I'm unsure about, I have documented throughout.

OK for gomp4.1 branch?

Attachment: curr
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]