This is an archive of the discontinued LLVM Phabricator instance.

Fix openmp on PowerPC64-BE-ELFv2 ABI on FreeBSD
ClosedPublic

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

Details

Summary

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 (https://wiki.freebsd.org/powerpc/llvm-elfv2)

*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
openmp/runtime/src/z_Linux_asm.S
1370

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);
	 fflush(stdout);
 }

 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()
{
	foo(0);
}
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.