Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking target code fails when using gold #30

Open
pfaffe opened this issue Mar 17, 2016 · 5 comments
Open

Linking target code fails when using gold #30

pfaffe opened this issue Mar 17, 2016 · 5 comments

Comments

@pfaffe
Copy link

pfaffe commented Mar 17, 2016

Compiling and linking code using the target directives fails in the final linker step when gold is the linker.

Reproducing example:

int main() {
  double x[n];
  double y[n];

#pragma omp target data map(tofrom : x[0 : n], y[0 : n])
  {
#pragma omp target
#pragma omp for
    for (int i = 0; i < n; i++)
      y[i] += 1.2 * x[i];
  }
}

Clang invokation:
clang-3.8 -fopenmp -omptargets=nvptx64sm_30-nvidia-linux -g -O3 -std=c99 test.c -v

Result:

/usr/bin/ld: error: /tmp/a-192dbd.lk:22:8: syntax error, unexpected STRING
/usr/bin/ld: fatal error: unable to parse script file /tmp/a-192dbd.lk

Where /usr/bin/ld is ld.gold.

@ghost
Copy link

ghost commented Mar 17, 2016

Philip,

can you please provide the /tmp/a-192dbd.lk file?
The problem apparently is bfd-gold incompatibility, so we will redirect it.

Sergos

@pfaffe
Copy link
Author

pfaffe commented Mar 17, 2016

Here are the contents of the linker script:

TARGET(binary)
INPUT(/tmp/test-006862.so)
SECTIONS
{
  .openmptgt :
  ALIGN(0x10)
  {
    . = ALIGN(0x10);
    PROVIDE_HIDDEN(__omptgt__img_start_nvptx64sm_30_nvidia_linux = .);
    /tmp/test-006862.so
    PROVIDE_HIDDEN(__omptgt__img_end_nvptx64sm_30_nvidia_linux = .);
  }
  .openmptgt_host_entries :
  ALIGN(0x10)
  SUBALIGN(0x01)
  {
    PROVIDE_HIDDEN(__omptgt__host_entries_begin = .);
    *(.openmptgt_host_entries)
    PROVIDE_HIDDEN(__omptgt__host_entries_end = .);
  }
}
INSERT BEFORE .data

@carlobertolli
Copy link

Hi Sergos

I thought that the map Clause was not available yet in any case - can you please confirm?

Thanks

-- Carlo

Sent from my iPhone

On Mar 17, 2016, at 7:50 AM, Sergos [email protected] wrote:

Philip,

can you please provide the /tmp/a-192dbd.lk file?
The problem apparently is bfd-gold incompatibility, so we will redirect it.

Sergos


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@sfantao
Copy link

sfantao commented Mar 17, 2016

This is a known issue. The embedding of binaries into a fat binary is
controlled by this linker script, but gold does not support the full set of
directives ld does. I investigated this before and was unable to find
something that works well for gold.

The initial design of gold meant to not support any linker scripts. Then
they end up supporting some cases, but "INSERT BEFORE .data" is not one of
them if I remember correctly.

Thanks,
Samuel

From: Philip Pfaffe [email protected]
To: clang-omp/clang_trunk [email protected]
Date: 03/17/2016 07:58 AM
Subject: Re: [clang_trunk] Linking target code fails when using gold
(#30)

Here are the contents of the linker script:

TARGET(binary)
INPUT(/tmp/test-006862.so)
SECTIONS
{
.openmptgt :
ALIGN(0x10)
{
. = ALIGN(0x10);
PROVIDE_HIDDEN(__omptgt__img_start_nvptx64sm_30_nvidia_linux = .);
/tmp/test-006862.so
PROVIDE_HIDDEN(__omptgt__img_end_nvptx64sm_30_nvidia_linux = .);
}
.openmptgt_host_entries :
ALIGN(0x10)
SUBALIGN(0x01)
{
PROVIDE_HIDDEN(__omptgt__host_entries_begin = .);
*(.openmptgt_host_entries)
PROVIDE_HIDDEN(__omptgt__host_entries_end = .);
}
}
INSERT BEFORE .data


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@carlobertolli
Copy link

Hi Carlo,

I think this about the github version. Map clause is already there (and
most of the target stuff as well).

Thanks,
Samuel

From: Carlo Bertolli/Watson/IBM
To: "clang-omp/clang_trunk" <reply
+00094b3d268df7aef9403082e9f5d144b5b52d370be84a4792cf0000000113025c1492a169ce086ff069@reply.github.com>
Cc: Samuel F Antao/Watson/IBM@ibmus
Date: 03/17/2016 09:02 AM
Subject: Re: [clang_trunk] Linking target code fails when using gold
(#30)

Hi Sergos

I thought that the map Clause was not available yet in any case - can you
please confirm?

Thanks

-- Carlo

Sent from my iPhone

On Mar 17, 2016, at 7:50 AM, Sergos [email protected] wrote:

  Philip,


  can you please provide the /tmp/a-192dbd.lk file?
  The problem apparently is bfd-gold incompatibility, so we will
  redirect it.


  Sergos


  —
  You are receiving this because you are subscribed to this thread.
  Reply to this email directly or view it on GitHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants