I assume you can rewrite the code from switch to if/else before compiling with go/ast package. If that is not your case, hacking the go compiler is a harder solution, you probably don't want to do that.
On Thu, 28 Nov 2024 at 17:12, 'Karolina GORNA' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Hello everyone, > > Thank you @Keith for the suggestion. I tried with *"go build -gcflags='-N > -l''"* but I still have jump tables like > *"switchD_004010a2::switchdataD_004bc900"* with cases like > *switchD_004010a2::caseD_11* ; *switchD_004010a2::caseD_12*... that are > in the .rodata section. > > @Ian, ok I understand thank you. I am working on Go binary analysis and > this feature would help a lot. > > Best > > On Thursday, November 28, 2024 at 1:48:29 AM UTC+1 Keith Randall wrote: > >> Passing the -N flag will disable optimizations, which includes jump >> tables. >> >> On Wednesday, November 27, 2024 at 1:42:14 PM UTC-8 Ian Lance Taylor >> wrote: >> >>> On Wed, Nov 27, 2024 at 5:48 AM 'Karolina GORNA' via golang-nuts >>> <golan...@googlegroups.com> wrote: >>> > >>> > I wondered if there is a similar command to gcc -fno-jump-tables -o >>> output_file source_file.c to compile Go code without jump tables but only >>> with if/else statements (binary search) please ? >>> >>> Sorry, there is no such option for the usual Go compiler. >>> >>> Why do you want it? >>> >>> Ian >>> >> > ------------------------------ > Les informations contenues dans ce message électronique ainsi que celles > contenues dans les documents attachés sont strictement confidentielles et > sont destinées à l'usage exclusif du (des) destinataire(s) nommé(s). > Toute divulgation, distribution ou reproduction, même partielle, en est > strictement interdite sauf autorisation écrite et expresse de l’émetteur. > Si vous recevez ce message par erreur, veuillez le notifier immédiatement > à son émetteur par retour, et le détruire ainsi que tous les documents qui > y sont attachés. > > The information contained in this email and in any document enclosed is > strictly confidential and is intended solely for the use of the individual > or entity to which it is addressed. > Partial or total disclosure, distribution or reproduction of its contents > is strictly prohibited unless expressly approved in writing by the sender. > If you have received this communication in error, please notify us > immediately by responding to this email, and then delete the message and > its attached files from your system. > ------------------------------ > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/golang-nuts/af196a67-a159-4c3a-8636-ef2d4941ae85n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/af196a67-a159-4c3a-8636-ef2d4941ae85n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/CA%2BhP-7vzi%3D81a43QHtb-A--%2BnmWYxMrV5tN%2BMfsPkTiN9d5Qow%40mail.gmail.com.