This is an archive of the discontinued LLVM Phabricator instance.

Fix openmp on PowerPC64-BE-ELFv2 ABI on FreeBSD

Authored by adalava on Sep 4 2019, 11:48 AM.



openmp library incorrectly assumes OpenPower ELF v2 ABI is only used on little endian systems. This is not true, since ELFv2 ABI supports both big and little.

This patch correct this assumption by checking CALL_ELF variable instead of endiannes, and unbreaks openmp on FreeBSD/powerpc64-ELFv2 port (

*I set the reviewers based on git log. Please feel free to change.

Diff Detail

Event Timeline

adalava created this revision.Sep 4 2019, 11:48 AM
brooks added a subscriber: brooks.Sep 12 2019, 12:40 AM
hbae added inline comments.Sep 13 2019, 7:43 AM

Change V2 to v2.

Is there a good way to test this? If so, we should, if not, this seems fine to me (except the typo @hbae found).

adalava added a comment.EditedSep 19 2019, 3:52 PM

Is there a good way to test this? If so, we should, if not, this seems fine to me (except the typo @hbae found).

I checked openmp sanity by running the code bellow. It runs now, before patch it crashed with segmentation fault.

I'm not sure we could do an automated test on llvm side. Any idea/guidance is welcome.

#include <stdio.h>

void bar(int i, float p, double q){
	 printf("%d %f %f\n", i, p, q);

 void foo(int N) {
 	float p = 3;
 	double q = 5;
 	N = 7;

	#pragma omp parallel for firstprivate(q)
	for (int i = 2; i < N; i++) {
		bar(i, p, q);

int main()
adalava updated this revision to Diff 220915.Sep 19 2019, 3:58 PM

update fixing the typo found during review.

thanks !

adalava marked an inline comment as done.Sep 19 2019, 4:01 PM
This revision is now accepted and ready to land.Sep 27 2019, 7:11 AM

As I'm not a commiter, may someone commit it, if it's the case, please?

note for myself: this patch is already integrated to FreeBSD src base.

This revision was automatically updated to reflect the committed changes.