compiler-explorer / compiler-explorer

Run compilers interactively from your web browser and interact with the assembly
https://godbolt.org/
BSD 2-Clause "Simplified" License
16.33k stars 1.74k forks source link

[REQUEST] Refine directive filters #2471

Open skoehler opened 3 years ago

skoehler commented 3 years ago

I'm compiler the following code with ARM gcc 10.2.1 (none). I am using -O3 -mcpu=cortex-a9

int x;
int y;
void* test() {
  return &x;
}

The output is as follows:

test:
  movw r0, #:lower16:.LANCHOR0
  movt r0, #:upper16:.LANCHOR0
  bx lr
x:
y:

If I disable the directives filter, I get way too much information. This is partly due to the fact, that things seem to be compiled with debugging information enabled. It would be nice to have a Filter to only filter out all debugging directives.

However, in the above case, I cannot see the label .LANCHOR0. The problem here, is that the label is actually defined with the .set directive, namely as .set .LANCHOR0,. + 0.

Without enabling all directives, I also cannot tell anything about the memory layout. Directives like .space, .zero, .word, etc. are missing.

It's also very important which symbols are global or weak or which section they are in. Those directives are also missing.

I'm asking for a more refined set of filters. I usually wish to see more directives but I also wish to not see any debugging directives, for example.

I'm not sure if that is an easy task, but this would be worth the effort, IMHO.

partouf commented 3 years ago

Possibly related to https://github.com/compiler-explorer/compiler-explorer/issues/2409

mattgodbolt commented 3 years ago

Seems very closely related to that issue as you say Partouf; was going to close as duplicate but this request has more a request to see more directives. The problem I think is most of the time folks don't need to know about memory layouts; so .zero and .space are noise. Maybe we need a little more fine-grained configuration, or maybe I'm wrong and the .zero et al are actually not noisy and give useful information.

I'll be honest, when I want to see layouts I'll compile to binary and then I get to see the actual bytes that .align et al put in the binary, but that's an x86-eye view.

rmccampbell commented 4 months ago

Another thing is I would sometimes like to see the .section labels (though only the ones with non-filtered contents). I think that wouldn't add too much noise. Perhaps there could be a customizable list of directives to show/hide.