www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23139] New: object files containing several big static

https://issues.dlang.org/show_bug.cgi?id=23139

          Issue ID: 23139
           Summary: object files containing several big static
                    initializers require --no-relax to link
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

For the  following code

```d
__gshared int[10000][10000] a;
__gshared int[10000][10000] b;
__gshared int[10000][10000] c;
__gshared int[10000][10000] d;
__gshared int[10000][10000] e;
__gshared int[10000][10000] f;
__gshared int[10000][10000] g;
void main(string[] args){}    
```

compiled without special argument, linking fails and an error message suggest
to add the argument `--no-relax`.

1. this suggests that "--relax" is passed to the linker
2. the problem does not happen when using a list in the declarator, e.g

```d
__gshared int[10000][10000] a,b,c,d,e,f,g;
void main(string[] args){}    
```

this suggests that the first version use distinct initializers for each
variable, which, if verified seems wrong, as here only the type specific
initializer is used.

3. with -L--no-relax linking always work. Is the compiler able to add this
argument dynamically ?

--
May 25 2022