2

When I compile a single file in Compiler Explorer I can see all the constants like string literals in the output window.

const char* ss = "abcdef"; 

E.g. here https://godbolt.org/z/hEzTG7d7c I clearly see:

.LC0: .string "abcdef" 

However, when I use Tree (IDE Mode) with multiple cpp files the string is not present in the final listing: https://godbolt.org/z/WPbv3v6G6

I understand that with multiple files there is also linker involved. But it is clear that the literal is still present in the binary:

 mov rbx,QWORD PTR [rip+0x2ee0] # 404018 <ss> 

It is just not shown by the Compiler Explorer.

I tried playing with "Output" and "Filter" checkboxes, but no luck. Is there a way to show it somehow?

1 Answer 1

2

In the compiler output window, use the "Add tool..." button to use strings or elfutils.

With elfutils, add '-p .rodata' as arguments:

String dump of section '.rodata': [ 4] abcdef 

Source from reddit.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.