[Sdcc-user] Linker Searches Wrong libdir with --xstack?

I decided to experiment with --model-huge --stack-auto --xstack so I builtfrom sources on Linux (Ubuntu 10.04).

Does sdcc ignore --xstack when auto-appending to the libdir? Looks like itsearches into huge-stack-auto instead of huge-xstack-auto (same for large).

I'm sending you details of how I built the compiler, what happened when Itried to build my project and the output of --print-search-dirs with variouscombinations of arguments. I'm also sending you info of what I did to fixthis.

Am I doing something really wrong here or is this a bug?

Thanks ever so much for reading this, all. Any tips would be appreciated.

So, it appears that the --xstack option is being ignored when auto-appendingto the libdir? Should it not automatically look into <model>-xstackinstead? This appears to be the case with --model-large too.

At the start I fixed this by deleting the huge-stack-auto librariesdirectory and specifying the correct one through -L. This doesn't really help though because we then can't turn --xstack off.

Lastly, I looked at the sdcc sources, src/mcs51/main.c and did this at line735 in revision 5844

This appears to have sorted it. lbdir is now reported correctly for model-huge --stack-auto both with as well as without --xstack.sdcc --model-huge --stack-auto --xstack --print-search-dirs...libdir:/usr/local/bin/../share/sdcc/lib/huge-xstack-auto/usr/local/share/sdcc/lib/huge-xstack-auto

[Sdcc-user] Linker Searches Wrong libdir with --xstack?

Hi George,

can you please submit this report to the sdcc bug tracker:http://sourceforge.net/tracker/?group_id=599&atid=100599Thanks,Borut

On 06/18/2010 07:45 PM, George Oikonomou wrote:> Hello all,>> I decided to experiment with --model-huge --stack-auto --xstack so I built> from sources on Linux (Ubuntu 10.04).>> Does sdcc ignore --xstack when auto-appending to the libdir? Looks like it> searches into huge-stack-auto instead of huge-xstack-auto (same for large).>> I'm sending you details of how I built the compiler, what happened when I> tried to build my project and the output of --print-search-dirs with various> combinations of arguments. I'm also sending you info of what I did to fix> this.>> Am I doing something really wrong here or is this a bug?>> Thanks ever so much for reading this, all. Any tips would be appreciated.>> Warm regards> George>>> sdcc -v> SDCC : mcs51 2.9.7 #5844 (Jun 18 2010) (Linux)>> I configured with:> ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port > --disable-ds400-port> --disable-pic-port --disable-pic16-port --disable-hc08-port>> Then I ran make>> Then I moved into device/lib, added huge and removed small and medium from> incl.mk. Then:> make model-mcs51-stack-auto> make model-mcs51-xstack-auto>> After I installed, my library path had the following (among others):> huge-stack-auto> huge-xstack-auto> large-stack-auto> large-xstack-auto>> However, when I compiled my project with --model-huge --stack-auto --xstack> , the linker started complaining about incorrect library build options (just> a sample here, repeated many times):> ?ASlink-Warning-Conflicting sdcc options:> "-mmcs51 --model-huge --xstack" in module "contiki_sensinode_main" and> "-mmcs51 --model-huge" in module "_gptrput".>> But I was certain I had built libraries correctly so I started looking into> the default library search paths through --print-search-dirs:>> sdcc --model-huge --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge> /usr/local/share/sdcc/lib/huge>> sdcc --model-huge --stack-auto --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-stack-auto> /usr/local/share/sdcc/lib/huge-stack-auto>> sdcc --model-huge --stack-auto --xstack --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-stack-auto> /usr/local/share/sdcc/lib/huge-stack-auto>> So, it appears that the --xstack option is being ignored when auto-appending> to the libdir? Should it not automatically look into<model>-xstack> instead? This appears to be the case with --model-large too.>> At the start I fixed this by deleting the huge-stack-auto libraries> directory and specifying the correct one through -L. This doesn't really> help though because we then can't turn --xstack off.>> Lastly, I looked at the sdcc sources, src/mcs51/main.c and did this at line> 735 in revision 5844>> --- main.c 2010-06-18 18:23:43.000000000 +0100> +++ main-xstack.c 2010-06-18 18:23:16.000000000 +0100> @@ -733,8 +733,12 @@> return "large";>> case MODEL_HUGE:> - if (options.stackAuto)> + if (options.stackAuto) {> + if (options.useXstack) {> + return "huge-xstack-auto";> + }> return "huge-stack-auto";> + }> else> return "huge";>>> This appears to have sorted it. lbdir is now reported correctly for> model-huge --stack-auto both with as well as without --xstack.> sdcc --model-huge --stack-auto --xstack --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-xstack-auto> /usr/local/share/sdcc/lib/huge-xstack-auto>> ________________________________> George Oikonomou>> Post-Doc Research Associate> Computer Science,> Loughborough University.>> Email: g.oikono***@*boro.ac.uk> Web:http://www.spd.gr> ________________________________>>> > Sdcc-user mailing list> Sdcc-u***@*ists.sourceforge.net>https://lists.sourceforge.net/lists/listinfo/sdcc-user>>

[Sdcc-user] Linker Searches Wrong libdir with --xstack?

Hi George,

can you please submit this report to the sdcc bug tracker:http://sourceforge.net/tracker/?group_id=599&atid=100599Thanks,Borut

On 06/18/2010 07:45 PM, George Oikonomou wrote:> Hello all,>> I decided to experiment with --model-huge --stack-auto --xstack so I built> from sources on Linux (Ubuntu 10.04).>> Does sdcc ignore --xstack when auto-appending to the libdir? Looks like it> searches into huge-stack-auto instead of huge-xstack-auto (same for large).>> I'm sending you details of how I built the compiler, what happened when I> tried to build my project and the output of --print-search-dirs with various> combinations of arguments. I'm also sending you info of what I did to fix> this.>> Am I doing something really wrong here or is this a bug?>> Thanks ever so much for reading this, all. Any tips would be appreciated.>> Warm regards> George>>> sdcc -v> SDCC : mcs51 2.9.7 #5844 (Jun 18 2010) (Linux)>> I configured with:> ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port > --disable-ds400-port> --disable-pic-port --disable-pic16-port --disable-hc08-port>> Then I ran make>> Then I moved into device/lib, added huge and removed small and medium from> incl.mk. Then:> make model-mcs51-stack-auto> make model-mcs51-xstack-auto>> After I installed, my library path had the following (among others):> huge-stack-auto> huge-xstack-auto> large-stack-auto> large-xstack-auto>> However, when I compiled my project with --model-huge --stack-auto --xstack> , the linker started complaining about incorrect library build options (just> a sample here, repeated many times):> ?ASlink-Warning-Conflicting sdcc options:> "-mmcs51 --model-huge --xstack" in module "contiki_sensinode_main" and> "-mmcs51 --model-huge" in module "_gptrput".>> But I was certain I had built libraries correctly so I started looking into> the default library search paths through --print-search-dirs:>> sdcc --model-huge --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge> /usr/local/share/sdcc/lib/huge>> sdcc --model-huge --stack-auto --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-stack-auto> /usr/local/share/sdcc/lib/huge-stack-auto>> sdcc --model-huge --stack-auto --xstack --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-stack-auto> /usr/local/share/sdcc/lib/huge-stack-auto>> So, it appears that the --xstack option is being ignored when auto-appending> to the libdir? Should it not automatically look into<model>-xstack> instead? This appears to be the case with --model-large too.>> At the start I fixed this by deleting the huge-stack-auto libraries> directory and specifying the correct one through -L. This doesn't really> help though because we then can't turn --xstack off.>> Lastly, I looked at the sdcc sources, src/mcs51/main.c and did this at line> 735 in revision 5844>> --- main.c 2010-06-18 18:23:43.000000000 +0100> +++ main-xstack.c 2010-06-18 18:23:16.000000000 +0100> @@ -733,8 +733,12 @@> return "large";>> case MODEL_HUGE:> - if (options.stackAuto)> + if (options.stackAuto) {> + if (options.useXstack) {> + return "huge-xstack-auto";> + }> return "huge-stack-auto";> + }> else> return "huge";>>> This appears to have sorted it. lbdir is now reported correctly for> model-huge --stack-auto both with as well as without --xstack.> sdcc --model-huge --stack-auto --xstack --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-xstack-auto> /usr/local/share/sdcc/lib/huge-xstack-auto>> ________________________________> George Oikonomou>> Post-Doc Research Associate> Computer Science,> Loughborough University.>> Email: g.oikono***@*boro.ac.uk> Web:http://www.spd.gr> ________________________________>

[Sdcc-user] Linker Searches Wrong libdir with --xstack?

Hi George,

can you please submit this report to the sdcc bug tracker:http://sourceforge.net/tracker/?group_id=599&atid=100599Thanks,Borut

On 06/18/2010 07:45 PM, George Oikonomou wrote:> Hello all,>> I decided to experiment with --model-huge --stack-auto --xstack so I built> from sources on Linux (Ubuntu 10.04).>> Does sdcc ignore --xstack when auto-appending to the libdir? Looks like it> searches into huge-stack-auto instead of huge-xstack-auto (same for large).>> I'm sending you details of how I built the compiler, what happened when I> tried to build my project and the output of --print-search-dirs with various> combinations of arguments. I'm also sending you info of what I did to fix> this.>> Am I doing something really wrong here or is this a bug?>> Thanks ever so much for reading this, all. Any tips would be appreciated.>> Warm regards> George>>> sdcc -v> SDCC : mcs51 2.9.7 #5844 (Jun 18 2010) (Linux)>> I configured with:> ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port > --disable-ds400-port> --disable-pic-port --disable-pic16-port --disable-hc08-port>> Then I ran make>> Then I moved into device/lib, added huge and removed small and medium from> incl.mk. Then:> make model-mcs51-stack-auto> make model-mcs51-xstack-auto>> After I installed, my library path had the following (among others):> huge-stack-auto> huge-xstack-auto> large-stack-auto> large-xstack-auto>> However, when I compiled my project with --model-huge --stack-auto --xstack> , the linker started complaining about incorrect library build options (just> a sample here, repeated many times):> ?ASlink-Warning-Conflicting sdcc options:> "-mmcs51 --model-huge --xstack" in module "contiki_sensinode_main" and> "-mmcs51 --model-huge" in module "_gptrput".>> But I was certain I had built libraries correctly so I started looking into> the default library search paths through --print-search-dirs:>> sdcc --model-huge --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge> /usr/local/share/sdcc/lib/huge>> sdcc --model-huge --stack-auto --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-stack-auto> /usr/local/share/sdcc/lib/huge-stack-auto>> sdcc --model-huge --stack-auto --xstack --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-stack-auto> /usr/local/share/sdcc/lib/huge-stack-auto>> So, it appears that the --xstack option is being ignored when auto-appending> to the libdir? Should it not automatically look into<model>-xstack> instead? This appears to be the case with --model-large too.>> At the start I fixed this by deleting the huge-stack-auto libraries> directory and specifying the correct one through -L. This doesn't really> help though because we then can't turn --xstack off.>> Lastly, I looked at the sdcc sources, src/mcs51/main.c and did this at line> 735 in revision 5844>> --- main.c 2010-06-18 18:23:43.000000000 +0100> +++ main-xstack.c 2010-06-18 18:23:16.000000000 +0100> @@ -733,8 +733,12 @@> return "large";>> case MODEL_HUGE:> - if (options.stackAuto)> + if (options.stackAuto) {> + if (options.useXstack) {> + return "huge-xstack-auto";> + }> return "huge-stack-auto";> + }> else> return "huge";>>> This appears to have sorted it. lbdir is now reported correctly for> model-huge --stack-auto both with as well as without --xstack.> sdcc --model-huge --stack-auto --xstack --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-xstack-auto> /usr/local/share/sdcc/lib/huge-xstack-auto>> ________________________________> George Oikonomou>> Post-Doc Research Associate> Computer Science,> Loughborough University.>> Email: g.oikono***@*boro.ac.uk> Web:http://www.spd.gr> ________________________________>

[Sdcc-user] Linker Searches Wrong libdir with --xstack?

Hello George,

You're right that SDCC doesn't adjust the librarry search path when --xstack is used. As a work-around you can use --nostdlib to suppress the default path and add -L/usr/local/share/sdcc/lib/huge-xstack-auto to point to the proper library. There is no need to remove the huge-stack-auto directory.

HTH,Maarten

> Hello all,> > I decided to experiment with --model-huge --stack-auto --xstack so I built> from sources on Linux (Ubuntu 10.04).> > Does sdcc ignore --xstack when auto-appending to the libdir? Looks like it> searches into huge-stack-auto instead of huge-xstack-auto (same for large).> > I'm sending you details of how I built the compiler, what happened when I> tried to build my project and the output of --print-search-dirs with various> combinations of arguments. I'm also sending you info of what I did to fix> this.> > Am I doing something really wrong here or is this a bug?> > Thanks ever so much for reading this, all. Any tips would be appreciated.> > Warm regards> George> > > sdcc -v> SDCC : mcs51 2.9.7 #5844 (Jun 18 2010) (Linux)> > I configured with:> ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port > --disable-ds400-port> --disable-pic-port --disable-pic16-port --disable-hc08-port> > Then I ran make> > Then I moved into device/lib, added huge and removed small and medium from> incl.mk. Then:> make model-mcs51-stack-auto> make model-mcs51-xstack-auto> > After I installed, my library path had the following (among others):> huge-stack-auto> huge-xstack-auto> large-stack-auto> large-xstack-auto> > However, when I compiled my project with --model-huge --stack-auto --xstack> , the linker started complaining about incorrect library build options (just> a sample here, repeated many times):> ?ASlink-Warning-Conflicting sdcc options:> "-mmcs51 --model-huge --xstack" in module "contiki_sensinode_main" and> "-mmcs51 --model-huge" in module "_gptrput".> > But I was certain I had built libraries correctly so I started looking into> the default library search paths through --print-search-dirs:> > sdcc --model-huge --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge> /usr/local/share/sdcc/lib/huge> > sdcc --model-huge --stack-auto --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-stack-auto> /usr/local/share/sdcc/lib/huge-stack-auto> > sdcc --model-huge --stack-auto --xstack --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-stack-auto> /usr/local/share/sdcc/lib/huge-stack-auto> > So, it appears that the --xstack option is being ignored when auto-appending> to the libdir? Should it not automatically look into <model>-xstack> instead? This appears to be the case with --model-large too.> > At the start I fixed this by deleting the huge-stack-auto libraries> directory and specifying the correct one through -L. This doesn't really > help though because we then can't turn --xstack off.> > Lastly, I looked at the sdcc sources, src/mcs51/main.c and did this at line> 735 in revision 5844> > --- main.c 2010-06-18 18:23:43.000000000 +0100> +++ main-xstack.c 2010-06-18 18:23:16.000000000 +0100> @@ -733,8 +733,12 @@> return "large";> > case MODEL_HUGE:> - if (options.stackAuto)> + if (options.stackAuto) {> + if (options.useXstack) {> + return "huge-xstack-auto";> + }> return "huge-stack-auto";> + }> else> return "huge";> > > This appears to have sorted it. lbdir is now reported correctly for > model-huge --stack-auto both with as well as without --xstack.> sdcc --model-huge --stack-auto --xstack --print-search-dirs> ...> libdir:> /usr/local/bin/../share/sdcc/lib/huge-xstack-auto> /usr/local/share/sdcc/lib/huge-xstack-auto> > ________________________________> George Oikonomou> > Post-Doc Research Associate> Computer Science,> Loughborough University.> > Email: g.oikono***@*boro.ac.uk> Web:http://www.spd.gr> ________________________________>

[Sdcc-user] Linker Searches Wrong libdir with --xstack?

Hello all,

Thanks for the replies.

Maarten, I did try with -L at the start and as expected it got confused by multiple symbol definitions. Then I used --nostdlib and the linker started failing to find various things, for example:?ASlink-Warning-Undefined Global '__sdcc_banked_call' referenced by module 'putchar'?ASlink-Warning-Undefined Global '___fssub' referenced by module 'printf_large'

Turns out that with --nostdlib, I need to add -lmcs51.lib -llibfloat.lib -lliblong.lib -llibint.lib for it to link properly. Makes sense, only I didn't think of trying that at the time so I just nuked the unused libraries.

> Hello George,>> You're right that SDCC doesn't adjust the librarry> search path when --xstack is used. As a work-around you> can use --nostdlib to suppress the default path and add> -L/usr/local/share/sdcc/lib/huge-xstack-auto to point to> the proper library. There is no need to remove the huge-> stack-auto directory.>> HTH,> Maarten>>> Hello all,>>>> I decided to experiment with --model-huge --stack-auto --xstack so I >> built>> from sources on Linux (Ubuntu 10.04).>>>> Does sdcc ignore --xstack when auto-appending to the libdir? Looks like >> it>> searches into huge-stack-auto instead of huge-xstack-auto (same for >> large).>>>> I'm sending you details of how I built the compiler, what happened when I>> tried to build my project and the output of --print-search-dirs with >> various>> combinations of arguments. I'm also sending you info of what I did to fix>> this.>>>> Am I doing something really wrong here or is this a bug?>>>> Thanks ever so much for reading this, all. Any tips would be appreciated.>>>> Warm regards>> George>>>>>> sdcc -v>> SDCC : mcs51 2.9.7 #5844 (Jun 18 2010) (Linux)>>>> I configured with:>> ./configure --disable-gbz80-port --disable-z80-port --disable-ds390-port >> --disable-ds400-port>> --disable-pic-port --disable-pic16-port --disable-hc08-port>>>> Then I ran make>>>> Then I moved into device/lib, added huge and removed small and medium >> from>> incl.mk. Then:>> make model-mcs51-stack-auto>> make model-mcs51-xstack-auto>>>> After I installed, my library path had the following (among others):>> huge-stack-auto>> huge-xstack-auto>> large-stack-auto>> large-xstack-auto>>>> However, when I compiled my project >> with --model-huge --stack-auto --xstack>> , the linker started complaining about incorrect library build options >> (just>> a sample here, repeated many times):>> ?ASlink-Warning-Conflicting sdcc options:>> "-mmcs51 --model-huge --xstack" in module "contiki_sensinode_main" and>> "-mmcs51 --model-huge" in module "_gptrput".>>>> But I was certain I had built libraries correctly so I started looking >> into>> the default library search paths through --print-search-dirs:>>>> sdcc --model-huge --print-search-dirs>> ...>> libdir:>> /usr/local/bin/../share/sdcc/lib/huge>> /usr/local/share/sdcc/lib/huge>>>> sdcc --model-huge --stack-auto --print-search-dirs>> ...>> libdir:>> /usr/local/bin/../share/sdcc/lib/huge-stack-auto>> /usr/local/share/sdcc/lib/huge-stack-auto>>>> sdcc --model-huge --stack-auto --xstack --print-search-dirs>> ...>> libdir:>> /usr/local/bin/../share/sdcc/lib/huge-stack-auto>> /usr/local/share/sdcc/lib/huge-stack-auto>>>> So, it appears that the --xstack option is being ignored when >> auto-appending>> to the libdir? Should it not automatically look into >> <model>-xstack>> instead? This appears to be the case with --model-large too.>>>> At the start I fixed this by deleting the huge-stack-auto libraries>> directory and specifying the correct one through -L. This doesn't really>> help though because we then can't turn --xstack off.>>>> Lastly, I looked at the sdcc sources, src/mcs51/main.c and did this at >> line>> 735 in revision 5844>>>> --- main.c 2010-06-18 18:23:43.000000000 +0100>> +++ main-xstack.c 2010-06-18 18:23:16.000000000 +0100>> @@ -733,8 +733,12 @@>> return "large";>>>> case MODEL_HUGE:>> - if (options.stackAuto)>> + if (options.stackAuto) {>> + if (options.useXstack) {>> + return "huge-xstack-auto";>> + }>> return "huge-stack-auto";>> + }>> else>> return "huge";>>>>>> This appears to have sorted it. lbdir is now reported correctly for>> model-huge --stack-auto both with as well as without --xstack.>> sdcc --model-huge --stack-auto --xstack --print-search-dirs>> ...>> libdir:>> /usr/local/bin/../share/sdcc/lib/huge-xstack-auto>> /usr/local/share/sdcc/lib/huge-xstack-auto>>>> ________________________________>> George Oikonomou>>>> Post-Doc Research Associate>> Computer Science,>> Loughborough University.>>>> Email: g.oikono***@*boro.ac.uk>> Web:http://www.spd.gr>> ________________________________>>>>> > Sdcc-user mailing list> Sdcc-u***@*ists.sourceforge.net>https://lists.sourceforge.net/lists/listinfo/sdcc-user>