Building with -O4 or -emit-llvm ignores -flto-api=exports.txt
ivanov-playkot opened this issue · 7 comments
As a result it's impossible to use -O4 or -emit-llvm with Console.as:
ReferenceError: Error #1065: Variable __start1 is not defined.
at com.adobe.flascc::CModule$/start()
at com.adobe.flascc::CModule$/startAsync()
at com.adobe.flascc::Console/init()
at com.adobe.flascc::Console()
at com.adobe.flascc.preloader::DefaultPreloader/onPreloaderComplete()
Compiling Console.as with clang?
No, you have to compile it with ASC.
Nope, I use Crossbridge_1.0.1 (MacOS X).
1.1.0 version is still beta and as far as I get it it doesn't support pthread API yet.
Command line of how I build Console.as (with custom command [CMake]):
COMMAND java -jar
Where AS_SRC contains all my action script code (except AGAL) and FLASH_IMPORTS is:
set(FLASH_IMPORTS
-import $ENV{FLASCC}/usr/lib/builtin.abc
-import $ENV{FLASCC}/usr/lib/ISpecialFile.abc
-import $ENV{FLASCC}/usr/lib/CModule.abc
-import $ENV{FLASCC}/usr/lib/playerglobal.abc
)
Then I link Console.abc as follows:
-symbol-abc=${CMAKE_CURRENT_BINARY_DIR}/Console.abc
What do you get from gcc with -v flags? Probably you missed crt1_c.o
Explicit linking of crt1_c.o (doesn't matter "$ENV{FLASCC}/usr/lib/stdlibs_abc/crt1_c.o" or "$ENV{FLASCC}/usr/lib/crt1_c.o") results in
/private/var/crossbridge/sdk/usr/bin/ld: error: /private/var/crossbridge/sdk/usr/bin/../../usr/lib/crt1_c.o: multiple definition of '__start1'
The reason of the lack of __start1 with -O4 is that this function is being automatically removed on linking as unused symbol and there is no way to prevent it. Everything is fine without -O4.
You can check it: the same problem is if you build Stage3D sample with -O4 so it's not my building issue.
With -O4, llvm will strip out all the symbols being without reference during LTO.
But for basic symbols used in Flascc, you have to keep it through -flto-api plus anyone you want to keep for your code.
Without O4 = without symbol stripping.
As to the sample, I run it without any issue. The sample itself is compiled with O4, isn't it?
Guess I didn't catch your question wholly.
Just if you use O4, then use it with flto-api.
Oh, it was my mistake (wrong path to exports.txt in -flto-api). I've understood that it's possible after your message that symbols are not being removed in non-O4 builds. Thank you.
Glad :D