LTO and EABI enum size
Hi,
I am trying to partially link a project into a single object file, that I will later archive into a static library. The object file needs to be linked against code generated with full-sized enums.
I am passing -fno-short-enums when compiling all object files.
I'd like to enable link-time optimization while performing the partial link step.
If I build the project with -flto, then the output file has the Tag_ABI_enum_size = small elf attribute. Leaving out -flto is enough to get a Tag_ABI_enum_size = int attribute.
I was able to boil the issue down to a minimal example. I have two trivial source files
obj1.cc:
int x(int y)
{
return y - 10;
}
obj2.cc:
int foo(int bar)
{
return bar*10;
}
and I compile each source file using
$ arm-none-
$ arm-none-
If I link them without -flto, link time optimization is not invoked, and I get an object file marked as having int-sized enums:
$ arm-none-
$ arm-none-
Tag_
But if I simply add -flto to the linker invocation, the output claims that it has small enums:
$ arm-none-
$ arm-none-
Tag_
If I run the link step with `-v`, I can see this when gcc gets to the lto stage:
Thread model: single
gcc version 4.8.3 20140228 (release) [ARM/embedded-
COLLECT_
/usr/bin/
It sure looks to me like something removed `-fno-short-enums` from `COLLECT_
Is this a bug? How can I use gcc's link-time optimization while generating code without short enums?
Thanks,
Bobby
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: