Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C(PP)FLAGS do not seem to percolate during 16bits and 64bits syscall compilation #22

Closed
AlexGhiti opened this issue Oct 29, 2014 · 3 comments

Comments

@AlexGhiti
Copy link

Hi,

First, I must warn you that I am currently working on 20130109 ltp version (we do not have time at work to update to latest versions...). We are currently porting Linux to our processor architecture, and we need to have tests running, hence we decided to use ltp. Everything worked well on our first architecture but now, our compiler has to deal with two different architectures and to distinguish them, we have a gcc flag -mcore=a or -mcore=b.
The problem is that during compilation of 16 bits syscalls (setresgid01/2/3_16 for example), CFLAGS do not seem to be propagated :

*-linux-gcc -mcore=b /AND A LOT OF OTHER FLAGS/ -c -o setresgid01_16.o setresgid01.c
*
-linux-gcc -L../../../../lib setresgid03_16.o -lltp -o setresgid03_16

As you can see on second line, c flags do not appear : I checked out your latest version of compat_16.mk to see if any modification might help, but no.
The same problem appears with 64 bits syscalls (And I did the same modifications in newer_64.mk than in your latest compat_16.mk (that you did not do by the way), but it did not help either).

Do you have any hint ? Maybe I just don't set the correct environment variables (FYI : I build ltp through buildroot, and I set TARGET_C(PP)FLAGS), maybe that's a problem you already solved in newest version...

Thanks for your help guys, hope you don't mind me asking questions about very old versions :)

Alexandre Ghiti

@metan-ucw
Copy link
Member

First of all, you should really update to latest LTP, which is more than thousand fixes and hundred new test cases better than what you are using. The upgrade should be really painless and if there are any issues don't hesitate to report them.

Now to the problem. What happens is that make uses implicit rule for linking which is:

$(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS)

You can override it in the 'testcases/kernel/syscalls/utils/newer_64.mk' Makefile but I'm not sure if that is a correct way of dealing with the issue. I do not think that you need to pass the march parameter to the linker, at that point the machine code is already generated, or am I mistaken?

@AlexGhiti
Copy link
Author

We need to pass march argument to linker because the link depends on other object files like crt*.o which are stored in a or b directory.
I have just added C(PP)FLAGS to LDFLAGS in include/mk/testcases.mk (I did not find where nor how override implicit rule that you were talking about), and the build is now functional.
I tried to pass LDFLAGS flags via buildroot TARGET_LDFLAGS variable, and that does not work. Ugly solution that is sufficient for the moment, but I will try to engage a discussion about pulling newer versions of ltp.

Thanks for your help, that allowed me to go on my work ;)

jstancek added a commit that referenced this issue May 22, 2017
Only newlib testcases support SAFE macros in cleanup().
When SAFE_UNLINK fails, it creates infinite loop between
tst_brk_ and cleanup:

 #0  tst_res__ at tst_res.c:153
 #1  0x0000000000407ba8 in tst_brk__ at tst_res.c:480
 #2  0x00000000004081fe in tst_brkm_ at tst_res.c:577
 #3  0x000000000040a7c9 in safe_unlink at safe_macros.c:358
 #4  0x0000000000404abd in cleanup () at pipeio.c:497
 #5  0x0000000000407bc7 in tst_brk__ at tst_res.c:498
 #6  0x00000000004081fe in tst_brkm_ at tst_res.c:577
 #7  0x000000000040c1d6 in def_handler at tst_sig.c:231
 #8  <signal handler called>
 #9  0x00007f29c2cbd1f7 in __GI_raise at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #10 0x00007f29c2cbe8e8 in __GI_abort () at abort.c:90
 #11 0x00000000004081af in tst_brkm_ at tst_res.c:581
 #12 0x000000000040a7c9 in safe_unlink at safe_macros.c:358
 #13 0x0000000000404abd in cleanup () at pipeio.c:497
 #14 0x0000000000407bc7 in tst_brk__ at tst_res.c:498
 #15 0x00000000004081fe in tst_brkm_ at tst_res.c:577
 #16 0x000000000040c1d6 in def_handler at tst_sig.c:231
 #17 <signal handler called>
 #18 0x00007f29c2cbd1f7 in __GI_raise at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #19 0x00007f29c2cbe8e8 in __GI_abort () at abort.c:90
 #20 0x00000000004081af in tst_brkm_ at tst_res.c:581
 #21 0x000000000040a7c9 in safe_unlink at safe_macros.c:358
 #22 0x0000000000404abd in cleanup () at pipeio.c:497
 ...

Signed-off-by: Jan Stancek <jstancek@redhat.com>
@metan-ucw
Copy link
Member

Closing since there was no activity for years, feel free to reopen if this is still a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants