[llvm-bugs] [Bug 48192] New: Issue with Bad Hidden Symbol Linkage (__start/stop___objc_constant_string) in Objective-C 2.0 with Gnustep

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 16 12:05:04 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48192

            Bug ID: 48192
           Summary: Issue with Bad Hidden Symbol Linkage
                    (__start/stop___objc_constant_string) in Objective-C
                    2.0 with Gnustep
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: austin.chase.m at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 24167
  --> https://bugs.llvm.org/attachment.cgi?id=24167&action=edit
LLD Log for compiling the first program

Ubuntu 20.04

clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Compile Command:
clang -x objective-c $(gnustep-config --objc-libs & gnustep-config
--objc-flags) -lgnustep-base -fuse-ld=lld test.m

Description:
When compiling a simple test case of Objective-C with Clang, I ran into the
following errors.

ld.lld: error: undefined hidden symbol: __start___objc_constant_string
>>> referenced by test.m
>>>               /tmp/test-564724.o:(.objc_init)

ld.lld: error: undefined hidden symbol: __stop___objc_constant_string
>>> referenced by test.m
>>>               /tmp/test-564724.o:(.objc_init)

These issues persit for lld, ld, and gold linkers.

The sample program to reproduce the bug is bellow.

```objc
#import<Foundation/Foundation.h>

int main() {
   BOOL condition = NO;
   while(condition) {
      NSLog(@"123456789");
   }
}
```

There also appears to be some interaction with the internals of
NSConstantString (@-strings) and Clang optimization. I theorize this because
the following cases compile and run correctly. The first case suggests
something due to NSConstantString. On 64-bit systems, a pointer can hold 8
bytes which is 1-8. The second case has more than 8 bytes but Clang appears to
handle it differently. This could be due to the first example optimizing out
the loop but keeping residual constant string data or the second case
optimizing to an infinite loop.

```objc
#import<Foundation/Foundation.h>

int main() {
  BOOL condition = NO;
  while(condition) {
    NSLog(@"12345678");
  }
}
```

```objc
#import<Foundation/Foundation.h>

int main() {
  BOOL condition = YES;
  while(condition) {
    NSLog(@"123456789");
  }
}
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201116/4995e140/attachment.html>


More information about the llvm-bugs mailing list