LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 12835 - regression(r156821): chromium components build broken due to changes in visibility handling
Summary: regression(r156821): chromium components build broken due to changes in visib...
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: C++ (show other bugs)
Version: unspecified
Hardware: PC All
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-15 15:07 PDT by Nico Weber
Modified: 2018-11-07 00:17 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments
repro (731 bytes, application/octet-stream)
2012-05-15 15:07 PDT, Nico Weber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Weber 2012-05-15 15:07:54 PDT
Created attachment 8568 [details]
repro

Compile the attachment with

clang++ -c repro.ii -fvisibility=hidden

then run `nm -m repro.o`.

gcc4.2 and clang prior to r156821 resulted in:

0000000000000000 (__DATA,__data) external __ZN18DeviceDataProviderI9RadioDataE17factory_function_E
                 (undefined) external __ZN18DeviceDataProviderI9RadioDataE22DefaultFactoryFunctionEv


clang with r156821 results in:


0000000000000000 (__DATA,__data) private external __ZN18DeviceDataProviderI9RadioDataE17factory_function_E
                 (undefined) external __ZN18DeviceDataProviderI9RadioDataE22DefaultFactoryFunctionEv


This breaks the chromium component build, target 'content_unittest' no longer links.





$ cat repro.ii

struct __attribute__((visibility("default"))) RadioData {};

class __attribute__((visibility("default"))) DeviceDataProviderImplBaseHack {};

template<typename DataType>
class DeviceDataProviderImplBase : public DeviceDataProviderImplBaseHack {};

template<typename DataType>
class DeviceDataProvider {
  typedef DeviceDataProviderImplBase<DataType>* (*ImplFactoryFunction)(void);
  __attribute__((visibility("default"))) static DeviceDataProviderImplBase<DataType>*       DefaultFactoryFunction();
  __attribute__((visibility("default"))) static ImplFactoryFunction factory_function_;
};

template<>
DeviceDataProvider<RadioData>::ImplFactoryFunction
    DeviceDataProvider<RadioData>::factory_function_ = DefaultFactoryFunction;
Comment 1 Rafael Ávila de Espíndola 2012-05-15 15:29:58 PDT
reduces to:


template<typename T>
struct foo {
  __attribute__((visibility("default"))) static int bar;
};

template<typename T>
int foo<T>::bar;

int f() {
  return foo<int>::bar;
}
Comment 2 Rafael Ávila de Espíndola 2012-05-15 21:11:57 PDT
Fixed in r156897.
Comment 3 Nico Weber 2012-05-15 23:03:25 PDT
Verified. Thanks!