The abi-breaking.h seems to be incompatible with modules, owing to it having strong definitions in the header. I'm wondering if I can make it compatible by changing the: __attribute__((weak, visibility("hidden"))) variables to __attribute__((used)) static variables instead? It still seems to produce the desired link errors in my basic tests. Does that seem plausible to you? (modules have a special case for static variables in headers to support things like the iostreams initializer) Not sure why the modules buildbots don't see this but google's internal build system building with modules does... - Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171128/20511715/attachment.html>
How can a "weak" definition be a "strong" one!? ;) I think the reason for "weak" was to not duplicate it. A static would be duplicated in every translation unit that includes the header right? I don't know what it means in terms of extra number of relocation, etc. Also the attribute used will prevent the linker from dead-stripping the symbol in case of static linking and/or when using LTO. -- Mehdi 2017-11-28 14:35 GMT-08:00 David Blaikie <dblaikie at gmail.com>:> The abi-breaking.h seems to be incompatible with modules, owing to it > having strong definitions in the header. > > I'm wondering if I can make it compatible by changing the: > > __attribute__((weak, visibility("hidden"))) variables to > __attribute__((used)) static variables instead? It still seems to produce > the desired link errors in my basic tests. Does that seem plausible to you? > > (modules have a special case for static variables in headers to support > things like the iostreams initializer) > > Not sure why the modules buildbots don't see this but google's internal > build system building with modules does... > > - Dave >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171128/f685accd/attachment.html>
"strong" was wrong/unnecessary, sorry. *looks more closely* Ah, totally my mistake - abi-breaking.h wasn't being built as a modular header, so it'd be included into two other modular headers, those two header modules would be imported together & the two definitions would conflict. But if it's actually built as its own module there's no duplication & it's fine (probably explains why the modules buildbots are fine). Sorry for the noise! Carry on! - Dave On Tue, Nov 28, 2017 at 9:31 PM Mehdi AMINI <joker.eph at gmail.com> wrote:> How can a "weak" definition be a "strong" one!? ;) > > I think the reason for "weak" was to not duplicate it. A static would be > duplicated in every translation unit that includes the header right? I > don't know what it means in terms of extra number of relocation, etc. > Also the attribute used will prevent the linker from dead-stripping the > symbol in case of static linking and/or when using LTO. > > -- > Mehdi > > > 2017-11-28 14:35 GMT-08:00 David Blaikie <dblaikie at gmail.com>: > >> The abi-breaking.h seems to be incompatible with modules, owing to it >> having strong definitions in the header. >> >> I'm wondering if I can make it compatible by changing the: >> >> __attribute__((weak, visibility("hidden"))) variables to >> __attribute__((used)) static variables instead? It still seems to produce >> the desired link errors in my basic tests. Does that seem plausible to you? >> >> (modules have a special case for static variables in headers to support >> things like the iostreams initializer) >> >> Not sure why the modules buildbots don't see this but google's internal >> build system building with modules does... >> >> - Dave >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171129/5da8a733/attachment.html>