This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp4] Add tables generation
- From: Ilya Verbin <iverbin at gmail dot com>
- To: Bernd Schmidt <bernds at codesourcery dot com>, Jakub Jelinek <jakub at redhat dot com>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Michael Zolotukhin <michael dot v dot zolotukhin at gmail dot com>
- Date: Tue, 6 May 2014 19:32:04 +0400
- Subject: Re: [gomp4] Add tables generation
- Authentication-results: sourceware.org; auth=none
- References: <532B1C45 dot 9020308 at codesourcery dot com> <20140320185619 dot GN1817 at tucnak dot redhat dot com> <532C5729 dot 5050101 at codesourcery dot com> <20140321152053 dot GS1817 at tucnak dot redhat dot com> <533E7BC9 dot 8000504 at codesourcery dot com> <87lhvjhl6e dot fsf at kepler dot schwinge dot homeip dot net> <53401FA1 dot 2060407 at codesourcery dot com>
On 05 Apr 17:22, Bernd Schmidt wrote:
> Things seemed to work over here, but now I'm not certain whether the
> __start_/__stop_ functionality is GNU ld specific? Maybe we should
> just go back to the previous version of this patch which didn't try
> to use this.
>
> Bernd
This approach does not work with shared libraries.
The automatically inserted symbols have GLOBAL binding, therefore the
__start_/__stop_ from the executable overwrite the respective symbols in DSO.
Here is a simple example with 2 DSOs and one executable. The function
GOMP_offload_register is called with the following pointers in HOST_TABLE:
1. (funcs 0x604880:0x604898, vars 0x604840:0x604880)
2. (funcs 0x604880:0x604898, vars 0x604840:0x604880)
3. (funcs 0x604880:0x604898, vars 0x604840:0x604880)
But with "manually" added start/stop and LOCAL binding everything works fine:
1. (funcs 0x7f286b425530:0x7f286b425540, vars 0x7f286b425540:0x7f286b425540)
2. (funcs 0x7f286b8624a0:0x7f286b8624b0, vars 0x7f286b8624b0:0x7f286b8624b0)
3. (funcs 0x604760:0x604778, vars 0x604780:0x6047c0)
-- Ilya